Get X402 payment requirements for generation
curl --request POST \
--url https://api.markdown2pdf.ai/payment_request/x402 \
--header 'Content-Type: application/json' \
--data '
{
"offer_id": "<string>",
"payment_context_token": "<string>"
}
'import requests
url = "https://api.markdown2pdf.ai/payment_request/x402"
payload = {
"offer_id": "<string>",
"payment_context_token": "<string>"
}
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({offer_id: '<string>', payment_context_token: '<string>'})
};
fetch('https://api.markdown2pdf.ai/payment_request/x402', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.markdown2pdf.ai/payment_request/x402",
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([
'offer_id' => '<string>',
'payment_context_token' => '<string>'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.markdown2pdf.ai/payment_request/x402"
payload := strings.NewReader("{\n \"offer_id\": \"<string>\",\n \"payment_context_token\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://api.markdown2pdf.ai/payment_request/x402")
.header("Content-Type", "application/json")
.body("{\n \"offer_id\": \"<string>\",\n \"payment_context_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.markdown2pdf.ai/payment_request/x402")
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 \"offer_id\": \"<string>\",\n \"payment_context_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"version": "<string>",
"x402_version": 2,
"accepts": [
{
"scheme": "exact",
"network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
"asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": "400000",
"payTo": "<string>",
"maxTimeoutSeconds": 300,
"extra": {}
}
],
"resource": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}This response has no body data.{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}REST API
Get X402 payment requirements for generation
Get payment details for generation. This will include the USDC on Solana payment requirements, and follows the x402 (v2) standard for payment requests. The 402 response already carries the same details, so most X402 clients skip this call.
POST
/
payment_request
/
x402
Get X402 payment requirements for generation
curl --request POST \
--url https://api.markdown2pdf.ai/payment_request/x402 \
--header 'Content-Type: application/json' \
--data '
{
"offer_id": "<string>",
"payment_context_token": "<string>"
}
'import requests
url = "https://api.markdown2pdf.ai/payment_request/x402"
payload = {
"offer_id": "<string>",
"payment_context_token": "<string>"
}
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({offer_id: '<string>', payment_context_token: '<string>'})
};
fetch('https://api.markdown2pdf.ai/payment_request/x402', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.markdown2pdf.ai/payment_request/x402",
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([
'offer_id' => '<string>',
'payment_context_token' => '<string>'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.markdown2pdf.ai/payment_request/x402"
payload := strings.NewReader("{\n \"offer_id\": \"<string>\",\n \"payment_context_token\": \"<string>\"\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))
}HttpResponse<String> response = Unirest.post("https://api.markdown2pdf.ai/payment_request/x402")
.header("Content-Type", "application/json")
.body("{\n \"offer_id\": \"<string>\",\n \"payment_context_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.markdown2pdf.ai/payment_request/x402")
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 \"offer_id\": \"<string>\",\n \"payment_context_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"version": "<string>",
"x402_version": 2,
"accepts": [
{
"scheme": "exact",
"network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
"asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"amount": "400000",
"payTo": "<string>",
"maxTimeoutSeconds": 300,
"extra": {}
}
],
"resource": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}This response has no body data.{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Body
application/json
Response
x402 payment requirements for the offer.
⌘I

