Get a quote
A quote is a commitment from an account servicing entity to deliver a particular amount to a payee when sending a particular amount from a payer. The quote is only valid for a limited time.
An authorized client can get a quote to check the quote’s state (e.g., is the quote valid or expired), as well as other payment details, such as the total amount that should be received by the payee and the total amount that should be sent by the payer.
These code snippets return the state and details of a specific quote, if found.
Before you begin
We recommend creating a wallet account on Rafiki.Money, a test wallet provider that’s part of the Interledger testnet. Creating an account allows you to test your client against the Open Payments API using an ILP-enabled wallet funded with play money.
Get the state of a quote
- Node 18
- A package manager such as NPM or PNPM
-
Open Payments SDK
- TSX
Additional configuration
Add "type": "module"
to package.json
Add the following to tsconfig.json
Get started
Import dependencies
import { createAuthenticatedClient } from "@interledger/open-payments";
Initialize Open Payments client
const client = await createAuthenticatedClient({
walletAddressUrl: WALLET_ADDRESS,
privateKey: PRIVATE_KEY_PATH,
keyId: KEY_ID,
});
Get quote
const quote = await client.quote.get({
url: QUOTE_URL,
accessToken: QUOTE_ACCESS_TOKEN,
});
Output
console.log("QUOTE:", JSON.stringify(quote, null, 2));
Run tsx path/to/directory/index.ts
.
- Node 18 or higher
- A package manager such as NPM or PNPM
-
Open Payments SDK
Additional configuration
Add "type": "module"
to package.json
Get started
Import dependencies
import { createAuthenticatedClient } from "@interledger/open-payments";
Initialize Open Payments client
const client = await createAuthenticatedClient({
walletAddressUrl: WALLET_ADDRESS,
privateKey: PRIVATE_KEY_PATH,
keyId: KEY_ID,
});
Get quote
const quote = await client.quote.get({
url: QUOTE_URL,
accessToken: QUOTE_ACCESS_TOKEN,
});
Output
console.log("QUOTE:", JSON.stringify(quote, null, 2));
Run node path/to/directory/index.js
.