Create session
A Glide session should be created once a user has shown intent to pay for a transaction using Glide.
A session is valid for 10 minutes, during which the user should complete the payment process. If the user does not complete the payment within this time, the session will expire and the user will need to create a new session. If a payment is made for an expired session, the payment will be refunded automatically.
Once a session is created, use the executeSession
action to complete the payment process.
Import
import { createSession } from "@paywithglide/glide-js";
Usage
Parameters
The EIP-155 chain ID of the chain where the transaction will be executed.
The wallet address that will be used to pay for the transaction.
The amount the user wants to pay, denominated in the paymentCurrency, can be set for transactions that support variable payment amounts (ex. p2p transfers).
The currency in which the user pays in CAIP-19 format. Defaults to the first currency returned by listPaymentOptions
.
When set to true and if supported by the payment currency, the user will be able to pay with a signature only, requiring no gas. Defaults to false.
The contract's address, or the recipient's address if the transaction is not a contract call.
The contract's ABI.
The name of the function to be called on the contract.
Arguments to be passed when calling the function.
Value in the smallest unit (ex. wei) to be sent with the transaction.
The approval object, required if the transaction requires spending of an ERC-20 token.
The token's contract address that needs to be approved for spending.
The amount to approve, in the token's smallest unit.
The commission amount in USD that will be added on top of the transaction cost and will be paid out to the developer.
The wallet secret that was used when creating the wallet. Required if the account
wallet was created on Glide.