Node.js
import { createHmac } from "node:crypto";
// Node.js 18+. Set credentials and resource values on your server.
function required(name) {
const value = process.env[name];
if (!value) throw new Error(`Set ${name} before running this example.`);
return value;
}
const baseUrl = process.env.LEDIG_API_BASE_URL ?? "https://api-sandbox.ledig.io";
const method = "GET";
const path = `/v1/quotes/payment-options`;
const query = new URLSearchParams({
"type": "withdraw",
"currency": "USD"
}).toString();
const pathWithQuery = `${path}?${query}`;
const rawBody = "";
const headers = { "Accept": "application/json" };
const timestamp = Math.floor(Date.now() / 1000).toString();
const payload = `${timestamp}.${method}.${pathWithQuery}.${rawBody}`;
headers["x-ledig-key"] = required("LEDIG_API_KEY");
headers["x-ledig-timestamp"] = timestamp;
headers["x-ledig-signature"] = "v1=" + createHmac("sha256", required("LEDIG_API_SECRET"))
.update(payload).digest("base64");
const response = await fetch(`${baseUrl}${pathWithQuery}`, {
method,
headers,
});
const result = await response.json();
// Use result in your application; do not log credentials or upload links.
console.log(response.status);{
"status": "success",
"data": [
{
"channel": "bank",
"name": "Bank transfer",
"description": "Send USD to a bank account.",
"currency": "USD",
"paymentMethodIds": [
"method_example_001"
],
"minimumFee": "2.00",
"maximumFee": "2.00",
"minimumAmount": "10.00",
"maximumAmount": "10000.00",
"amountBands": [
{
"minimumAmount": "10.00",
"maximumAmount": "10000.00"
}
],
"supportConversion": true,
"invoiceRequired": false,
"deliveryOptions": [
{
"paymentMethodId": "method_example_001",
"channel": "bank_transfer",
"label": "Bank transfer",
"recipientTypes": [
"bank"
]
}
],
"feeQuotes": [
{
"paymentMethodId": "method_example_001",
"feeAmount": "2.00",
"feeCurrency": "USD"
}
]
}
]
}{
"status": "error",
"code": "BAD_REQUEST",
"message": "Check the request fields and try again."
}{
"status": "error",
"code": "UNAUTHORIZED",
"message": "Authentication is required."
}{
"status": "error",
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action."
}{
"status": "error",
"code": "NOT_FOUND",
"message": "The requested resource was not found."
}{
"status": "error",
"code": "COMPLIANCE_REVIEW_REQUIRED",
"message": "This action requires a review before it can continue."
}{
"status": "error",
"code": "RATE_LIMITED",
"message": "Too many requests. Wait before trying again."
}Payment options
List payment methods
Find the available payment methods, fees and amount limits for a currency.
GET
/
v1
/
quotes
/
payment-options
Node.js
import { createHmac } from "node:crypto";
// Node.js 18+. Set credentials and resource values on your server.
function required(name) {
const value = process.env[name];
if (!value) throw new Error(`Set ${name} before running this example.`);
return value;
}
const baseUrl = process.env.LEDIG_API_BASE_URL ?? "https://api-sandbox.ledig.io";
const method = "GET";
const path = `/v1/quotes/payment-options`;
const query = new URLSearchParams({
"type": "withdraw",
"currency": "USD"
}).toString();
const pathWithQuery = `${path}?${query}`;
const rawBody = "";
const headers = { "Accept": "application/json" };
const timestamp = Math.floor(Date.now() / 1000).toString();
const payload = `${timestamp}.${method}.${pathWithQuery}.${rawBody}`;
headers["x-ledig-key"] = required("LEDIG_API_KEY");
headers["x-ledig-timestamp"] = timestamp;
headers["x-ledig-signature"] = "v1=" + createHmac("sha256", required("LEDIG_API_SECRET"))
.update(payload).digest("base64");
const response = await fetch(`${baseUrl}${pathWithQuery}`, {
method,
headers,
});
const result = await response.json();
// Use result in your application; do not log credentials or upload links.
console.log(response.status);{
"status": "success",
"data": [
{
"channel": "bank",
"name": "Bank transfer",
"description": "Send USD to a bank account.",
"currency": "USD",
"paymentMethodIds": [
"method_example_001"
],
"minimumFee": "2.00",
"maximumFee": "2.00",
"minimumAmount": "10.00",
"maximumAmount": "10000.00",
"amountBands": [
{
"minimumAmount": "10.00",
"maximumAmount": "10000.00"
}
],
"supportConversion": true,
"invoiceRequired": false,
"deliveryOptions": [
{
"paymentMethodId": "method_example_001",
"channel": "bank_transfer",
"label": "Bank transfer",
"recipientTypes": [
"bank"
]
}
],
"feeQuotes": [
{
"paymentMethodId": "method_example_001",
"feeAmount": "2.00",
"feeCurrency": "USD"
}
]
}
]
}{
"status": "error",
"code": "BAD_REQUEST",
"message": "Check the request fields and try again."
}{
"status": "error",
"code": "UNAUTHORIZED",
"message": "Authentication is required."
}{
"status": "error",
"code": "FORBIDDEN",
"message": "You do not have permission to perform this action."
}{
"status": "error",
"code": "NOT_FOUND",
"message": "The requested resource was not found."
}{
"status": "error",
"code": "COMPLIANCE_REVIEW_REQUIRED",
"message": "This action requires a review before it can continue."
}{
"status": "error",
"code": "RATE_LIMITED",
"message": "Too many requests. Wait before trying again."
}Required scope:
quotes:read
Use type=withdraw for payouts and type=deposit for receiving options. For a payout, provide amount in the destination currency to show methods that cover it. Use the returned deliveryOptions to choose a method and pass its values unchanged in the quote. External payout options include amountBands; minimumAmount and maximumAmount are their outer bounds, so keep gaps between bands unsupported. Limits apply to the selected method or network, not to every payment in that currency. GET /v1/payouts/catalogue lists fee bands separately. Missing options or limits do not mean unlimited payments. Discovery does not approve a payment. HTTP 423 COMPLIANCE_REVIEW_REQUIRED means the destination needs review; do not retry automatically or create a replacement recipient. HTTP 404 means the requested recipient was not found.Authorizations
Query Parameters
Response
Eligible deposit or withdrawal payment options.