thephpleague / omnipay-paypal

PayPal driver for the Omnipay PHP payment processing library
MIT License
299 stars 174 forks source link

Invalid integer part XX,XX. Invalid digit , found #233

Closed carstengrimm closed 5 years ago

carstengrimm commented 5 years ago

When using the

->setItems($items)

method for paypal to actually list the shopping cart, i am running into an error i can not figure out where to fix it.

To me it seems the setItems method is calculating the total and errors out with the error

Kirby_CMS_Debugger_-_Brave_2019-07-01_19-00-17

since language is set to another language, where the decimal symbol is a semicolon.

I have been checking the values inside the $items call as well as the gateway purchase amount value, which seems to be formatted with the correct decimal symbol

e.g.

Array
(
    [0] => Array
        (
            [name] => Product
            [price] => 34.90
            [quantity] => 2
        )

)

the amount value is set to "69.80".

When not using the setItems() method, everything is working flawlessly, but the items list obviously is not showing.

Can anyone pinpoint me to the right direction where as i could modify so it'll kinda format with setItems with the correct decimals?

carstengrimm commented 5 years ago

at some point i found a solution/workaround, ... obviously there was an issue with formatting for numbers and decimals so just before building the items list i had to change language to US

    // For currency to work
    setlocale (LC_ALL, 'en_US');