createPaymentSession (One-time Payments)
The createPaymentSession API is used to create a payment session for client-side SDK integration. Through this API response, Antom returns encrypted session data. You use the session data to initiate the client-side SDK. The SDK helps you complete the payment process and eliminate intermediate page redirections throughout the entire payment process.
Structure
A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:
Note: Set the data type of each field (except array) as String. This means that you must use double quotation marks (" ") to enclose the field value. Examples:
- If the data type of a field is Integer and its value is 20, set it as "20".
- If the data type of a field is Boolean and its value is true, set it as "true".
Request parameters
productCode String REQUIRED
Represents the payment product that is being used, which is stipulated in the contract. For Cashier Payment, the value is fixed as
CASHIER_PAYMENT.paymentRequestId String REQUIRED
The unique ID assigned by a merchant to identify a payment request.
More information:
- Maximum length: 64 characters
order Order REQUIRED
The order information, such as buyer, merchant, goods, amount, shipping information, and purchase environment. This field is used for different purposes:
- During the payment process, this field is mainly used by Antom for risk control or anti-money laundering.
- After the payment is completed, this field is used for recording and reporting purposes such as purchase tracking and regulatory reporting.
paymentAmount Amount REQUIRED
The payment amount that the merchant requests to receive in the order currency.
paymentFactor PaymentFactor
Factors that impact the payment. This field is used to indicate the payment scenario.
Specify this parameter when the value of paymentMethodType is
CARD and you integrate the client-side SDK. paymentMethod PaymentMethod
The payment method that is used to collect the payment by the merchant or acquirer. Specify this parameter when you integrate the client-side SDK.
availablePaymentMethod AvailablePaymentMethod
Specifies the payment methods to be displayed for buyers. If left unspecified, all your supported payment methods are to be displayed.
paymentRedirectUrl URL REQUIRED
The merchant page URL that the user is redirected to after the payment is completed.
More information:
- Maximum length: 2048 characters
paymentNotifyUrl URL
The URL that is used to receive the payment result notification.
Specify this parameter if you want to receive an asynchronous notification of the payment result. You can also set the URL to receive the result notification in Alipay+ Dashboard. If the URL is specified in both the request and Alipay+ Dashboard, the value specified in the request takes precedence.
More information:
- Maximum length: 2048 characters
settlementStrategy SettlementStrategy REQUIRED
The settlement strategy for the payment request.
enableInstallmentCollection Boolean
Indicates whether Antom collects the installment information for the payment. Specify this parameter if you need Antom to collect the installment information. Valid values are:
true: indicates Antom collects installment information when the user's card supports installments. Installments are not available when the user's card does not support installments.false: indicates you do not need Antom to collect the installment information. The same applies when the value is empty or you do not specify this parameter.
creditPayPlan CreditPayPlan
The credit payment plan information for this payment.
Specify this parameter when the payment supports installments and you specify the card-related information in paymentMethod.paymentMethodMetaData.
merchantRegion String
The country or region where the merchant operates the business. The parameter is a 2-letter country or region code that follows ISO 3166 Country Codes standard.
Some possible values are US, SG, HK, PK, JP, CN, BR, AU, and MY.
This parameter is required when you use the Global Acquirer Gateway (GAGW) product.
More information:
- Maximum length: 2 characters
env Env
Information about the environment where the order is placed.
Specify this parameter when you require risk control. Providing this information helps to increase the accuracy of anti-money laundering and fraud detection, and increase payment success rates.
paymentSessionExpiryTime Datetime
The specific date and time after which the payment session will expire. The default expiration time is 1 hour after the session creation. For example, if the session is created at 2023-7-27T12:00:01+08:30, the session expiration time is 2023-7-27T13:00:01+08:30.
Specify this parameter if you want to use a payment session expiration time that differs from the default time. The specified expiration time must be 0 to 1 hour after session creation.
More information:
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
merchantAccountId String REQUIRED
A unique identifier for a specific merchant account.
More information:
- Maximum length: 64 characters
customizedInfo CustomizedInfo
For submitting customized data, including information for special use cases.
Specify this parameter and child parameters when you need to add customized information.
paymentQuote Quote
The exchange rate between the processing currency (the currency in which the buyer pays) and presentment currency (the merchant requests to receive).
processingAmount Amount
Actual amount paid by the buyer.
Specify this parameter when you specify the quoteId.
subscriptionPlan SubscriptionPlan
The subscription plan.
Response parameters
result Result REQUIRED
The result of the API call.
paymentSessionId String REQUIRED
The encrypted ID that is assigned by Antom to identify a payment session.
More information:
- Maximum length: 64 characters
paymentSessionData String REQUIRED
The encrypted payment session data. Pass the data to your front end to initiate the client-side SDK.
More information:
- Maximum length: 4096 characters
paymentSessionExpiryTime Datetime REQUIRED
The specific date and time after which the payment session will expire.
More information:
- The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".
url String
The payment page URL. You need to redirect users to this URL to complete payment.
This parameter is returned when the hosted payment is adopted.
More information:
- Maximum length: 2048 characters
API Explorer
Request
URL
Method
POST
Case
{
"productCode": "CASHIER_PAYMENT",
"paymentRequestId": "55bf93a6-71a1-4ca9-b014-53273bd674eb",
"order": {
"referenceOrderId": "926e1c32-4a6c-442e-b5ce-8ec5b902e18c",
"orderDescription": "xxxxx",
"orderAmount": {
"currency": "BRL",
"value": "100"
},
"buyer": {
"referenceBuyerId": "yeiasdasda",
"buyerPhoneNo": "134******71"
}
},
"paymentAmount": {
"currency": "BRL",
"value": "100"
},
"paymentMethod": {
"paymentMethodType": "CARD",
"paymentMethodMetaData": {
"paymentMethodRegion": "BR"
}
},
"paymentRedirectUrl": "https://www.yourMerchantWeb.com",
"paymentNotifyUrl": "https://www.yourNotifyUrl",
"paymentFactor": {
"isAuthorization": true
},
"env": {
"clientIp": "112.80.248.78"
},
"settlementStrategy": {
"settlementCurrency": "EUR"
}
}Response
{
"paymentSessionData": "UNvjVWnWPXJA4BgW+vfjsQj7PbOraafHY19X+6EqMz6Kvvmsdk+akdLvoShW5avHX8e8J15P8uNVEf/PcCMyXg==&&SG&&111",
"paymentSessionExpiryTime": "2023-04-06T03:28:49+08:00",
"paymentSessionId": "UNvjVWnWPXJA4BgW+vfjsQj7PbOraafHY19X+6EqMz6Ikyj9FPVUOpv+DjiIZqMe",
"result": {
"resultCode": "SUCCESS",
"resultMessage": "success.",
"resultStatus": "S"
}
}More information
About the order field: Antom does not verify the consistency of the amount in the order field and the amount in the payment request. The order information is not applied in fund operations either. This field is mainly used for risk control, supervision, regulatory reporting, and consumption records display. Use the env field if the risk control capability provided by Antom is needed.
{
"order": {
"referenceOrderId": "102775745075669",
"orderDescription": "Mi Band 3 Wrist Strap Metal Screwless Stainless Steel For Xiaomi Mi Band 3 ",
"orderAmount": {
"value": "500",
"currency": "USD"
},
"goods": [{
"referenceGoodsId": "102775745075669",
"goodsName": "xxx goods",
"goodsUnitAmount": {
"currency": "USD",
"value": "498"
},
"goodsQuantity": "1"
}],
"shipping": {
"shippingName": {
"fullName": "Bob Day"
},
"shippingAddress": {
"region": "US",
"state": "California",
"city": "San Mateo",
"address1": "400 El Camino Real",
"address2": "suit 107",
"zipCode": "95014"
},
"shippingCarrier": "USPS",
"shippingPhoneNo": "9093749555"
},
"buyer": {
"referenceBuyerId": "bob@gmail.com",
"buyerName": {
"fullName": "Bob Day"
},
"buyerPhoneNo": "+86 18888888888",
"buyerEmail": "bob@gmail.com"
}
}
} Result/Error codes
| Code | Value | Message | Further action |
|---|---|---|---|
| SUCCESS | S | Success | The payment session is successfully created. No further action is needed. |
| CARD_NOT_SUPPORTED | F | The card used for the transaction is not supported. | Use another card to pay the transaction. |
| CURRENCY_NOT_SUPPORT | F | The currency is not supported. | Contact Antom Technical Support for detailed reasons. |
| INVALID_MERCHANT_STATUS | F | The merchant status is abnormal because restrictions exist. | Contact Antom Technical Support for detailed reasons. |
| NO_PAY_OPTIONS | F | No payment options are available. | Contact Antom Technical Support for detailed reasons. |
| PARAM_ILLEGAL | F | The required parameters are not passed, or illegal parameters exist. For example, a non-numeric input, an invalid date, or the length and type of the parameter are wrong. | Check and verify whether the required request fields (including the header fields and body fields) of the current API are correctly passed and valid. |
| PROCESS_FAIL | F | A general business failure occurred. | Do not retry. Human intervention is usually needed. It is recommended that you contact Antom Technical Support to troubleshoot the issue. |
| TOKENIZATION_NOT_ALLOWED | F | The payment method does not support tokenization. | Contact Antom Technical Support for the reason why the payment method does not support tokenization and address it accordingly. |
| UNKNOWN_EXCEPTION | U | An API call has failed, which is caused by unknown reasons. | Call the interface again to resolve the issue. If not resolved, contact Antom Technical Support. |