Settle a payment
Settles an x402 payment using the quote ID and a signed payment authorization. The payment signature can be provided via the PAYMENT-SIGNATURE header or the payment_signature body parameter. Settlement is idempotent — submitting the same quote ID multiple times returns the existing transaction.
POST
/
v2
/
x402
/
credit_account
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.settle({
id: 'quote_abc123',
payment_signature: '0xabc123...',
});
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.settle(
id="quote_abc123",
payment_signature="0xabc123...",
)
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.Settle(context.TODO(), telnyx.X402CreditAccountSettleParams{
ID: "quote_abc123",
PaymentSignature: telnyx.String("0xabc123..."),
})
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.CreditAccountSettleParams;
import com.telnyx.sdk.models.x402.creditaccount.CreditAccountSettleResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CreditAccountSettleParams params = CreditAccountSettleParams.builder()
.id("quote_abc123")
.build();
CreditAccountSettleResponse response = client.x402().creditAccount().settle(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.x402.credit_account.settle(id: "quote_abc123")
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->settle(
id: 'quote_abc123',
paymentSignature: '0xabc123...',
headerPaymentSignature: 'PAYMENT-SIGNATURE',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx x402:credit-account settle \
--api-key 'My API Key' \
--id quote_abc123curl --request POST \
--url https://api.telnyx.com/v2/x402/credit_account \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "quote_abc123",
"payment_signature": "0xabc123..."
}
'{
"data": {
"id": "<string>",
"record_type": "x402_transaction",
"amount": "<string>",
"currency": "<string>",
"status": "settled",
"quote_id": "<string>",
"tx_hash": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Signed payment authorization for the quote. Alternative to providing payment_signature in the request body.
Body
application/json
Response
Payment already settled (idempotent response)
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.settle({
id: 'quote_abc123',
payment_signature: '0xabc123...',
});
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.settle(
id="quote_abc123",
payment_signature="0xabc123...",
)
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.Settle(context.TODO(), telnyx.X402CreditAccountSettleParams{
ID: "quote_abc123",
PaymentSignature: telnyx.String("0xabc123..."),
})
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.CreditAccountSettleParams;
import com.telnyx.sdk.models.x402.creditaccount.CreditAccountSettleResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CreditAccountSettleParams params = CreditAccountSettleParams.builder()
.id("quote_abc123")
.build();
CreditAccountSettleResponse response = client.x402().creditAccount().settle(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.x402.credit_account.settle(id: "quote_abc123")
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->settle(
id: 'quote_abc123',
paymentSignature: '0xabc123...',
headerPaymentSignature: 'PAYMENT-SIGNATURE',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx x402:credit-account settle \
--api-key 'My API Key' \
--id quote_abc123curl --request POST \
--url https://api.telnyx.com/v2/x402/credit_account \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "quote_abc123",
"payment_signature": "0xabc123..."
}
'{
"data": {
"id": "<string>",
"record_type": "x402_transaction",
"amount": "<string>",
"currency": "<string>",
"status": "settled",
"quote_id": "<string>",
"tx_hash": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
}