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*
unpaid | paid
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
The currency in which the user pays in the CAIP-19 format.
paymentAmount*
string
The amount required to be paid 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*
signAndSendTransaction | signTypedData
The action that the user must take to complete the payment.
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`.
sponsoredTransaction*
EVMTransaction
The transaction that Glide will send to the chain on behalf of the user after the payment is completed.
sponsoredTransactionAmount*
string
The amount required by the transaction in a human-readable format.
sponsoredTransactionCurrency*
CAIP19
The currency in which the transaction is made in the CAIP-19 format.
sponsoredTransactionStatus*
created | submitted | signed | pending | success | failed | dropped
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.