Error: Unexpected currency: USD passed to order.create.

carlosrafael150
New Community Member

i have this code

<script src="https://www.paypal.com/sdk/js?client-id=MY_CLIENT_ID&intent=authorize&currency=EUR"></script>
<script>
paypal.Buttons({
payment: function (data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: {
total: '1.00',
currency: 'EUR'
}
}
]
}
});
},

onAuthorize: function (data, actions){
// Get the payment details
return actions.payment.get()
.then(function (paymentDetails) {
// Show a confirmation using the details from paymentDetails
// Then listen for a click on your confirm button
document.querySelector('#confirm-button')
.addEventListener('click', function () {
console.log("Payment authorized")
});
});
}
}).render('#paypal-button-container');
});
</script>

I try to pass to my create payment request a EUR currency code and I get this Javascript error:

Unexpected currency: USD passed to order.create.

First, why "order.create"?

Second, why "USD" if i passed to it "EUR"

 Could anyone help me with this issue?

Thank you.

Login to Me Too
1 REPLY 1

antoniooi
Contributor
Contributor

Hi, where did you get the sample code for the actions.payment.create? I can only see the actions.order.create all over the PayPal developer site.

 
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.