-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
Thank you for this library, but i would like to ask something since it's my first time implementing auto renewable subscription..
So now after the user purchase the subscription i should send the receipt to my backend and validate it, and then if it's valid i should store the receipt and the expiration date in my db, and since i have a corn job that runs daily i can check if the subscription is expired, and if it's i can send the receipt again to check if it's renewed or not, is that right? and if it returns an error meaning that it's not valid anymore?
app.post('/receipt-validation' , (request , response) => {
const platform = request.body.platform;
const userId = request.body.userId;
const receipt = request.body.platform;
const payment = {
receipt: receipt, // always required
productId: 'com.shamhandev.snaplearn',
packageName: 'com.shamhandev.snaplearn',
excludeOldTransactions: true, // ios
secret: 'password',
subscription: true, // optional, if google play subscription
keyObject: {}, // required, if google
};
iap.verifyPayment(platform, payment)
.then(
res => {
//Updating subscription status in db
},
err => {
/* your code */
}
)
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels