Skip to main content
Version: Lastest

API Create payment method

Endpoint: /api/v1/subs/payment-methods

Method: POST

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-APPOTAPAY-AUTH": "JWT_TOKEN",
"Content-Type": "application/json",
"X-Request-ID": "Your_Unique_id",
"Language": "vi"
}

Request params

ParamRequiredTypeDescriptionNote
partnerRefIdRequiredStringUnique reference code of partnermin:1, max: 50, format: alphanumeric
customerIdConditional, if customer object doesn't have informationStringCustomer ID is created when calling ‘Create customer’ API
customerConditional, if customer ID doesn't have informationObjectCustomer information
customer.firstNameConditionalStringFirst namemin:1, max: 50
customer.lastNameOptionalStringLast namemin:1, max: 50
customer.mobileNumberOptionalString

Phone number

Format: +[Country code][Phone number]

Example: +84919333777

min:1, max: 16, format: E.164
customer.emailOptionalStringEmailmin:1, max: 50
customer.genderOptionalString

Gender

- MALE: male

- FEMALE: female

- OTHER: other

in: MALE, FEMALE, OTHER
customer.dateOfBirthOptionalStringDate of birthformat YYYY-MM-DD string
customer.placeOfBirthOptionalStringPlace of birthmax: 50
customer.nationalityOptionalStringNationality codeformat ISO 3166-2 Country Code
countryRequiredString

Country code of transaction

Accepted value

- ID: Indonesia

- PH: Philippines

- VN: Vietnam

- TH: Thailand

- MY: Malaysia

Format ISO 3166-2 Country Code
currencyRequiredStringCurrency unitin: VND
paymentMethodRequiredString

Payment method

- CC_SUBS: payment with credit card

- EWALLET_SUBS: payment with ewallet

in: CC_SUBS, EWALLET_SUBS
reusabilityRequiredString

Describes whether or not the payment method can be reused for subsequent payments.

- MULTIPLE_USE: may be reused for subsequent payments

in: MULTIPLE_USE
cardConditional, required if paymentMethod = 'CC_SUBS'ObjectCard information
card.propertiesConditional, required if paymentMethod = 'CC_SUBS'ObjectProperties
card.properties.skipThreeDSecureConditional, required if paymentMethod = 'CC_SUBS'String

This field value is only configurable for reusability = MULTIPLE_USE to indicate whether to perform 3DS during the linking phase.

- YES: skip to perform 3DS

- NO: perform 3DS

in: YES, NO
card.properties.successReturnUrlConditional, required if skipThreeDSecure = NOStringURL where the end-customer is redirected if the linking is successful.max:100
card.properties.failureReturnUrlConditional, required if skipThreeDSecure = NOStringURL where the end-customer is redirected if the linking is failed.max:100
card.cardInfoConditional, required if paymentMethod = 'CC_SUBSObjectCard information
card.cardInfo.cardNumberConditional, required if paymentMethod = 'CC_SUBS'StringCard numbermax: 20
card.cardInfo.cardMonthConditional, required if paymentMethod = 'CC_SUBS'StringCard expiry month, contain the leading zero (E.g. 03)format: MM
card.cardInfo.cardYearConditional, required if paymentMethod = 'CC_SUBS'StringCard expiry year (E.g. 2024))format: YYYY
card.cardInfo.cardHolderNameOptionalStringCard holder namemax: 50
ewalletConditional, required if paymentMethod = 'EWALLET_SUBS'ObjectEwallet information
ewallet.serviceCodeConditional, required if paymentMethod = 'EWALLET_SUBS'StringEwallet code
ewallet.propertiesConditional, required if paymentMethod = 'EWALLET_SUBS'ObjectProperties
ewallet.properties.successReturnUrlConditional, required if paymentMethod = 'EWALLET_SUBS'StringURL where the end-customer is redirected if the linking is successful.
ewallet.properties.pendingReturnUrlConditional, required if paymentMethod = 'EWALLET_SUBS'StringURL where the end-customer is redirected if the linking is pending.
ewallet.properties.failureReturnUrlConditional, required if paymentMethod = 'EWALLET_SUBS'StringURL where the end-customer is redirected if the linking is failed.
billingOptionalObjectBilling information
billing.countryRequired if any field in object has dataStringCountry codeFormat ISO 3166-2 Country Code
billing.cityRequired if any field in object has dataStringCitymin:1, max: 50
billing.provinceStateRequired if any field in object has dataStringProvince/ statemin:1, max: 50
billing.addressRequired if any field in object has dataStringAddressmin:1, max: 100
billing.zipcodeRequired if any field in object has dataStringZip codemin:1, max: 10, format: numeric

Example Request

{
"partnerRefId": "ASKJLKALK16640",
"customer": {
"firstName": "Ha",
"lastName": "Phan",
"mobileNumber": "+84123456789",
"email": "ha@gmail.com",
"gender": "MALE",
"dateOfBirth": "1996-04-23",
"placeOfBirth": "HN",
"nationality": "EC"
},
"country": "VN",
"currency": "VND",
"paymentMethod": "CC_SUBS",
"reusability": "MULTIPLE_USE",
"card": {
"properties" : {
"skipThreeDSecure": "NO",
"successReturnUrl": "https://devtool.vn/success",
"failureReturnUrl": "https://devtool.vn/failure"
},
"cardInfo" : {
"cardNumber": "5200000000001096",
"cardMonth": "07",
"cardYear": "2034",
"cardHolderName": "Mai Minh"
}
},
"billing": {
"country": "EC",
"city": "HN",
"provinceState": "CG",
"address": "CG",
"zipcode": "530000"
}
}

Response data

Success

Http Status Code 200 - OK

Success responses will contain a single Payment method object

Failure

HTTP Status Code != 200

Error response params

ParamRequiredTypeDescription
errorCoderequiredIntegerError code
messagerequiredStringError message
errorsoptionalArrayDetailed error description
errors.*.fieldoptionalStringField data is corrupted
errors.*.reasonoptionalStringDescription of the data field in error
{
"errorCode": 1,
"message": "Missing or Invalid Params",
"errors": [
{
"field": "partnerRefId",
"reason": "The partner ref id field is required."
}
]
}

Common error code table

Full error code, please check this error code list

Error codeDescription
0Success
1Missing or Invalid Params
11Partner is not found
13Partner has been blocked
14API Key is invalid
15API Key is not activated or blocked
92IP is not allowed to access
99Undefined error, please contact AppotaPay for more detailed information
401Unauthorized
500Server error
3002Duplicate partnerRefId, please try again
3003Customer not exist
30133D Secure is required
3027Customer's information is invalid