Paypal JavaScript SDK:按钮功能(例如onApprove)预期的返回值是什么?
这些文档根本没有讨论返回值 我只能根据这些例子来猜测:Paypal JavaScript SDK:按钮功能(例如onApprove)预期的返回值是什么?,paypal,Paypal,这些文档根本没有讨论返回值 我只能根据这些例子来猜测: createOrder:应返回orderID(如果不返回,库/服务器会显示一条有用的错误消息) 批准: 该示例包含return语句,但不返回任何内容 onApprove: function(data, actions) { // This function captures the funds from the transaction. return actions.order.capture().then(
- createOrder:应返回orderID(如果不返回,库/服务器会显示一条有用的错误消息)
- 批准:
onApprove: function(data, actions) {
// This function captures the funds from the transaction.
return actions.order.capture().then(function(details) {
// This function shows a transaction success message to your buyer.
alert('Transaction completed by ' + details.payer.name.given_name);
});
}
返回结束函数,重要的不是返回的值,而是您是否以捕获和捕获后的正确行为结束 根据您的示例,客户端捕获很简单
正确的服务器端捕获应该根据服务器的响应处理三种情况,如Ok中的示例所示,谢谢您提供了该示例的链接。我想我主要是被这种风格弄糊涂了。我通常期望
doSomethingWithoutReturnValue();返回代码>用于不带返回值的函数。