PayPal PHP REST Malformed_Request错误(Items_list)

时间:2015-08-14 14:46:18

标签: php paypal paypal-rest-sdk

嘿伙计们我想添加' items_list'到支付数组,以显示有关paypal页面中的产品的信息,但它返回错误" MALFORMED_REQUEST",但我很确定php数组的语法是正确的:

$payment = array
    (
      'intent' => 'sale',
      'redirect_urls' => array
      (
        'return_url' => 'http://page.com/return',
        'cancel_url' => 'http://pag.ecom/cancel'
      ),
      'payer' => array
      (
        'payment_method' => 'paypal'
      ),
      'transactions' => array
      (
        array
        (
          'amount' => array
          (
            'total' => $amount,
            'currency' => 'USD'
          ),
          'description' => 'This is the payment transaction description.',
          'items_list' => array
          (
            'items' => array
            (
              array
              (
                'quantity' => '1',
                'name' => 'Hat',
                'price' => '2.00',
                'sku' => 'product12345',
                'currency' => 'USD'
              )
            )
          )
        )
      )
    );

这是请求示例:

{
    "intent": "sale",
    "payer": {
        "payment_method": "paypal"
    },
    "redirect_urls": {
        "return_url": "http://<return url>",
        "cancel_url": "http://<cancle url>"
    },
    "transactions": [
        {
            "amount": {
                "total": "8.00",
                "currency": "USD",
                "details": {
                    "subtotal": "6.00",
                    "tax": "1.00",
                    "shipping": "1.00"
                }
            },
            "description": "This is payment description.",
            "item_list": { 
                "items":[
                    {
                        "quantity":"3", 
                        "name":"Hat", 
                        "price":"2.00",  
                        "sku":"product12345", 
                        "currency":"USD"
                    }
                ]
            }
        }
    ]
}

如果我删除 items_list ,它会有效...有什么建议吗?

0 个答案:

没有答案