Payment
Note: Payment permissions need to be applied on the payment platform before use. Currently supported platform: paynicorn
Mini Program Integration with Paynicorn H5 Cashier includes two steps:
Create an order and get the redirect link to the cashier after the payment.
Open the cashier in a WebView using the obtained redirect link.
1. Create Order
Include the callback address cpFrontPage in the parameters.
Code Example
dlt.request({
url: 'https://somedomain.com/some-create-order-api', // Example API, the business interface for creating orders
data: JSON.stringify({
cpFrontPage: 'pages/orderResult/orderResult', // Redirect to the business address after payment completion, the payment result page within the Mini Program
...otherData, // Other parameters to be passed according to the interface requirements
}),
method: 'POST_JSON',
header: JSON.stringify({
'content-type': 'application/json',
}),
dataType: 'json',
success: (res) => {
// Get the redirect link to the H5 cashier webUrl
console.log(res.data.webUrl);
},
});
2. Open the Cashier
Open the H5 cashier page inside the applet, and the webUrl is obtained through the first step
Code Example
dlt.openHybridH5Page({ url: webUrl });