Create a payment
curl --request POST \
--url https://api.sandbox.paywit.xyz/v1/payments \
--header 'Content-Type: application/json' \
--header 'X-Paywit-Secret-Key: <api-key>' \
--data '
{
"amount": 5.43,
"description": "Order #18421",
"clientReferenceId": "order_18421",
"returnUrl": "https://shop.example/orders/18421"
}
'import requests
url = "https://api.sandbox.paywit.xyz/v1/payments"
payload = {
"amount": 5.43,
"description": "Order #18421",
"clientReferenceId": "order_18421",
"returnUrl": "https://shop.example/orders/18421"
}
headers = {
"X-Paywit-Secret-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Paywit-Secret-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 5.43,
description: 'Order #18421',
clientReferenceId: 'order_18421',
returnUrl: 'https://shop.example/orders/18421'
})
};
fetch('https://api.sandbox.paywit.xyz/v1/payments', 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.sandbox.paywit.xyz/v1/payments",
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([
'amount' => 5.43,
'description' => 'Order #18421',
'clientReferenceId' => 'order_18421',
'returnUrl' => 'https://shop.example/orders/18421'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Paywit-Secret-Key: <api-key>"
],
]);
$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.sandbox.paywit.xyz/v1/payments"
payload := strings.NewReader("{\n \"amount\": 5.43,\n \"description\": \"Order #18421\",\n \"clientReferenceId\": \"order_18421\",\n \"returnUrl\": \"https://shop.example/orders/18421\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Paywit-Secret-Key", "<api-key>")
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.sandbox.paywit.xyz/v1/payments")
.header("X-Paywit-Secret-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 5.43,\n \"description\": \"Order #18421\",\n \"clientReferenceId\": \"order_18421\",\n \"returnUrl\": \"https://shop.example/orders/18421\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.paywit.xyz/v1/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Paywit-Secret-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 5.43,\n \"description\": \"Order #18421\",\n \"clientReferenceId\": \"order_18421\",\n \"returnUrl\": \"https://shop.example/orders/18421\"\n}"
response = http.request(request)
puts response.read_body{
"paymentCheckoutUrl": "https://checkout.sandbox.paywit.xyz/checkout/0f4c1e2a-7b3d-4e5f-9a6b-1c2d3e4f5a6b",
"payment": {
"id": "0f4c1e2a-7b3d-4e5f-9a6b-1c2d3e4f5a6b",
"createdAt": "2026-10-14T09:29:07.335Z",
"amount": 5.43,
"status": "Created",
"description": "Order #18421",
"returnUrl": "https://shop.example/orders/18421",
"expiresAt": "2026-10-14T10:29:07.335Z",
"bridgeStatus": null
}
}{
"statusCode": 123,
"body": "<unknown>"
}{
"statusCode": 123,
"body": "<unknown>"
}Payments
Create a payment
Creates a payment and returns the hosted checkout URL to send the buyer to. Call this from your server with your secret key so the amount is fixed server-side. The publishable key is also accepted, for client-side use through the JavaScript SDK.
POST
/
v1
/
payments
Create a payment
curl --request POST \
--url https://api.sandbox.paywit.xyz/v1/payments \
--header 'Content-Type: application/json' \
--header 'X-Paywit-Secret-Key: <api-key>' \
--data '
{
"amount": 5.43,
"description": "Order #18421",
"clientReferenceId": "order_18421",
"returnUrl": "https://shop.example/orders/18421"
}
'import requests
url = "https://api.sandbox.paywit.xyz/v1/payments"
payload = {
"amount": 5.43,
"description": "Order #18421",
"clientReferenceId": "order_18421",
"returnUrl": "https://shop.example/orders/18421"
}
headers = {
"X-Paywit-Secret-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Paywit-Secret-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 5.43,
description: 'Order #18421',
clientReferenceId: 'order_18421',
returnUrl: 'https://shop.example/orders/18421'
})
};
fetch('https://api.sandbox.paywit.xyz/v1/payments', 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.sandbox.paywit.xyz/v1/payments",
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([
'amount' => 5.43,
'description' => 'Order #18421',
'clientReferenceId' => 'order_18421',
'returnUrl' => 'https://shop.example/orders/18421'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Paywit-Secret-Key: <api-key>"
],
]);
$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.sandbox.paywit.xyz/v1/payments"
payload := strings.NewReader("{\n \"amount\": 5.43,\n \"description\": \"Order #18421\",\n \"clientReferenceId\": \"order_18421\",\n \"returnUrl\": \"https://shop.example/orders/18421\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Paywit-Secret-Key", "<api-key>")
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.sandbox.paywit.xyz/v1/payments")
.header("X-Paywit-Secret-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 5.43,\n \"description\": \"Order #18421\",\n \"clientReferenceId\": \"order_18421\",\n \"returnUrl\": \"https://shop.example/orders/18421\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.paywit.xyz/v1/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Paywit-Secret-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 5.43,\n \"description\": \"Order #18421\",\n \"clientReferenceId\": \"order_18421\",\n \"returnUrl\": \"https://shop.example/orders/18421\"\n}"
response = http.request(request)
puts response.read_body{
"paymentCheckoutUrl": "https://checkout.sandbox.paywit.xyz/checkout/0f4c1e2a-7b3d-4e5f-9a6b-1c2d3e4f5a6b",
"payment": {
"id": "0f4c1e2a-7b3d-4e5f-9a6b-1c2d3e4f5a6b",
"createdAt": "2026-10-14T09:29:07.335Z",
"amount": 5.43,
"status": "Created",
"description": "Order #18421",
"returnUrl": "https://shop.example/orders/18421",
"expiresAt": "2026-10-14T10:29:07.335Z",
"bridgeStatus": null
}
}{
"statusCode": 123,
"body": "<unknown>"
}{
"statusCode": 123,
"body": "<unknown>"
}Authorizations
SecretKeyPublishableKey
Server-to-server key, sk_test_... on sandbox and sk_live_... on production. Generate it in the dashboard under your app. Never ship it to a browser or mobile app.
Body
application/json
Amount in USDC.
Example:
5.43
Shown to the buyer on the checkout.
Example:
"Order #18421"
Your own order or invoice id. Echoed back in webhooks so you can match the payment to your records.
Example:
"order_18421"
Where the checkout sends the buyer after paying. Must be http or https.
Example:
"https://shop.example/orders/18421"