Developer documentation

API Reference

Use the Way To Payments API to create payment intents, confirm payments, check platform health, and receive signed webhook events.

Base URL: https://api.w2p.me

Authentication

Bearer API keys

Send Authorization: Bearer <API_KEY> on every authenticated request.

curl -s https://api.w2p.me/health \
  -H "Authorization: Bearer <API_KEY>"
Safe retries

Idempotency

For POST create requests, include an Idempotency-Key header so retries do not accidentally create duplicate resources.

Idempotency-Key: 8a2e9f5c-1f8a-4d3c-a2b4-1b2c3d4e5f6a
Endpoints

Core API endpoints

GET /health

Check whether the API is reachable.

curl -s https://api.w2p.me/health

GET /status

Check current API/platform status.

curl -s https://api.w2p.me/status

POST /v1/payment_intents

Create a payment intent with an amount in minor currency units, a currency code, and an optional description.

curl -s -X POST https://api.w2p.me/v1/payment_intents \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: <uuid>" \
  -d '{"amount": 1499, "currency":"USD", "description":"T-shirt"}'

POST /v1/payment_intents/{pid}/confirm

Confirm an existing payment intent.

curl -s -X POST https://api.w2p.me/v1/payment_intents/pi_xxx/confirm \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{}'

POST /v1/webhooks

Receive signed webhook events. Verify the X-W2P-Signature header before trusting the event payload.

curl -s -X POST https://api.w2p.me/v1/webhooks \
  -H "X-W2P-Signature: t=1712345678,v1=abcdef..." \
  --data-binary @event.json
Examples

Payment intent examples

Python

import requests, uuid

r = requests.post("https://api.w2p.me/v1/payment_intents",
  headers={
    "Authorization": "Bearer YOUR_KEY",
    "Content-Type": "application/json",
    "Idempotency-Key": str(uuid.uuid4())
  },
  json={"amount":1499,"currency":"USD","description":"T-shirt"})

print(r.json())

JavaScript (Node)

const res = await fetch("https://api.w2p.me/v1/payment_intents", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_KEY",
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID()
  },
  body: JSON.stringify({"amount":1499,"currency":"USD","description":"T-shirt"})
});

console.log(await res.json());

PHP

$ch = curl_init("https://api.w2p.me/v1/payment_intents");
curl_setopt_array($ch, [
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer YOUR_KEY",
    "Content-Type: application/json",
    "Idempotency-Key: 123e4567-e89b-12d3-a456-426614174000"
  ],
  CURLOPT_POST => true,
  CURLOPT_POSTFIELDS => json_encode([
    "amount" => 1499,
    "currency" => "USD",
    "description" => "T-shirt"
  ]),
  CURLOPT_RETURNTRANSFER => true
]);

echo curl_exec($ch);