Buy a credit pack via x402 (agent payments)
curl --request POST \
--url https://sendpaperplane.com/v1/x402/credits \
--header 'Content-Type: application/json' \
--data '
{
"pack": "value",
"email": "jordan@example.com"
}
'import requests
url = "https://sendpaperplane.com/v1/x402/credits"
payload = {
"pack": "value",
"email": "jordan@example.com"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({pack: 'value', email: 'jordan@example.com'})
};
fetch('https://sendpaperplane.com/v1/x402/credits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({pack: 'value', email: 'jordan@example.com'})
};
fetch('https://sendpaperplane.com/v1/x402/credits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sendpaperplane.com/v1/x402/credits"
payload := strings.NewReader("{\n \"pack\": \"value\",\n \"email\": \"jordan@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://sendpaperplane.com/v1/x402/credits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"pack\": \"value\",\n \"email\": \"jordan@example.com\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sendpaperplane.com/v1/x402/credits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'pack' => 'value',
'email' => 'jordan@example.com'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://sendpaperplane.com/v1/x402/credits")
.header("Content-Type", "application/json")
.body("{\n \"pack\": \"value\",\n \"email\": \"jordan@example.com\"\n}")
.asString();{
"status": "ok",
"credit_code": "pp-ab12-cd34-ef56",
"face_cents": 1999,
"bonus_cents": 700,
"replayed": true
}{
"status": "ok",
"credit_code": "pp-ab12-cd34-ef56",
"face_cents": 1999,
"bonus_cents": 700,
"settlement": {
"network": "eip155:8453",
"tx_hash": "0xdeadbeef"
}
}{
"status": "failed",
"code": "<string>",
"reason": "<string>",
"next": [
"<string>"
]
}{
"status": "failed",
"code": "<string>",
"reason": "<string>",
"next": [
"<string>"
]
}{
"status": "failed",
"code": "<string>",
"reason": "<string>",
"next": [
"<string>"
]
}{
"status": "failed",
"code": "<string>",
"reason": "<string>",
"next": [
"<string>"
]
}Buy a credit pack via x402 (agent payments)
Agent-payable alternative to /v1/credits/checkout for funded agents that can’t open a human payment_url. Follows the x402 v2 handshake: call once without an X-PAYMENT header to get a 402 challenge, then retry with the header set to a signed payment payload. Disabled on deployments without a configured facilitator — see docs/PRD-agentic-payments.md. Pass sandbox: true to mint a real credit code with no facilitator call and no charge, on any deployment.
POST
/
v1
/
x402
/
credits
Buy a credit pack via x402 (agent payments)
curl --request POST \
--url https://sendpaperplane.com/v1/x402/credits \
--header 'Content-Type: application/json' \
--data '
{
"pack": "value",
"email": "jordan@example.com"
}
'import requests
url = "https://sendpaperplane.com/v1/x402/credits"
payload = {
"pack": "value",
"email": "jordan@example.com"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({pack: 'value', email: 'jordan@example.com'})
};
fetch('https://sendpaperplane.com/v1/x402/credits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({pack: 'value', email: 'jordan@example.com'})
};
fetch('https://sendpaperplane.com/v1/x402/credits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sendpaperplane.com/v1/x402/credits"
payload := strings.NewReader("{\n \"pack\": \"value\",\n \"email\": \"jordan@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://sendpaperplane.com/v1/x402/credits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"pack\": \"value\",\n \"email\": \"jordan@example.com\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sendpaperplane.com/v1/x402/credits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'pack' => 'value',
'email' => 'jordan@example.com'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://sendpaperplane.com/v1/x402/credits")
.header("Content-Type", "application/json")
.body("{\n \"pack\": \"value\",\n \"email\": \"jordan@example.com\"\n}")
.asString();{
"status": "ok",
"credit_code": "pp-ab12-cd34-ef56",
"face_cents": 1999,
"bonus_cents": 700,
"replayed": true
}{
"status": "ok",
"credit_code": "pp-ab12-cd34-ef56",
"face_cents": 1999,
"bonus_cents": 700,
"settlement": {
"network": "eip155:8453",
"tx_hash": "0xdeadbeef"
}
}{
"status": "failed",
"code": "<string>",
"reason": "<string>",
"next": [
"<string>"
]
}{
"status": "failed",
"code": "<string>",
"reason": "<string>",
"next": [
"<string>"
]
}{
"status": "failed",
"code": "<string>",
"reason": "<string>",
"next": [
"<string>"
]
}{
"status": "failed",
"code": "<string>",
"reason": "<string>",
"next": [
"<string>"
]
}Body
application/json
Response
Settlement replay — this transaction hash already minted an account, so the same credit code is returned with replayed: true and no settlement. Nothing was charged twice.
Allowed value:
"ok"Required range:
-9007199254740991 <= x <= 9007199254740991Required range:
-9007199254740991 <= x <= 9007199254740991Last modified on September 17, 2026
Was this page helpful?