Skip to main content
Invoke the Rebell payment UI to complete a payment flow.

Parameters

Use one of the three mutually exclusive payment reference parameters, plus the optional callbacks:
PropertyTypeRequiredDescription
tradeNOStringOne of threePayment ID returned by the backend from a Payment API call
paymentUrlStringOne of threeFull cashier URL returned by the backend
orderStrStringOne of threeSigned order string returned by the backend
successFunctionNoCallback with payment result
failFunctionNoCallback on failure
completeFunctionNoCallback that always executes
Which parameter to use depends on the payment method your backend called. Use tradeNO for standard payment flows (Retail Pay, QR Order Pay), and paymentUrl when your backend returns a cashier URL (Link Pay).

Success Callback

PropertyTypeDescription
resultCodeStringPayment result code

Result Codes

CodeMeaningAction
9000Payment appears successfulPoll backend for confirmation
6001User cancelledAllow retry
6002Network errorRetry or poll status
4000Order paid or closedCheck backend status

Code Example

my.tradePay({
  tradeNO: paymentIdFromBackend,
  success: (res) => {
    if (res.resultCode === '9000') {
      // Show pending, poll backend for confirmation
      this.pollPaymentStatus();
    } else if (res.resultCode === '6001') {
      my.showToast({ content: 'Payment cancelled' });
    }
  },
  fail: (err) => {
    console.error('Payment error:', err);
  }
});
Never trust the JSAPI result as final. The resultCode is indicative only. Always confirm payment status via backend webhook before updating business state.

Payments in Mini Apps

Complete payment guide