Skip to content
Last updated

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.

idstring

The ID of the Pay Request generated by Tyro.

paySecretstring

The Pay Secret associated with this Pay Request. This is used by the frontend to submit the Pay Request. Pay Secret expire after 24 hours from the time the Pay Request was created. It’s recommended to avoid logging or storing the pay secret for security reasons.

locationIdstring

The id of the location as specified by the Tyro Connect system

providerobject

Details about the provider that processed the payment.

provider.​namestring

The name of the provider that processed the payment. More providers will be supported at a later date.

Value"TYRO"
provider.​methodstring

The payment method used

Value"CARD"
originobject

Contains information about the partner that created the Pay Request.

origin.​orderIdstring<= 50 characters

An identifier that has been generated by the origin. This can be used for reconciliation of orders in the app partner’s system.

origin.​orderReferencestring

Easily identifiable reference for the order.

origin.​namestring

Name of the app partner that created the Pay Request.

payMethodobject

The Pay Method details for the Pay Request

payMethod.​idstring

The id of the Pay Method attached to the Pay Request.

payMethod.​customerIdstring

The Tyro generated ID of the customer linked to the Pay Method.

payMethod.​saveboolean

When set to true, the pay method will be saved after a successful payment.

captureobject
capture.​methodstring

Optional field that determines how the funds will be captured. The default is AUTOMATIC which captures the funds when the Pay Request is submitted. MANUAL can be used to indicate that the funds are held and to only authorise the payment when the Pay Request is submitted. The funds can be captured at a later time via the CAPTURE action.

Enum"AUTOMATIC""MANUAL"
capture.​totalobject(Money Positive Amount)

The total amount to capture (in smallest currency unit). You cannot capture more than the authorised amount.

capture.​total.​amountinteger>= 0required

This is the amount in smallest currency unit. e.g 12520 (in cents) is $125.20

Example: 12520
capture.​total.​currencystringrequired

This is always AUD

Default "AUD"
Value"AUD"
Example: "AUD"
statusstring

The current status of this Pay Request managed by Tyro.

Enum"AWAITING_PAYMENT_INPUT""AWAITING_AUTHENTICATION""PROCESSING""SUCCESS""FAILED""VOIDED""PARTIALLY_REFUNDED""REFUNDED"
supportedNetworksArray of strings

List of supported card type/brand/networks for this Pay Request. If null it is unrestricted.

Items Enum"visa""mastercard""amex""jcb""maestro""diners"
totalobject(Money Positive Amount)

The total amount (in smallest currency unit)

total.​amountinteger>= 0required

This is the amount in smallest currency unit. e.g 12520 (in cents) is $125.20

Example: 12520
total.​currencystringrequired

This is always AUD

Default "AUD"
Value"AUD"
Example: "AUD"
transactionResultsArray of objects(Transaction Result)

List of Transaction Results

transactionResults[].​merchantstring

Merchant for this transaction

transactionResults[].​authenticationobject

3ds authentication details for this transaction

transactionResults[].​authentication.​accessControlServerEcistring
transactionResults[].​authentication.​accessControlServerTransactionIdstring
transactionResults[].​authentication.​acceptVersionsstring
transactionResults[].​authentication.​amountstring
transactionResults[].​authentication.​additionalInfostring
transactionResults[].​authentication.​authenticationTokenstring
transactionResults[].​authentication.​3dsServerTransactionIdstring
transactionResults[].​authentication.​channelstring
transactionResults[].​authentication.​directoryServerIdstring
transactionResults[].​authentication.​directoryServerTransactionIdstring
transactionResults[].​authentication.​methodstring
transactionResults[].​authentication.​methodCompletedstring
transactionResults[].​authentication.​methodSupportedstring
Enum"SUPPORTED""NOT_SUPPORTED"
transactionResults[].​authentication.​payerInteractionstring
transactionResults[].​authentication.​protocolVersionstring
transactionResults[].​authentication.​redirectedDomainNamestring
transactionResults[].​authentication.​requestorIdstring
transactionResults[].​authentication.​requestorNamestring
transactionResults[].​authentication.​statusReasonCodestring
transactionResults[].​authentication.​transactionIdstring
transactionResults[].​authentication.​transactionStatusstring
Enum"YES""NO""UNAVAILABLE""ATTEMPTED""CHALLENGE""REJECTED""DECOUPLED""INFORMATIONAL"
transactionResults[].​authentication.​timestring
transactionResults[].​authentication.​versionstring
transactionResults[].​orderobject

Order for this transaction

transactionResults[].​order.​idstring
transactionResults[].​order.​statusstring
transactionResults[].​order.​currencystring
transactionResults[].​order.​referencestring
transactionResults[].​order.​amountnumber
transactionResults[].​order.​authorisedAmountnumber
transactionResults[].​order.​capturedAmountnumber
transactionResults[].​order.​refundedAmountnumber
transactionResults[].​order.​merchantCurrencystring
transactionResults[].​order.​merchantAmountnumber
transactionResults[].​order.​createdAtstring
transactionResults[].​order.​updatedAtstring
transactionResults[].​cardobject

Card used for this transaction

transactionResults[].​card.​brandstring
transactionResults[].​card.​schemestring
transactionResults[].​card.​expiryobject
transactionResults[].​card.​expiry.​monthstring
transactionResults[].​card.​expiry.​yearstring
transactionResults[].​card.​nameOnCardstring
transactionResults[].​card.​numberstring
transactionResults[].​card.​fundingMethodstring
transactionResults[].​card.​firstSixDigitsstring
transactionResults[].​card.​lastFourDigitsstring
transactionResults[].​operationResultobject

The result of this operation

transactionResults[].​operationResult.​resultstring
Enum"FAILURE""PENDING""SUCCESS""UNKNOWN"
transactionResults[].​operationResult.​acquirerCodestring
transactionResults[].​operationResult.​gatewayCodestring
transactionResults[].​operationResult.​authorisationCodestring
transactionResults[].​operationResult.​errorCodestring
transactionResults[].​operationResult.​errorMessagestring
transactionResults[].​transactionobject

The transaction for the operation

transactionResults[].​transaction.​idstring
transactionResults[].​transaction.​typestring
transactionResults[].​transaction.​amountnumber
transactionResults[].​transaction.​currencystring
transactionResults[].​transaction.​retrievalReferenceNumberstring
transactionResults[].​transaction.​acquirerobject
transactionResults[].​transaction.​acquirer.​idstring
transactionResults[].​transaction.​acquirer.​merchantIdstring
transactionResults[].​transaction.​acquirer.​additionalResponsestring
threeDSecureDetailsobject

3D Secure details for this Pay Request

threeDSecureDetails.​statusstring

Current 3D Secure status for this Pay Request

Enum"AWAITING_3DS_METHOD""AWAITING_AUTH""AWAITING_CHALLENGE""AWAITING_CHALLENGE_RESULT""SUCCESS""FAILED"
Example: "AWAITING_3DS_METHOD"
additionalDataobject

Additional data for this transaction

additionalData.​customerIPstring
Example: "127.0.0.1"

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();
    ...
  }
}