How do I set up an IPN for PayPal Express Checkout?

I would like to use PayPal Express Checkout and I am using the official PayPal client example.

https://developer.paypal.com/demo/checkout/#/pattern/client

<script src="https://www.paypalobjects.com/api/checkout.js"></script>

<div id="paypal-button-container"></div>

<script>

    // Render the PayPal button

    paypal.Button.render({
x
        // Set your environment

        env: 'sandbox', // sandbox | production

        // PayPal Client IDs - replace with your own
        // Create a PayPal app: https://developer.paypal.com/developer/applications/create

        client: {
            sandbox:    'AZDxjDScFpQtjWTOUtWKbyN_bDt4OgqaF4eYXlewfBP4-8aqX3PiV8e1GWU6liB2CUXlkA59kJXE7M6R',
            production: '<insert production client id>'
        },

        // Set to 'Pay Now'

        commit: true,

        // Wait for the PayPal button to be clicked

        payment: function(actions) {

            // Make a client-side call to the REST api to create the payment

            return actions.payment.create({
                transactions: [
                    {
                        amount: { total: '0.01', currency: 'USD' }
                    }
                ]
            });
        },

        // Wait for the payment to be authorized by the customer

        onAuthorize: function(data, actions) {

            // Execute the payment

            return actions.payment.execute().then(function() {
                window.alert('Payment Complete!');
            });
        }

    }, '#paypal-button-container');

</script>

      

My question is, how can I pass notifiy_url to get the payment confirmation and customer details?

I suppose the onAuthorize function is not enough. If anyone can clarify I would appreciate it.

Thanks for the help!

+3


source to share


1 answer


With REST APIs, you need to use Webhooks , not IPN. IPN is for classic APIs.



+1


source







All Articles