PayPal Server SDK:如何批准订单 ID [英] PayPal Server SDK: how to approve an order ID

查看:95
本文介绍了PayPal Server SDK:如何批准订单 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图为我的一个项目实施 paypal api

I was trying to implement paypal api for one of my projects

我正在使用沙盒环境和服务器端 sdk

I am using sandbox environment and server side sdk

在我的请求中

{
    "intent": "CAPTURE",
    "application_context": {
      "brand_name": "EXAMPLE INC",
      "landing_page": "BILLING",
      "shipping_preference": "SET_PROVIDED_ADDRESS",
      "user_action": "PAY_NOW"
    },

"intent": "CAPTURE"
"user_action": "PAY_NOW"

我使用 api OrdersCreateRequest() 创建了一个订单.在响应中我得到

I created an order using the api OrdersCreateRequest(). In the response i get the

result.id = "IDVALUE"
result.status = "CREATED"

还有链接

"links": [
    {
        "href": "https://api.sandbox.paypal.com/v2/checkout/orders/XXXXXXXX",
        "method": "GET",
        "rel": "self"
    },
    {
        "href": "https://www.sandbox.paypal.com/checkoutnow?token=XXXXXXXXXX",
        "method": "GET",
        "rel": "approve"
    },
    {
        "href": "https://api.sandbox.paypal.com/v2/checkout/orders/XXXXXXXXXXXXXX",
        "method": "PATCH",
        "rel": "update"
    },
    {
        "href": "https://api.sandbox.paypal.com/v2/checkout/orders/XXXXXXXXXXXXXX/capture",
        "method": "POST",
        "rel": "capture"
    }
],

我试图打开网址

        {
            "href": "https://www.sandbox.paypal.com/checkoutnow?token=XXXXXXXXXX",
            "method": "GET",
            "rel": "approve"
        },

在浏览器中,它要求使用 PayPal 登录、我们必须使用哪些凭据作为登录名和密码.我只有 client_idclient_secret

In the browser, it asks for PayPal login, what credentials we have to use as login and password. I have only client_id and client_secret

如何获取已批准的订单 ID.我现在该怎么办.

How to get an approved order id. What should I do now.

推荐答案

下一步是将付款人重定向到该批准_url 或使用带有智能支付按钮的订单 ID,这比重定向更好.无论哪种方式,付款人都将使用其 PayPal(沙盒)买家帐户登录,或在 PayPal 窗口或表单中输入其(沙盒)买家信息.

The next step is to redirect the payer to that approval_url or use the Order ID with Smart Payment Buttons, which is better than redirecting. Either way the payer will be signing in with their PayPal (sandbox) buyer account or entering their (sandbox) buyer information in a PayPal window or form.

使用的最佳审批流程是 https://developer.paypal.com/demo/checkout/#/pattern/server

The best approval flow to use is the one at https://developer.paypal.com/demo/checkout/#/pattern/server

请注意,它与服务器上的两条路由配对,一条创建订单,一条在批准后捕获订单.

Note that it pairs with two routes on your server, one that creates the order and one that captures the order after approval.

这篇关于PayPal Server SDK:如何批准订单 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