You can achieve this only if the payment page is controlled (developed by you), if it is a third-party payment gateway, you can do nothing. if the payment page is controlled by you, you can pass the sender ID as a parameter via web_url or get the sender ID through
<script> (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.com/en_US/messenger.Extensions.js"; fjs.parentNode.insertBefore(js, fjs); }(document, "script", "Messenger")); window.extAsyncInit = function () { </script>
using the sender ID, you can send the message text back to the bot. to close the webview after all this includes this script after sending the text to the bot
<script> (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.com/en_US/messenger.Extensions.js"; fjs.parentNode.insertBefore(js, fjs); }(document, "script", "Messenger")); window.extAsyncInit = function () { </script>
As in your bot, you must make sure that the page access token is available before sending the text, and also make sure that you use the white list of the domain used in your web browser, and you set "messenger_extensions": true, in your button web_url or you wonβt be able to get the sender ID using the messenger extension
link
Url
messaging extension
source share