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