1. Cancel Subscription With API
In case platform need to handle cancel or unsubscription for user thought Phapay API URL: payment-gateway.lailaolab.com/v1/api/subscription/cancel-subscription
Method: POST
HAEDER: secretKey: PLATFORM_SECRET_KEY
Field | Type | Description |
---|---|---|
authCode | String | User is connected subscription with this code |
const cancelSubscription = async () => {
const data = JSON.stringify({
authCode: 'HBUN0J3Y0S9C',
});
const config = {
headers: {
secretKey: KEY, // SECRET_KEY
'Content-Type': 'application/json',
},
};
try {
const response = await axios.post(`${CANCEL_URL}`, data, config);
if(response.status === 200){
console.log("res:::",response?.data)
}
} catch (error) {
console.error('error:', error.message);
}
};
Field | Type | Description |
---|---|---|
message | String | Message to tell that unsubscription successfully |
transactionID | String | Unique identifier for the transaction |
authCode | String | User is connected subscription with this code |
status | String | Status to tell that subscription is canceled |
time | String | The time when debit subscription successfully |
application/json
{
message: 'CANCEL_SUBSCRIPTION_SUCCESSFULLY',
transactionId: 'a8d014d4-6657-4c10-8314-39f2b59cf396',
authCode: 'FOURDOLB9NAE',
status: 'CANCEL',
time: '2025-02-12 15:38:06'
}
2. Cancel Subscription With Bank App
When the user cancel Subscription or unsubscription from the bank app Phapay will will return data to webhook in (2.3) that configured above with method POST and when platform get this then return with status 200 for success.
Field | Type | Description |
---|---|---|
message | String | Message to tell that unsubscription successfully |
transactionId | String | Unique identifier for the transaction |
authCode | String | User is connected subscription with this code |
status | String | Status to tell that subscription is canceled |
time | String | The time when debit subscription successfully |
application/json
{
message: 'CANCEL_SUBSCRIPTION_SUCCESSFULLY',
status: 'CANCEL',
transactionId: 'a8d014d4-6657-4c10-8314-39f2b59cf396',
authCode: 'FOURDOLB9NAE',
time: '2025-02-12 15:38:06'
}
Read More:
Explore the full Subscription Payment for detailed integration guidelines .
Click here to access:
Subscription Payment Documentation (PDF)