Create a payment quote
Creates a payment quote for the specified USD amount. Returns payment details including the x402 payment requirements, network, and expiration time. The quote must be settled before it expires.
POST
/
v2
/
x402
/
credit_account
/
quote
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.x402.creditAccount.createQuote({ amount_usd: '50.00' });
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.x402.credit_account.create_quote(
amount_usd="50.00",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.X402.CreditAccount.NewQuote(context.TODO(), telnyx.X402CreditAccountNewQuoteParams{
AmountUsd: "50.00",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.x402.creditaccount.CreditAccountCreateQuoteParams;
import com.telnyx.sdk.models.x402.creditaccount.CreditAccountCreateQuoteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CreditAccountCreateQuoteParams params = CreditAccountCreateQuoteParams.builder()
.amountUsd("50.00")
.build();
CreditAccountCreateQuoteResponse response = client.x402().creditAccount().createQuote(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.x402.credit_account.create_quote(amount_usd: "50.00")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->x402->creditAccount->createQuote(amountUsd: '50.00');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx x402:credit-account create-quote \
--api-key 'My API Key' \
--amount-usd 50.00curl --request POST \
--url https://api.telnyx.com/v2/x402/credit_account/quote \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount_usd": "50.00"
}
'{
"data": {
"id": "quote_abc123",
"record_type": "quote",
"amount_usd": "50.00",
"amount_crypto": "50000000",
"network": "eip155:8453",
"expires_at": "2026-03-13T15:05:00Z",
"payment_requirements": {
"x402Version": 2,
"resource": {
"url": "https://api.telnyx.com/v2/x402/credit_account",
"description": "Payment of $50.00 USD",
"mimeType": "application/json"
},
"accepts": [
{
"scheme": "exact",
"network": "eip155:8453",
"amount": "50000000",
"asset": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"payTo": "0x1234567890abcdef1234567890abcdef12345678",
"maxTimeoutSeconds": 900,
"extra": {
"quoteId": "quote_abc123",
"facilitatorUrl": "https://api.cdp.coinbase.com/platform/v2/x402",
"name": "USD Coin",
"version": "2"
}
}
]
}
}
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request."
}
]
}{
"errors": [
{
"code": "10010",
"title": "Authorization failed",
"detail": "You do not have permission to perform the requested action on the specified resource or resources."
}
]
}{
"errors": [
{
"code": "unknown",
"title": "Invalid request",
"detail": "amount_usd must be at least 5.00"
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured."
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Amount in USD to fund (minimum 5.00, maximum 10000.00).
Example:
"50.00"
Response
Quote created successfully
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.x402.creditAccount.createQuote({ amount_usd: '50.00' });
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.x402.credit_account.create_quote(
amount_usd="50.00",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.X402.CreditAccount.NewQuote(context.TODO(), telnyx.X402CreditAccountNewQuoteParams{
AmountUsd: "50.00",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.x402.creditaccount.CreditAccountCreateQuoteParams;
import com.telnyx.sdk.models.x402.creditaccount.CreditAccountCreateQuoteResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CreditAccountCreateQuoteParams params = CreditAccountCreateQuoteParams.builder()
.amountUsd("50.00")
.build();
CreditAccountCreateQuoteResponse response = client.x402().creditAccount().createQuote(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.x402.credit_account.create_quote(amount_usd: "50.00")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->x402->creditAccount->createQuote(amountUsd: '50.00');
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx x402:credit-account create-quote \
--api-key 'My API Key' \
--amount-usd 50.00curl --request POST \
--url https://api.telnyx.com/v2/x402/credit_account/quote \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount_usd": "50.00"
}
'{
"data": {
"id": "quote_abc123",
"record_type": "quote",
"amount_usd": "50.00",
"amount_crypto": "50000000",
"network": "eip155:8453",
"expires_at": "2026-03-13T15:05:00Z",
"payment_requirements": {
"x402Version": 2,
"resource": {
"url": "https://api.telnyx.com/v2/x402/credit_account",
"description": "Payment of $50.00 USD",
"mimeType": "application/json"
},
"accepts": [
{
"scheme": "exact",
"network": "eip155:8453",
"amount": "50000000",
"asset": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"payTo": "0x1234567890abcdef1234567890abcdef12345678",
"maxTimeoutSeconds": 900,
"extra": {
"quoteId": "quote_abc123",
"facilitatorUrl": "https://api.cdp.coinbase.com/platform/v2/x402",
"name": "USD Coin",
"version": "2"
}
}
]
}
}
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request."
}
]
}{
"errors": [
{
"code": "10010",
"title": "Authorization failed",
"detail": "You do not have permission to perform the requested action on the specified resource or resources."
}
]
}{
"errors": [
{
"code": "unknown",
"title": "Invalid request",
"detail": "amount_usd must be at least 5.00"
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured."
}
]
}