Skip to main content
Version: Lastest

Charge Create

You can request charge by token or card information. A charge consists of two sub-processes:

  • Authorization: Confirming with the issuing bank that the card is eligible for transaction and is able to pay. At this point, the money is put on hold and settlement has not started yet.

  • Capture: The transaction is locked to be completed and the settlement process will be started.

EndPoint

POST /credit-card/charge

Header Params

ParamRequiredTypeDescriptionNote
X-APPOTAPAY-AUTHrequiredString How to generate JWT_TOKEN
Content-TyperequiredStringValue: application/json
X-Request-IDoptionalStringUUIDv4 format. Request ID to check when a problem occursmax:42
LanguageoptionalStringThe value vi or en corresponding to the payment link will be Vietnamese or English, (default: vi)

in:vi,en

X-Account-Ref-IDoptionalString

Iidentifier of the sub account provided by AppotaPay.

Mandatory be passed over when processing payment for transactions of owner-type sub account

{
"X-APPOTAPAY-AUTH": "JWT_TOKEN",
"Content-Type": "application/json",
"X-Request-ID": "Your_Unique_id",
"Language": "vi",
"X-Account-Ref-ID": "9723f73b-9295-4acb-884b-ab6310c2e653"
}

Request Params

ParametersRequirementData typeDescriptionNote
cardrequiredObjectCard information
card.numberrequiredStringCard number16 numbers
card.holderNamerequiredStringCard holderMin: 1 Max: 50 Including: 0- 9, a-z, A-Z, Space
card.expirationMonthrequiredStringCard expiration month, including leading 0 (E.g.: 03 for March)Format: MM
card.expirationYearrequiredStringCard expiration year (E.g.: 25)Format: YY
card.cvvrequiredStringCard verification number, also known as CVV
The card's secret code includes 3 or 4 numbers
tokenIdrequired_ifStringRequired if card isn't provided
Token ID for payment instead of card information
amountrequiredFloatAmount of the payment processed on the card, being submitted for authentication (E.g.: 1000)Support VND
captureoptionalBooleanDefault: false
Whether or not to capture immediately
Set to true to perform Authorization and Capture immediately.
Set to false to issue an Authorization (hold funds) only, to be captured later with the Capture Charge
Note: Authorizations expire in 7 days.
merchantRefIdrequiredStringReference ID you can use to identify the transactionMin: 1 Max: 40
authenticationIdrequired_ifStringUnique authentication ID returned by AppotaPay during in the 3DS Authentication response (or callback) to identify the 3DS transaction.
For transactions where you do not want to initiate 3DS Authentication and proceed straight to an Authorization / Charge, do not include this parameter in the Charge request.
Note: Required when config 3ds is required
Min: 1 Max: 40
currencyrequiredStringPayment currency. Should be a 3-letter code following the ISO-4217 standardSupport: VND
billingoptionalObjectBilling details of the cardholder. If entered, should correspond with billing details registered by the cardholder with their issuer.
If entered billing information, you need to enter all information and correspond as registered to your issuing bank.
billing.firstNameoptionalStringFirst name of cardholder
Useful with frictionless 3DS 2.0
Min: 1 Max: 50
billing.lastNameoptionalStringLast name of cardholder
Useful with frictionless 3DS 2.0
Min: 1 Max: 50
billing.emailoptionalStringCardholder’s email address on record with issuer
Useful with frictionless 3DS 2.0
Min: 1 Max: 255
billing.phoneNumberoptionalStringCardholder’s mobile phone number on record with issuer
Useful with frictionless 3DS 2.0
Min: 8 Max: 20
billing.provinceoptionalStringUse this to enter province, state or region of residence. If the user is USA citizen, make sure to use state code (e.g put CA instead of California)
Useful with frictionless 3DS 2.0
Min: 1 Max: 100
billing.cityoptionalStringCity, village or town as appropriate
Useful with frictionless 3DS 2.0
Min: 1 Max: 100
billing.countryoptionalString2-letter ISO 3166-2 country code for the customer's country of residence
Useful with frictionless 3DS 2.0
Min: 2 Max: 2
billing.addressLine1optionalStringBuilding name and apartment unit number
Useful with frictionless 3DS 2.0
Min: 1 Max: 100
billing.addressLine2optionalStringBuilding name and apartment unit number
Useful with frictionless 3DS 2.0
Min: 1 Max: 100
billing.postalCodeoptionalStringPostal, zip or rural delivery code, if applicable
Useful with frictionless 3DS 2.0
Min: 1 Max: 10

