Change currency doesn't work on api Rest

Anonynudes
Contributor
Contributor

Hello, i try to use the rest api but i cant change the currency on the api config :

when i try this code, Paypal window open whit currency on USD and print 1.30 USD 

 

if you have a solution , Thanks a lot ! 

 

 

paypal.Buttons({
createOrder: function(data, actions) {
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
locale: 'fr_FR',
purchase_units: [{
amount: {
value: '1.30',
currency : "EUR",

}
}]
});
},

 

Login to Me Too
3 REPLIES 3

nickbeat
Contributor
Contributor

Change currency : "EUR", to currency_code : "EUR",

does that work?
that's what the documentation says. but it doesn't work for me, because no paypal payment popup opens. if i leave it out, or change it to USD, everything is no problem. where is the error?

 

Login to Me Too

Brisbane22
Contributor
Contributor

The reply by nickbeat above seems correct, to use currency_code

 

Here is my code ... I've left in lines you don't need like the style, just for interest

 

paypal.Buttons({
	style: {
		shape: 'pill',
		label: 'checkout',
	},
	createOrder: function (data, actions) {
		return actions.order.create({
			purchase_units: [{
				amount: {
					value: $('#idTotal').text().replace(",", ""),
					currency_code: 'AUD'
				},
				description : 'some text here', // max 127
				invoice_id: 'invoice number here' // max 127
			}]
		});
	},
	onShippingChange: function (data, actions) {
// etc

.

It all seems to match what the OP and nick said. But I have not tried any currency other than AUD. Note that without that, it defaulted to USD if I recall correctly.

Login to Me Too

Brisbane22
Contributor
Contributor

Just remembered, there is one other thing you need. I got it from the groups.google.com/g/etsy-api-v2

 

<script src="https://www.paypal.com/sdk/js?currency=AUD&client-id=<% ShowClientId(); %>"></script>

 

Note the currency in the script line.

The ShowClientId part is just ASP.Net syntax.

 

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.