0

I want to accept payment in Multiple currencies & also autofill the Address/Name in PayPal form using Express Checkout method

I have tried going through various posts, paypal getting started, paypal community, but not able to find if it possible. Currently, using Express Checkout I'm able to receive payment on changing the get parameter of the script.

<script src="https://www.paypal.com/sdk/js?client-id=valueOfClientID&currency=GBP"> </script>

Is is possible to pass the currency & name/address details in below code?

<script>
  paypal.Buttons({
    createOrder: function(data, actions) {
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '24'
          }
        }]
      });
    },
    onApprove: function(data, actions) {
      return actions.order.capture().then(function(details) {
        alert('Transaction completed by ' + details.payer.name.given_name);
        // Call your server to save the transaction
        return fetch('/paypal-transaction-complete', {
          method: 'post',
          headers: {
            'content-type': 'application/json'
          },
          body: JSON.stringify({
            orderID: data.orderID
          })
        });
      });
    }
  }).render('#paypal-button-container');
</script>
Shailesh
  • 79
  • 13

1 Answers1

1

Based on the currency dynamically inject the script to the page and pass the address object as mentioned in the link

optimus
  • 729
  • 2
  • 12
  • 36
  • PayPal tech support provided me with https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/ which was not making sense..... – Shailesh Apr 05 '19 at 07:27
  • As mentioned by you, currently by passing Shipping object address is autofilled except, State & Country... – Shailesh Apr 05 '19 at 07:27
  • My first comment to your reply seems to be removed, ---- "Thanks a lot, this was very helpful. " – Shailesh Apr 08 '19 at 03:28