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

Copy
Copied
// 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();
    ...
  }
}
  
Copyright © Tyro Payments 2019-2024. All right reserved.