Fetch Pay Request
tyro.fetchPayRequest()
Retrieves the PayRequest status, you should fetch the Pay Request and show the result to your customers.
Response
The Pay Request object returned.
any (client-pay-request-response)
Implementation
// Javascript sample code
async function showPaymentResult() {
const paySecret = new URLSearchParams(window.location.search).get(
"paySecret"
);
if (!paySecret) {
return;
}
const tyro = Tyro();
await tyro.init(paySecret);
const payRequest = await tyro.fetchPayRequest();
switch (payRequest.status) {
case "PROCESSING":
return showProcessing();
case "SUCCESS":
return showSuccess();
case "FAILED":
return showFail();
...
}
}