Paypal integration Bad request / Order could not be captured

Viewed 60

I am trying to implement paypal with credit/Debit card in react.js Here, I am using references for this : enter link description here

& Here is my code references for paypal button:

 createOrder = (data, actions) => {
    // console.log('action',actions.order);
    return actions.order.create({
      purchase_units: [
        {
          description: +"Mercedes G-Wagon",         
          amount: {
            currency_code: "USD",
            value: 200,
            // intent: 'capture',
          },
        },
      ],     
    });
  };

  onApprove = (data, actions) => {
    actions.order.capture().then(details => {
      const paymentData = {
        payerID: data.payerID,
        orderID: data.orderID
      };
      console.log("Payment Approved: ", paymentData);
    });
  };

Here is the code of paypal button:

 <PayPalButton
              createOrder={(data, actions) => this.createOrder(data, actions)}
              onApprove={(data, actions) => this.onApprove(data, actions)}
            />

Also I added PAYPAL SDK Link

src="https://www.paypal.com/sdk/js?client-id=Ae-iRhlCvBlx2WS-YACHU3MAMbbDPTj9Cp-ynyMFi2qautDvNMynnDn1mG3qgqyeiCD6IAFG0MPHfBxj
"

I tried with make payment using credit/Debit card and choose India in county drop-down But everytime I got the same error that "Order could not be captured"

How I can resolve this error ??

0 Answers
Related