laravel 尝试实现Paypal创建订单API时出现问题

zqdjd7g9  于 2023-01-31  发布在  其他
关注(0)|答案(1)|浏览(294)
    • bounty将在6天后过期**。回答此问题可获得+50的声誉奖励。Pankaj正在寻找来自声誉良好来源的答案
    • 关于这个问题**

这是关于在贝宝创建订单API。文档链接在这里我试图通过下面的有效载荷,以便请求可以有我的返回和取消网址,一切工作完美。

"intent": "CAPTURE",
"purchase_units": [
    {
        "amount": {
            "currency_code": "USD",
            "value": "100.00"
        }
    }
],
"application_context" => [
    "return_url" => "my return url",
    "cancel_url" => "my cancel url"
]
    • 只有返回和取消URL在application_context中被弃用。**

为了克服这个问题,我从有效负载中删除了application_context,并添加了payment_source,如下所示,其中包含返回和取消URL

"intent": "CAPTURE",
"purchase_units": [
    {
        "amount": {
            "currency_code": "USD",
            "value": "100.00"
        }
    }
],
"payment_source": {
    "paypal": {
        "experience_context": {
            "return_url": "return Url",
            "cancel_url": "cancel Url"
        }
    }
}

现在,它给出错误消息-PAYPAL_REQUEST_ID_REQUIRED

    • 我需要通过返回和取消网址,在这个阶段我只需要创建请求,让用户去结帐页面。就是这样。我真的没有任何付款信息了。**
klr1opcd

klr1opcd1#

https://developer.paypal.com/api/rest/reference/orders/v2/errors/

PAYPAL_REQUEST_ID_REQUIRED: A PayPal-Request-Id is required if you are trying to process payment for an Order. Please specify a PayPal-Request-Id or Create the Order without a payment_source specified.

在标题中添加此参数

PayPal-Request-Id   
string [ 1 .. 36 ] characters
The server stores keys for 6 hours. The API callers can request the times to up to 72 hours by speaking to their Account Manager.

相关问题