Hi, I have created a custom PayPal button by adding the code into an HTML iframe. So, my question is is there a way I can add some codes in that HTML iframe(see below) so that after my customers make a payment, they will automatically receive a custom email text from me (not from PayPal). I need that custom email to include their booking details such as ‘name’, ‘email’, ‘phone’, and any other relevant important information such as ‘booking date and time’ and ‘amount paid’.
Below is the code:
<script type="text/javascript">
let AMOUNT = 0;
window.onmessage = (event) => {
if (event.data > 0) {
AMOUNT = event.data;
}
}
paypal.Button.render({
style: {
layout: ‘horizontal’,
fundingicons: ‘true’,
size: ‘large’,
color: ‘gold’,
shape: ‘rect’,
label: ‘pay’
},
env: 'sandbox', // sandbox | production
// PayPal Client IDs - replace with your own
// Create a PayPal app: https://developer.paypal.com/developer/applications/create
client: {
sandbox: 'xxxxx',
production: 'xxxxx' //Note that I haven't include my IDs yet.
},
// Show the buyer a 'Pay Now' button in the checkout flow
commit: true,
// payment() is called when the button is clicked
payment: function(data, actions) {
// Make a call to the REST api to create the payment
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: `${AMOUNT}`, currency: 'MYR' }
}
]
}
});
},
// onAuthorize() is called when the buyer approves the payment
onAuthorize: function(data, actions) {
// Make a call to the REST api to execute the payment
return actions.payment.execute().then(function() {
window.alert('Payment Complete!');
});
}
}, '#paypal-button-container');
</script>