Skip to content

Get session by payment transaction

Retrieve a session by its payment transaction

Import

import { getSessionByPaymentTransaction } from "@paywithglide/glide-js";

Usage

index.ts
import { getSessionByPaymentTransaction, chains } from "@paywithglide/glide-js";
import { config } from './config';
 
const session = await getSessionByPaymentTransaction(config, {
  chainId: chains.base.id,
  hash: "0x36145cfe6fd2b2c3c60ef52f16e86d9fdb825f59f82f8c3cdd0c6ac398cab48c",
});

Parameters

chainId*
number

The EIP-155 chain ID of the chain where the payment transaction was made.

hash*
string

The payment transaction hash.

Return Type

sessionId *
string
The unique identifier of the session.
expiresAt*
string
The timestamp at which the session will expire. Generally, this will be 10 minutes after the session is created.
paymentStatus*
PaymentStatus
The current status of the payment for the session. The session begins in the unpaid state and transitions to paid when the user complets their payment transaction.
paymentCurrency*
CAIP19 | Currency
The currency in which the user pays in the CAIP-19 format.
paymentAmount*
string
The amount of the payment required by the user to complete the transaction in a human-readable format.
paymentTransactionHash
nullable string
The hash of the transaction that the user made to complete the payment.
paymentAction*
enum
The action that the user must take to complete the payment. Either `signAndSendTransaction` or `signTypedData`.
unsignedTransaction
nullable EVMTransaction
The transaction that the user must sign and send to the chain to complete the payment. It is set when the `paymentAction` is set to `signAndSendTransaction`.
chainId*
string
The CAIP-2 chain ID of the chain where the transaction will be executed.
from*
string
The user's wallet address from which the transaction will be sent.
to*
string
The address of the contract to which the transaction will be sent.
value*
string
The hex-encoded amount of the payment in the smallest unit of the currency.
input*
string
The hex-encoded data to be sent to the contract.
unsignedTypedData
nullable EIP712TypedData
The typed data that the user must sign to complete the payment. It is set when the `paymentAction` is set to `signTypedData`.
sponsoredTransactionStatus*
TransactionStatus
The current status of the transaction that Glide is sending to the chain on behalf of the user.
sponsoredTransactionHash
nullable string
The hash of the transaction that Glide sent to the chain on behalf of the user.