问题描述
我正在尝试为我的一个项目实施paypal api
我正在使用沙盒环境和服务器端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()创建了一个订单。在回应中,我得到了
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","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","rel": "approve"
},
在浏览器中,它要求PayPal登录,我们必须用作登录名和密码的凭据。我只有client_id
和client_secret
如何获取批准的订单ID。我现在该怎么办。
解决方法
下一步是将付款人重定向到该roval_url,或将订单ID与“智能付款”按钮一起使用,这比重定向更好。不论哪种方式,付款人都将使用其PayPal(沙盒)买方帐户登录,或者在PayPal窗口或表单中输入其(沙盒)买方信息。
使用的最佳批准流程是https://developer.paypal.com/demo/checkout/#/pattern/server
上的批准流程。请注意,它与服务器上的两条路线配对,一条用于创建订单,另一条在批准后捕获订单。
,如何获取沙箱帐户的用户名和密码。
导航到
我们会看到在批准订单时可以用作贝宝登录凭据的电子邮件和密码
因此,现在转到批准的网址https://www.sandbox.paypal.com/checkoutnow?token=XXXXXXXXXX
然后单击登录名(贝宝帐户)并输入电子邮件和密码
成功登录后,请在此处付款
所以现在订单被批准了。