Luehang / react-paypal-button-v2

An easy and simple to use React button component to implement PayPal Checkout with Smart Payment Buttons V2 (Version 2).
https://luehangs.site/lue_hang/projects/react-paypal-button-v2
MIT License
273 stars 81 forks source link

paypal-button-v2 keeps on redirecting to sandbox #36

Closed galonge closed 4 years ago

galonge commented 4 years ago

Hello, i implemented the paypal-button-v2 on my app and included the clientId in the options prop as shown below. The clientId is set to live in paypal developer dashboard, however, the app still always redirects to sandbox for payment.

see below: `return ( <PayPalButton amount="11.00" onSuccess={(details, data) => {

      //Send transaction details to backend api
      // let tempPayRecords = {};
      // tempPayRecords.payer_email = details.payer.email_address;
      // tempPayRecords.payer_name = details.payer.name;
      // tempPayRecords.payer_phone = details.payer.phone;
      // tempPayRecords.payer_address = details.payer.address;
      // tempPayRecords.status = details.status;
      // tempPayRecords.user_email = this.state.paymentRecords.email;
      // tempPayRecords.user_firstname = this.state.paymentRecords.fname;
      // tempPayRecords.user_lastname = this.state.paymentRecords.lname;
      // tempPayRecords.user_phone = this.state.paymentRecords.phone;
      // tempPayRecords.payment_ref = data.orderID;
      // tempPayRecords.amount_paid = this.state.paymentRecords.amount;

      return this.completePurchase(tempPayRecords);

    }}
    options={{
      clientId:
        "AdZE9s3sEAYws0EqSJp9lSqe6umA67yuaMq0KbU_RTEpvj61a8Sf5nDs4a32Llnc3VtBKVieoFRkZkGL"
    }}
  />
);`
123Spork commented 4 years ago

I am also getting this issue.

galonge commented 4 years ago

@123Spork, I was able to get it resolved by adding the following with my live client ID to the head of the index.html page of my react app. I hope it helps.

<script src="https://www.paypal.com/sdk/js?client-id=<YOUR-LIVE-CLIENT-ID>"> </script>