Essential APIs

tradePay

Collect wallet payments by redirecting the user to the hosted wallet cashier.

Overview

my.tradePay is part of the Cashier Payment flow used to collect wallet payments.

my.tradePay launches the wallet cashier so the user can confirm and complete a payment. Pass the cashier paymentUrl you obtained from the pay API response — specifically the redirectActionForm.redirectionUrl field. On completion, the API returns a status code indicating whether the payment succeeded, failed, or is still processing.

Usage Example

my.tradePay({
  paymentUrl: 'https://wallet.example.com/cashier?orderId=xxxxxxx',
  success: (res) => {
    my.alert({
      content: JSON.stringify(res)
    });
  },
  fail: (err) => {
    my.alert({
      content: JSON.stringify(err)
    });
  }
});

Parameters

PropertyTypeRequiredDescription
paymentUrlstringNoThe redirect URL of the cashier page, obtained from the pay response field redirectActionForm.redirectionUrl. See Cashier payment flow for how to obtain it.
successFunctionNoCallback executed when the API call succeeds. Provides the payload defined in Callback payload.
failFunctionNoCallback executed when the API call fails.
completeFunctionNoCallback executed after success or failure.

The pay API returns the cashier URL as redirectActionForm.redirectionUrl. Pass that exact value as tradePay's paymentUrl to route the user to the correct cashier.

Callback Payload

PropertyTypeRequiredDescription
resultCodestringYesResult code representing the payment outcome. See Result codes.

Success Example

{
  "resultCode": "9000"
}

Result Codes

resultCodeDescription
9000Payment successful.
8000Payment processing; final status pending.
4000Payment failed.
6001User cancelled the payment.
6002Network exception occurred.
6004Unknown payment result; retry status query.