Example Request

{
"merchantRefId": "hi8xGfznb",
"authenticationId": "01HQHRPNYW78CQJK7CAW1SJP9F",
"tokenId": "01hqhrp3yhff7z7bvtq6whwz8t",
"amount": 1000000,
"currency": "VND",
"capture": false,
"billing" : {
"firstName": "NHUNG",
"lastName": "HOANG",
"email": "nhunghoang@email.com",
"phoneNumber": "02345686432",
"province": "VP",
"country": "MM",
"city": "VT",
"addressLine1": "81 Lang Ha",
"addressLine2": "17 Mai Anh Tuan",
"postalCode": "10000"
}
}

Response Params

{
"id": "01HQHRS9P9J5YPCJ09D94VW84F",
"authenticationId": "01HQHRPNYW78CQJK7CAW1SJP9F",
"merchantRefId": "hi8xGfznb",
"status": "AUTHORIZED",
"authorizedAmount": 1000000,
"currency": "VND",
"approvalCode": "831000",
"eci": "02",
"bankReconciliationId": "7089196646896845103954",
"tokenId": "01hqhrp3yhff7z7bvtq6whwz8t",
"card": {
"number": "520000XXXXXX2151",
"expirationMonth": "12",
"expirationYear": "29",
"cardBrand": "MASTERCARD",
"cardType": "CREDIT",
"countryCode": "VI"
},
"chargeType": "BY_MULTIPLE_TOKEN",
"createdAt": "2024-02-26T10:54:22+07:00",
"updatedAt": "2024-02-26T10:54:25+07:00"
}

Success

Http Status Code 200 - OK

ParametersData typeDescription
merchantRefIdStringA unique identifier of merchant is sent in the request
cardStringCard information is stored in the token
card.numberString1st 6 and last 4 digits of the tokenized card. (E.g. 123456xxxxx1234)
card.expirationMonthStringCard expiration month, including leading 0 (E.g.: 03 for March)
card.expirationYearStringCard expiration year (E.g.: 27)
card.brandStringCard brand:
VISA / MASTERCARD / JCB / AMEX
card.countryStringCountry of the card issuing bank in ISO 3166-1 alpha-2 format (E.g.: VN, US)
reconciliationIdStringID of the transaction that can be reconciled with AppotaPay
bankReconciliationIdStringID of the transaction that can be reconciled with bank
authorizedAmountNumberThe amount that've been authorized for this charge
capturedAmountNumberThe amount that've been captured for this charge. Can be up to authorizedAmount
currencyStringPayment currency
statusStringStatus of the charge
PENDING: Payment is processing.
CAPTURED: Charge is successfully captured and the funds will be settled according to the settlement schedule.
AUTHORIZED: Charge is successfully authorized.
PARTIAL_AUTHORIZED: Charge is successfully partial authorized.
DECLINED: Charge failed
eciString3DS authentication status. See ECI code
idStringID of the transaction
Id can be used in many APIs such as: Capture API, Reversal API, Refund API or Get Charge API (if meeting conditions)
approvalCodeStringCode from issuer bank returned
errorInformationObjectFailure reason
errorInformation.errorCodeIntegerError code. See error code
errorInformation.messageStringError message
errorInformation.detailsArray or ObjectError details
errorInformation.details.fieldStringFailure field
errorInformation.details.reasonStringReason why the field failed
chargeTypeStringCharge type
- BY_SINGLE_TOKEN
- BY_MULTIPLE_TOKEN
- BY_CARD_INFO
createdAtStringTransaction creation time according to RFC-3339 standard, time zone UTC+7
updatedAtStringLast updated time according to RFC-3339 standard, time zone UTC+7

Error

HTTP Status Code != 200