1
我正在尝试整合付款申请api,但我在这里丢失了一些东西.. 如何验证使用api进行的付款? 当用户支付我的回拨时,我怎么知道付款已完成? 这是我的代码。验证Google付款申请API
paymentRequest.show()
.then((paymentResponse) => {
fetch('http://validate-payment/api')
.then((response) => {
return response.json();
})
.then((json) => {
return paymentResponse.complete('fail'); // Hardcode fail
})
.catch((error) => {
reject();
})
})
.catch((error) =>{
console.log(error.message)
});
检查'response.ok',如果这是真的,然后调用'response.json()';否则调用'.complete('fail')'。 – sideshowbarker
请注意,此API是“付款请求API”,与Google无关。请不要将此称为“Google Payment Request API”。 https://medium.com/dev-channel/addressing-common-misconceptions-about-the-payment-request-api-4d0db51dae75 – agektmr