Unable to set currency using paypal js sdk

vlunaram
New Community Member

I am trying to set the currency for the paypal api and I am unable to do so.

 

When you click on the paypal button, It shows the total amount in USD (next to the cart icon). Under pay with, it shows the amount converted to CAD which is more than the amount set in createOrder.

 

I have: 

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

<script>
paypal.Buttons({
  createOrder: function(data, actions) {
    return actions.order.create({
      intent: "CAPTURE",
      purchase_units: [{
        amount: {
          value: "150"
        }
      }]
    });
  },
  onError: function (err) {
    alert(err);
  }
}).render('#paypal-button-container');
</script>

 

I have tried to put currency_code: "CAD" in amount but I get: 

Error: Unexpected currency: CAD passed to order.create. Please ensure you are passing /sdk/js?currency=CAD in the paypal script tag.

 

Any ideas in what I am doing wrong or perhaps I am missing something?

 

Thanks in advance.

 

 

Login to Me Too
1 REPLY 1

MikeBarclay
Contributor
Contributor

Well you can try using 'currency' instead of 'currency_code' I saw that in an example but it isn't what the docs say. It doesn't crash but it doesn't do anything much either. I'm trying to specify GBP but whatever I do it assumes it has to convert the amount from dollars. I must say the PayPal experience has been pretty awful from the start.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.