I am trying to integrate the payment request api, but I am missing something here.. How to validate payments that were made using the api? When the user pays my callback is executed, but how do I know the payment is complete? Here is my code.
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)
});