🎉 Lailaolab Payment Support is service now. Get Start

v1
Connect to Subscription
Cancel subscription

1. Cancel Subscription With API

1. Cancel subscription

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

2. Request body

FieldTypeDescription
authCodeStringUser is connected subscription with this code

3. Example 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);
}
};
 

4. Response Data

FieldTypeDescription
messageStringMessage to tell that unsubscription successfully
transactionIDStringUnique identifier for the transaction
authCodeStringUser is connected subscription with this code
statusStringStatus to tell that subscription is canceled
timeStringThe time when debit subscription successfully

5. Response data

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.

1. Response data

FieldTypeDescription
messageStringMessage to tell that unsubscription successfully
transactionIdStringUnique identifier for the transaction
authCodeStringUser is connected subscription with this code
statusStringStatus to tell that subscription is canceled
timeStringThe time when debit subscription successfully

2. Response data

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)