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.RequestEntityAll the information sent to Veritrans to request a customer be charged for a particular order.
Parameters: - charge_type (subclass of
veritranspay.payment_types.PaymentTypeBase) – Account information against which to submit the charge. - transaction_details (
veritranspay.request.TransactionDetails) – Details about the charge being submitted, such as the total amount to bill. - customer_details (
veritranspay.request.CustomerDetails) – Personal details about the person being billed. - item_details (iterable of
veritranspay.request.ItemDetails) – Line item details for this transaction.
- charge_type (subclass of
-
class
veritranspay.request.StatusRequest(order_id)[source]¶ Bases:
veritranspay.mixins.ValidatableMixinRequest 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.ValidatableMixinApproves 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.ValidatableMixinCancels 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.PaymentTypeBaseA payment made with a Epay BRI
-
class
veritranspay.payment_types.CreditCard(bank, token_id, save_token_id=False)[source]¶ Bases:
veritranspay.payment_types.PaymentTypeBaseA 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.
- bank (
-
class
veritranspay.payment_types.PaymentTypeBase[source]¶ Bases:
veritranspay.mixins.SerializableMixinBase type for all payment types. Not usable by itself.
-
class
veritranspay.payment_types.VirtualAccount[source]¶ Bases:
veritranspay.payment_types.PaymentTypeBase,veritranspay.mixins.SerializableMixinBase class for payment using virtual account
-
class
veritranspay.payment_types.VirtualAccountBca[source]¶ Bases:
veritranspay.payment_types.VirtualAccountA 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.VirtualAccountA 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.PaymentTypeBaseA payment made with a virtual account Mandiri (BillPayment Mandiri)
-
class
veritranspay.payment_types.VirtualAccountPermata[source]¶ Bases:
veritranspay.payment_types.VirtualAccountA payment made with a virtual account Permata.
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.RequestEntityRepresents 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 (
str5 >=< 19; numbers, hyphens ‘-‘, parenthesis ‘()’, spaces ‘ ‘; can start with plus symbol ‘+’) – Phone number. - country_code (
str<= 10) – ISO-3166 alpha-3 country code.
- address (
-
class
veritranspay.request.CustomerDetails(first_name, last_name, email, phone, billing_address=None, shipping_address=None)[source]¶ Bases:
veritranspay.mixins.RequestEntityPersonal 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.
- first_name (
-
class
veritranspay.request.TransactionDetails(order_id, gross_amount)[source]¶ Bases:
veritranspay.mixins.RequestEntityBasic 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.
- order_id (
-
class
veritranspay.request.ItemDetails(item_id, price, quantity, name)[source]¶ Bases:
veritranspay.mixins.RequestEntityLine 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.
- item_id (