This method explains how to redirect user to Gopay app for payment completion. It returns a promise that resolves with the success data. The payment result will be returned when the user returns to miniapp after completing or cancelling payment.
Note
Merchant should request to whitelist deeplink to make this work. Please connect with our product/support for this.
Integration Needed | Details |
---|---|
Mini App Frontend | Available since: GoPay 1.45.0 |
Mini App npm SDK Version | Available since: 0.3.19 |
Sample Request:
// fetch the deeplink from your miniapp backend
const paymentDeeplink = 'gopay://...';
miniAppSdk.triggerPayment({ deeplink: paymentDeeplink }).then((result) => {
console.log('Payment status:', result.data.status);
});
Sample Response:
Success Response:
{
success: true,
data: {
status: "success"
}
}
Error Response:
{
success: false,
error: {
code: 300,
message: "Permission denied"
},
}
- Data will be null in case of success = false, and vice versa.
- Error will be null in case of success = true, and vice versa.
This service only requires frontend implementation.
Payment status values:
Status | Description |
---|---|
success | User has successfully paid the transaction |
cancelled | User cancelled the transaction |
failed | There's an error processing the transaction |
pending | User goes back to the miniapp without completing or cancelling the payment |
Possible Error Codes:
Error Code | Description |
---|---|
200 | Incomplete parameter error |
201 | Invalid parameter type error |
202 | Parameter data error |
401 | Network error |