submitPayment()
This method is used to initiate a payment request to the server. After the buyer clicks your custom payment button, the SDK will automatically process payment information, advance the transaction flow based on the selected payment method, and perform operations such as 3D authentication when required. Payment results and exception information will be returned through asynchronous callbacks.
Method signature
When calling this method, please use the following standard method signature format.
JavaScript
TypeScript
Parameters
The following parameters are used to configure the submission options for the payment request.
options
shippingInfo
shippingAddress
shippingName
Return value
Returns a
Promise
object that resolves to an object containing the payment result.session
nextAction
error
Error codes
Note: The payment results returned by the
submitPayment().then()
method are only for client-side page navigation and status display. For the final order status, please obtain it through Step 3: Obtain the payment result.Best practices
Loading management
Before calling the
submitPayment()
method, you may add a loading indicator and close it when handling the callback in the .then()
method.