PayPal Payouts API错误

时间:2015-02-20 22:24:43

标签: php curl paypal

我按照https://developer.paypal.com/docs/integration/direct/create-single-payout/上的示例操作,但一直收到此错误:

数组([名称] => MALFORMED_REQUEST_ERROR [消息] => Json请求格式错误。[debug_id] => aef61e278b531 [information_link] => https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST_ERROR

这是卷曲请求:

curl -v https://api.sandbox.paypal.com/v1/payments/payouts?sync_mode=true \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <Access-Token>" \
-d "{
"sender_batch_header": {
        "email_subject": "You have a payment"
    },
    "items": [
        {
            "recipient_type": "EMAIL",
            "amount": {
                "value": 12.34,
                "currency": "USD"
            },
            "receiver": "shirt-supplier-one@mail.com",
            "note": "Payment for recent T-Shirt delivery",
            "sender_item_id": "A123"
        }
    ]
}"

错误文档说JSON格式不正确但后来我使用jsonlint来确保它是一个有效的JSON。它能是什么?

1 个答案:

答案 0 :(得分:0)

Matt关于正确转义引号的评论应该让你前进:

e.g。跳过所有内容,这只是有效负载/数据(-d):

-d "{ \"payer_id\" : \"THE_PAYER_ID\" }"

H个..