Gateways

Gateway objects are used to submit requests, and receive back responses from the Veritrans API.

When the gateway is created, by default, it is set to production mode, however you can specify that a gateway should run in sandbox mode by passing the appropriate value to it’s __init__() method.

Note

Currently, only the VT-Direct gateway is supported.

class veritranspay.veritrans.VTDirect(server_key, sandbox_mode=False)[source]

Bases: object

Gateway used to submit requests to Veritrans via the VTDirect method.

Parameters:
  • server_key (str) – Your Veritrans account server key.
  • sandbox_mode (bool) – If True, requests will be submitted to the Veritrans sandbox API, instead of the live API.
base_url[source]

Returns the Veritrans base URL for API requests. This will differ depending on whether sandbox_mode is enabled or not.

submit_approval_request(req)[source]

Sends a request to Veritrans to approve a single, challenged transaction.

Parameters:req (veritranspay.request.ApprovalRequest or Any response class that has an order_id attribute, such as veritranspay.response.response.ChargeResponseBase) – Data about a transaction to approve.
Return type:veritranspay.response.response.ApproveResponse
submit_cancel_request(req)[source]

Sends a request to Veritrans to cancel a single transaction.

Parameters:req (veritranspay.request.CancelRequest or Any response class that has an order_id attribute, such as veritranspay.response.response.ChargeResponseBase) – Data about a transaction to cancel.
Return type:veritranspay.response.response.CancelResponse
submit_charge_request(req)[source]

Submits a charge request to the API. Before submitting, all the data in the req is validated and if a failure occurs a ValidationError will be raised.

Parameters:req (veritranspay.request.ChargeRequest) – Information about a transaction and a customer to charge.
Return type:veritranspay.response.response.ChargeResponseBase
submit_status_request(req)[source]

Retrieve information from Veritrans about a single transaction.

Parameters:req (veritranspay.request.StatusRequest or Any response class that has an order_id attribute, such as veritranspay.response.response.ChargeResponseBase) – Data about a transaction to retrieve the status of.
Return type:veritranspay.response.response.StatusResponse