4
votes

I would like use PayPal Express Checkout and I use the official client side example of PayPal.

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 I can pass the notifiy_url to get the confirmation of payment and the data of the customer?

I assuming that onAuthorize function isn't enough. If someone could clarify I will appreciate.

Thanks for help!

1

1 Answers

2
votes

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