I have following code in place for Paypal:
<html>
<head>
<script src="https://www.paypal.com/sdk/js?client-id=ABC"></script>
</head>
<body>
<div id="paypal-button-container"></div>
<script>
paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '1.00',
currency_code: 'USD'
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
// Handle the successful payment here
alert('Payment completed successfully!');
});
},
onError: function(err) {
// Handle errors during the payment process
console.log(err);
alert('An error occurred during the payment. Please try again.');
},
onCancel: function(data) {
// Handle cancellation of the payment
console.log(data);
alert('The payment was canceled.');
}
}).render('#paypal-button-container');
</script>
</body>
</html>
I have created a Paypal India business account whose primary currency is USD. I have also checked "Yes, accept and convert them to U.S. Dollars."
under Payment Preferences >> Block Payments
.
When I run this this html file, I attempt for the payment, I get the error "We’re sorry. This seller doesn’t accept payments in your currency. Please return to the seller and choose another way to pay."
I tried to search a lot but did not find any concrete solution? Where am I lagging behind? What is left out? Need help.
For India, PayPal can only be used for international payments. If the problem is something else, your question must identify the seller account and receiving app client id.
The frontend functions actions.order.create
and actions.order.capture
are deprecated and should not be used for any new integrations. See the standard integration guide for information on creating and capturing orders with a backend.