Requests

Request objects are passed to a Gateway object to perform an action or retrieve some data from the Veritrans API.

Request Types

class veritranspay.request.ChargeRequest(charge_type, transaction_details, customer_details, item_details=[])[source]

Bases: veritranspay.mixins.RequestEntity

All the information sent to Veritrans to request a customer be charged for a particular order.

Parameters:
class veritranspay.request.StatusRequest(order_id)[source]

Bases: veritranspay.mixins.ValidatableMixin

Request used to retrieve information about a single charge that has already been submitted to Veritrans.

Parameters:order_id (str <= 50) – The unique order id of the transaction.
class veritranspay.request.ApprovalRequest(order_id)[source]

Bases: veritranspay.mixins.ValidatableMixin

Approves a transaction that is currently in state ‘CHALLENGE’.

Parameters:order_id (str <= 50) – The unique order id of the transaction.
class veritranspay.request.CancelRequest(order_id)[source]

Bases: veritranspay.mixins.ValidatableMixin

Cancels a transaction. This can only be submitted if the transaction is currently still pending.

Parameters:order_id (str <= 50) – The unique order id of the transaction.

Sub Entities

Subentities are logically smaller components that are used to generate a request. Currently, sub-entities are only used when making a ChargeRequest.

Payment Types

Warning

At the current time ONLY Credit Card payments are supported.

class veritranspay.payment_types.BriEpay[source]

Bases: veritranspay.payment_types.PaymentTypeBase

A payment made with a Epay BRI

https://api-docs.midtrans.com/#epay-bri

class veritranspay.payment_types.CreditCard(bank, token_id, save_token_id=False)[source]

Bases: veritranspay.payment_types.PaymentTypeBase

A payment made with a credit card. http://docs.veritranspay.co.id/sandbox/charge.html#vtdirect-cc

Parameters:
  • bank (str) – Represents the acquiring bank.
  • token_id (str) – A token retrieved from the Veritrans JavaScript library, after submitting the credit card details.
  • save_token_id (bool) – Used in conjunction with a 2-click to indicate whether or not this token is to be made reusable.
class veritranspay.payment_types.PaymentTypeBase[source]

Bases: veritranspay.mixins.SerializableMixin

Base type for all payment types. Not usable by itself.

class veritranspay.payment_types.VirtualAccount[source]

Bases: veritranspay.payment_types.PaymentTypeBase, veritranspay.mixins.SerializableMixin

Base class for payment using virtual account

class veritranspay.payment_types.VirtualAccountBca[source]

Bases: veritranspay.payment_types.VirtualAccount

A payment made with a virtual account BCA. NOTE: untested in sandbox, not available https://api-docs.midtrans.com/#bca-virtual-account

class veritranspay.payment_types.VirtualAccountBni[source]

Bases: veritranspay.payment_types.VirtualAccount

A payment made with a virtual account BNI NOTE: untested in sandbox, not available https://api-docs.midtrans.com/#bni-virtual-account

class veritranspay.payment_types.VirtualAccountMandiri(bill_info1, bill_info2)[source]

Bases: veritranspay.payment_types.PaymentTypeBase

A payment made with a virtual account Mandiri (BillPayment Mandiri)

https://api-docs.midtrans.com/#mandiri-bill-payment

class veritranspay.payment_types.VirtualAccountPermata[source]

Bases: veritranspay.payment_types.VirtualAccount

A payment made with a virtual account Permata.

https://api-docs.midtrans.com/#permata-virtual-account

Others

Note

These have no use beyond building a veritranspay.request.ChargeRequest.

class veritranspay.request.Address(address, city, postal_code, first_name=None, last_name=None, phone=None, country_code=None)[source]

Bases: veritranspay.mixins.RequestEntity

Represents a physical address somewhere in the world.

Parameters:
  • address (str <= 200) – Street address.
  • city (str <= 20.) – City name.
  • postal_code (str <= 10; numbers, hyphens ‘-‘, and spaces ‘ ‘) – Postal Code.
  • first_name (str <= 20.) – Person given name.
  • last_name (str <= 20.) – Person surname.
  • phone (str 5 >=< 19; numbers, hyphens ‘-‘, parenthesis ‘()’, spaces ‘ ‘; can start with plus symbol ‘+’) – Phone number.
  • country_code (str <= 10) – ISO-3166 alpha-3 country code.
class veritranspay.request.CustomerDetails(first_name, last_name, email, phone, billing_address=None, shipping_address=None)[source]

Bases: veritranspay.mixins.RequestEntity

Personal information about a customer.

Parameters:
  • first_name (str <= 20.) – Person given name.
  • last_name (str <= 20.) – Person surname.
  • email (str <= 45; Must be a valid e-mail.) – Person’s contact e-mail address.
  • billing_address (veritranspay.request.Address) – Address used to validate the charge.
  • shipping_address (veritranspay.request.Address) – Address where order should be shipped.
class veritranspay.request.TransactionDetails(order_id, gross_amount)[source]

Bases: veritranspay.mixins.RequestEntity

Basic information about a transaction with a customer, including the order id and the total amount the customer should be charged.

Parameters:
  • order_id (str <= 50) – UNIQUE order identifier.
  • gross_amount (int) – Total amount the customer will be charged.
class veritranspay.request.ItemDetails(item_id, price, quantity, name)[source]

Bases: veritranspay.mixins.RequestEntity

Line items details for a transaction.

Parameters:
  • item_id (str <= 50) – Identifier for a given item.
  • price (int) – Unit price for a given item.
  • quantity (int) – Number of units purchased.
  • name (str <= 50) – Human-readable identifier for product.