paypal android VALIDATION_ERROR(statusCode:400,exception:Bad Request)

错误信息

paypal支付报错

0-09 18:59:04.944 24078-28376/com.game.test E/paypal.sdk: request failure with http statusCode:400,exception:Bad Request
10-09 18:59:04.945 24078-28376/com.game.test E/paypal.sdk: request failed with server response:{"name":"VALIDATION_ERROR","details":[{"field":"transactions.item_list.items","issue":"Currency amount must be non-negative number, may optionally contain exactly 2 decimal places separated by '.', optional thousands separator ',', limited to 7 digits before the decimal point and currency which is a valid ISO Currency Code"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"88d0297d2aff0"}
10-09 18:59:04.945 24078-24078/com.game.test E/paypal.sdk: VALIDATION_ERROR

错误解决

        float account=0.99f;
        String accountString=account+"";
        PayPalItem[] items =
                {
                        new PayPalItem("change", 1, new BigDecimal(accountString),
                         "USD",sku),
                };               
        BigDecimal subtotal = PayPalItem.getItemTotal(items);

其实问题就出在account上,account是一个float数据,但是应该放一个string数据,放float会报错。

你可能感兴趣的:(SDK接入,Android)