PayPal Express Error Code: 10525 #695

ablears opened this Issue Nov 12, 2013 · 9 comments

4 participants


I'm using with DPS/Payment Express and PayPal Express Checkout 2.0 for a South African store (currency set to RAND, in WPSC's PayPal settings this is set to convert to USD). PE works fine. With PayPal Express I am getting this error:

SetExpressCheckout API call failed.
Detailed Error Message: This transaction cannot be processed. The amount to be charged is zero.
Short Error Message: Invalid Data
Error Code: 10525
Error Severity Code: Error

In paypal-express.merchant.php I see this in the submit function:
$paymentAmount = $this->cart_data['total_price'];
This outputs the correct amount (eg 250)

$this->convert( $paymentAmount )
outputs 0

So the original amount is correct but converting it sets it to zero.

WP e-Commerce Plugin member

open the file:

find the function convert in the class there (arrund line 47) and replace the whole function with the one below:

        function convert($amt = NULL, $to = "", $from = ""){

            $amount = urlencode(round($amt,2));
            $from_Currency = urlencode($from);
            $to_Currency = urlencode($to);

            $url = "$amount&from=$from_Currency&to=$to_Currency";

            $ch = curl_init();
            $timeout = 20;
            curl_setopt ($ch, CURLOPT_URL, $url);
            curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
            curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
            $rawdata = curl_exec($ch);
                throw new Exception( __( 'unable to connect to currency conversion service', 'wpsc' ) );

            $data = explode('bld>', $rawdata);
            $data = explode($to_Currency, $data[1]);

            return round($data[0], 2);

WP e-Commerce Plugin member

I think this is a previously solved issue, see Issue 1121 in Google Code.

This entire function probably needs to be rewritten. We don't use curl directly, it doesn't follow coding standards, and it's using Exceptions.

WP e-Commerce Plugin member

I just made a quick workarround for the no longer iGoogle.
That issue on google code uses a service that is not free and that fix no longer works either.

They have a free plan but it requires each user to signup and more setting up of this function.

was just trying to be helpful :)

WP e-Commerce Plugin member

Yep, no worries. Good catch on a decent URL to use, as you're right, the current one in use is not viable, nor is the one on that GC ticket. Long-term, something like this would be neat to use.

WP e-Commerce Plugin member
WP e-Commerce Plugin member

Looking at wpsc_get_exchange_rate() - we should actually be deprecating the CURRENCYCONVERTER class entirely in favor of this. CURRENCYCONVERTER should essentially wrap wpsc_convert_currency(). wpsc_get_exchange_rate() should be privatized, and indeed, that's where we should be making these API changes.

Patch forthcoming.

WP e-Commerce Plugin member

@misulicus @ablears If you guys could check out the latest (d898928) and see if it fixes your issue, we can probably get this in 3.8.13, as the current implementation is completely broken.

WP e-Commerce Plugin member

Thanks guys, this fixed the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment