createCashierPayment
POST
: /amsin/api/v1/business/create
The Partner can initiate the createCashierPayment API to:
- Create a payment order.
- WorldFirst accepts the payment order and returns the Partner with a redirection URL. This URL redirects the Customer to a Checkout page.
Note: The payment process uses asynchronous notifications. WorldFirst acknowledges the status of the payment request in the
result.resultStatus
field. To inquire about the result of the payment order, call the inquirePayment API.
Structure
A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:
Request parameters
Field | Data type | Required | Description |
orderGroup | OrderGroup object | Yes | Information about the payment order, which includes information about the buyer, payment terminal, etc. |
payToDetails | Array<PayToDetail object> | Yes | Details about the payment that the Beneficiary receives, which includes information about the request ID, payment amount, and other related information. |
paymentRedirectUrl | String | Yes | A URL that redirects the Customer to a "Payment complete" page defined by the Partner after the payment. More information:
|
industryProductCode | String | Yes | A code indicating the type of industry that the product belongs to. Valid values are:
|
extendInfo | String | No | Extended information about the API request. More information:
|
Response parameters
Field | Data type | Required | Description |
result | Result object | Yes | Indicates whether this API is called successfully. |
payToSummaries | Array<PayToSummary> object | Yes | Details about the payment that the Beneficiary receives. |
actionForm | JSON String | Yes | A string that indicates the next action for the Partner. When the payment result is not finalized, WorldFirst returns with the More information:
|
extendInfo | String | No | Extended information about the API request. More information:
|
Result processing logic
After calling the createCashierPayment API, WorldFirst returns the Partner with a result code.
- The payment process is asynchronous. The result code indicates the status of the payment request, rather than the result of the payment order.
Possible responses for result.resultStatus
are:
S
: This indicates the API call is successful.F
: This indicates the API call failed. Call the createCashierPayment API again with a differentpayToRequestId
. For more information on why the call failed, refer to theresult.resultCode
.U
: This indicates the API call result is unknown. Partner can make another API call when the returned status isUNKNOWN
with the following strategy:
- A Partner can make 7 queries at maximum.
- Intervals between queries: 5m, 10m, 20m, 40m, 80m, 160m, and 320m.
- If none of the queries is successful, contact WorldFirst Technical Support.
If the API call is successful, the Partner needs to locate a redirection URL in the actionForm.redirectUrl
field. This URL redirects the Customer to a Checkout page where the Customer can complete the payment order.
- If the Customer completes the payment, the Partner needs to call the inquirePayment API 5 seconds later to query the result of the payment order.
- If the Customer fails to complete the payment, the Customer needs to retry the payment order with the same redirection URL.
- If the redirection URL expires, the Customer will land on a page with the result code "Unknown Exception". To retrieve a new redirection URL, the Partner needs to call the createCashierPayment API again with a different
payToRequestId
.
More information
In the API calling process, two redirection URLs are mentioned:
paymentRedirectUrl
: This URL redirects the Customer to a landing page provided by the Partner after completing the payment. The Partner needs to submit this field in the request messages of the createCashierPayment API.redirectUrl
: This URL redirects the Customer to the Checkout page where the Customer can complete the payment. WorldFirst returns this URL to the Partner in the response messages of the createCashierPayment API. More specifically, in theactionForm.redirectUrl
field.
Result codes
Samples
Request
{
"orderGroup":{
"orderBuyer":{
"referenceBuyerId":"*****"
},
"orderGroupDescription":"Cashier_payment",
"orderGroupId":"*****",
"orders":[
{
"orderTotalAmount":{
"currency": "USD",
"value": "10"
},
"orderDescription":"Cashier_payment",
"referenceOrderId":"*****",
"transactionTime":"2022-06-17T08:43:58.588Z"
}
]
},
"industryProductCode":"ONLINE_DIRECT_PAY",
"paymentRedirectUrl":"http://www.sample.com",
"payToDetails":[
{
"payToRequestId":"payTo_requestId_*****",
"payToAmount":{
"currency": "USD",
"value": "10"
},
"payToMethod":{
"paymentMethodType":"BALANCE",
"paymentMethodDataType":"PAYMENT_ACCOUNT_NO",
"paymentMethodData":"",
"customerId":"******"
},
"paymentNotifyUrl":"http://www.sample.com",
"referenceOrderId":"*****"
}
]
}
Response
{
"actionForm": "{\"actionFormType\":\"RedirectActionForm\",\"method\":\"GET\",\"redirectUrl\":\"http://{domain_name}.net/business/cashier/checkout?partnerId=*****&cashierOrderId=*****\"}",
"payToSummaries": [
{
"payToAmount": {
"currency": "USD",
"value": "10"
},
"payToCreateTime": "2022-03-21T00:00:00-07:00",
"payToId": "*****",
"payToRequestId": "payTo_requestId_*****"
}
],
"result": {
"resultCode": "SUCCESS",
"resultMessage": "success.",
"resultStatus": "S"
}
}