API Reference
Base URL: https://api.w2p.me
Authentication
Send Authorization: Bearer <API_KEY>
on every request.
curl -s https://api.w2p.me/health -H "Authorization: Bearer <API_KEY>"
Idempotency
On POST creates, include Idempotency-Key
to safely retry.
Idempotency-Key: 8a2e9f5c-1f8a-4d3c-a2b4-1b2c3d4e5f6a
Endpoints
GET /health
curl -s https://api.w2p.me/health
GET /status
curl -s https://api.w2p.me/status
POST /v1/payment_intents
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
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
curl -s -X POST https://api.w2p.me/v1/webhooks \ -H "X-W2P-Signature: t=1712345678,v1=abcdef..." \ --data-binary @event.json
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);