【发布时间】:2020-07-09 14:38:43
【问题描述】:
我正在集成 Paypal 的智能结账。我不明白 javascript 部分期望从服务器返回什么。这就是我在JS中得到的
...
...
createOrder: function(data, actions) {
return fetch('/paypal/sandbox/createOrder', {
method: 'post',
headers: {
'content-type': 'application/json'
}
}).then(function(res) {
return res.json();
}).then(function(data) {
return data.orderID;
});
},
...
...
这就是调用 /paypal/sandbox/createOrder' 时服务器端所做的事情……
$request = new OrdersCreateRequest();
$request->prefer('return=representation');
$request->body = $this->buildRequestBody();
$response = $this->PayPalClient->execute($request);
我在任何地方都找不到什么:我应该如何处理响应?我尝试简单地回显它,将其回显为 JSON,但我总是收到诸如“预期订单 ID”之类的错误
我需要什么来响应客户的请求?
【问题讨论】:
标签: paypal paypal-ipn