planet x
planet x

Reputation: 1607

paypal amount currency issue

I am trying to implement PayPal into our website. I used cURL to interact with the PayPal's Express Checkout API. The website is German in nature so payments will be handled in Euro currency.

I executed my cURL and the API returned an error. I found out my $price is causing the error.

By default, $price = 56,85 with these value PayPal's API returned an error. But if change this to $price = 56.85 the API succeeds.

I can simply use str_replace to replace comma with period. But what concerns me is the price value of the product. I am transacting in Euro.

Is there anyone care to explain how can I handle this issue?

Upvotes: 1

Views: 1721

Answers (2)

Saad Tanvir
Saad Tanvir

Reputation: 1

Please if you want to show you currency in commas like 23,99 euros at PayPal Shopping Cart using PayPal Shopping Cart Integration then you can use PHP function to pass the value as decimal as mentioned above but you have to add the line to get the value in commas at PayPal Checkout Page as in FRENCH.

<input type="hidden" name="lc" value="Country Code" />

Here lc = The locale of the checkout login or sign-up page. PayPal provides localized checkout pages for some countries and languages.

You can get your Country Code at here

Further Reference link

Upvotes: 0

Fabian
Fabian

Reputation: 3495

You simply must use a dot . not a comma ,

You could replace a comma with a dot in PHP like this:

$price = "56,85";
$price = str_replace(",", ".", $price);

Now $price should be 56.85

Also this won't affect the value. 56.85 is the amount, whatever currency you'll use. Just be sure to define the currency on paypal request as EUR.

Upvotes: 5

Related Questions