3

There are 3 ways to execute and create a payment as mentioned here

  1. Client side REST
  2. Server side REST
  3. Braintree SDK

What we used was Client side REST. Code integration found on their website:

paypal.Button.render({

        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>'
        },

        // 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({
                transactions: [
                    {
                        amount: { total: '0.01', currency: 'USD' }
                    }
                ]
            });
        },

        // 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');

Is this safe?

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

We are exposing our client id on the client side which others might be able to get and use it.

Thanks and more power

Defyleiti
  • 535
  • 1
  • 7
  • 23
  • 3
    I'm also concerned about the `amount: { total: '0.01', currency: 'USD' }` line. Could someone change the price before checking out? – MoralCode Mar 24 '19 at 17:42

1 Answers1

3

looks like no one answer this question, and might be some other persons who searched it. well some other guy answer this question in the comment for the same question here paypal express checkout security with cilent ajax call

Beni Gazala
  • 277
  • 2
  • 10