createCashierPayment

POST: /amsin/api/v1/business/create

Signature required

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:

  • Maximum length: 1024 characters

industryProductCode

String

Yes

A code indicating the type of industry that the product belongs to.

Valid values are:

  • ONLINE_DIRECT_PAY

extendInfo

String

No

Extended information about the API request.

More information:

  • Maximum length: 2048 characters

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 theactionForm parameter.

More information:

  • Before processing this parameter, convert the JSON string object to an actionForm object.
  • ActionForm is a parent class object with the following child class object types: RedirectActionForm Redirection type of action form.
  • In the case that the Partner needs to redirect the Customer to a Checkout page, the redirection URL is specified by the actionForm.redirectUrl field.

extendInfo

String

No

Extended information about the API request.

More information:

  • Maximum length: 2048 characters

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 different payToRequestId. For more information on why the call failed, refer to the result.resultCode.
  • U: This indicates the API call result is unknown. Partner can make another API call when the returned status is UNKNOWNwith 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 the actionForm.redirectUrl field.

Result codes

resultCode

resultStatus

resultMessage

Further action

SUCCESS

S

Success

PROCESS_FAIL

F

A general business failure occurred. Do not retry.

Human intervention is usually needed. It is recommended that you contact WorldFirst Technical Support to resolve the issue.

PARAM_ILLEGAL

F

Illegal parameters exist. For example, a non-numeric input, or an invalid date.

Check and verify whether the request fields, including the header fields and body fields, are correct and valid.

For details on the fields of each API, see the specific API Structure section.

UNKNOWN_EXCEPTION

U

The API call is failed, which is caused by unknown reasons.

The service might be down, retry later. If the issue persists, contact WorldFirst Technical Support.

AMOUNT_EXCEEDS_LIMIT

F

The amount of the payment order exceeds the limit.

Retry with the correct amount.

AMOUNT_LESS_THEN_LIMIT

F

The amount of the payment order is less than the limit.

Retry with the correct amount.

CURRENCY_NOT_SUPPORT

F

The currency is not supported.

Make sure the currency input is correct and try again.

REPEAT_REQ_INCONSISTENT

F

Repeated requests are inconsistent.

Ensure all the fields in the requests are the same.

UNSUPPORTED_TIME_UNIT

F

Unsupported time unit.

Retry with the correct time unit.

EXPIRY_TIME_OUT_OF_RANGE

F

The expiration time is not within the valid range.

Make sure the value of paymentExpiryTime or paymentTimeoutExpress is within the valid range and try again.

Samples

Request

copy
{
    "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

copy
{
    "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"
    }
}

@2024 WorldFirst