I'm building a bot and for the premium version I would like to charge the user a specific amount. I'm using stripe to process the payment.
The payment flow works like this: Bot shows a generic template with a web url button which takes the user to my check out page. After the check out has completed I'd like to add the users messenger userID to my database.
Now the problem here is that I don't know how to send the userID to the checkout page. I'm using stripe checkout to show the payment form. I tried using a webhook and send the userID from messeneger to the stripe checkout page but that too didn't work(should I use stripe webhook api? If yes how do I do it?).
I'm not sure how to do it. Is there any other way? Or am I missing something or doing something wrong? I just need to get the userId from messenger then store it in the db. I've searched everywhere on the internet but couldn't find anything.I'm using python and flask to do this. Thanks in advance!
On the URL button, set messenger_extensions: true
, then you can call MessengerExtensions.getContext()
to retrieve the user's PSID on your site.