Search code examples
pythondjangopaypal-sandbox

Django PayPal for the association of an automatic email sending


Hi everyone I would like to know how you were able to manage once the customer clicks on the paypal payment button in your Django app, I would like to know how you were able to automatically manage sending an email in his mailbox

indeed I can already manage the sending of emails automatically for a button button that I created myself but the case where I used the integration of paypal on the client side, I can't do it


Solution

  • If you want your server to take action when there is a payment, you should be using a server-side integration. Full stop.

    Create two routes that return JSON, one for 'Create an Order' and one for 'Capture Order', documented here.

    Pair your two routes with the PayPal JS for approval: https://developer.paypal.com/demo/checkout/#/pattern/server

    When an order is successfully captured by your server, have your server then immediately take the desired action (send the email). This is straightforward.