Skip to main content

API Reference

Base URL: https://api.encrypto.fun

All merchant endpoints require the X-Checkout-Secret-Key header with your secret key (sk_live_xxx).


Merchants

Register Merchant

POST /checkout/merchants/register

No authentication required.

FieldTypeRequiredDescription
namestringYesBusiness name shown on checkout page
emailstringYesContact email
websitestringNoYour website URL
webhook_urlstringNoURL for payment notifications
success_urlstringNoDefault redirect after payment
cancel_urlstringNoDefault redirect on cancel
settlement_typestringNocrypto_usdc (default) or fiat_pix
settlement_addressstringNoWallet address for USDC settlement
settlement_chainstringNoChain for settlement: base, arbitrum, solana, ethereum, polygon
accepted_tokensarrayNoTokens to accept (default: USDC on all chains)
brand_colorstringNoHex color for checkout page (#000000)

Response: Returns merchant profile + API keys. Keys are shown once — save them.

Get Merchant Profile

GET /checkout/merchants/me

Update Merchant

PATCH /checkout/merchants/me

Same fields as register (all optional).

Roll API Keys

POST /checkout/merchants/me/keys/roll

Generates new keys. Old keys stop working immediately.


Sessions

Create Session

POST /checkout/sessions
FieldTypeRequiredDescription
amountnumberYesAmount in USD (e.g., 29.99)
currencystringYesCurrency code (USD)
descriptionstringNoShown on checkout page
success_urlstringNoRedirect after payment (overrides merchant default)
cancel_urlstringNoRedirect on cancel
metadataobjectNoYour custom data (returned in webhooks)
idempotency_keystringNoPrevent duplicate sessions

Response:

{
"session": {
"id": "uuid",
"external_id": "cs_live_xxx",
"amount_usd": 29.99,
"status": "pending",
"expires_at": "2026-02-16T01:00:00Z",
"metadata": {}
},
"checkout_url": "https://pay.encrypto.fun/pay/cs_live_xxx",
"embed_url": "https://pay.encrypto.fun/pay/cs_live_xxx/embed"
}

Get Session

GET /checkout/sessions/{external_id}

List Sessions

GET /checkout/sessions?limit=20&offset=0

Cancel Session

POST /checkout/sessions/{external_id}/cancel

Session Status Flow

pending → detecting → confirming → confirmed
↘ expired
↘ cancelled
StatusDescription
pendingSession created, waiting for customer to select chain
detectingCustomer selected chain, deposit address generated, waiting for payment
confirmingPayment detected on-chain, waiting for confirmations
confirmedPayment confirmed, session complete
expired30 minutes elapsed without payment
cancelledCancelled via API

Public Endpoints (Checkout Page)

These use the X-Checkout-Public-Key header (pk_live_xxx) or no auth.

Get Session for Checkout

GET /checkout/pay/{external_id}

Returns session info for rendering the checkout page.

Select Payment Method

POST /checkout/pay/{external_id}/select
FieldTypeRequiredDescription
chainstringYesbase, arbitrum, solana, ethereum, polygon
tokenstringYesUSDC

Response: Returns deposit address and QR code data.

Check Payment Status

GET /checkout/pay/{external_id}/status

Poll this every 3 seconds to update the checkout UI.


Webhooks

We send POST requests to your webhook_url with JSON body.

Headers

HeaderDescription
X-Checkout-SignatureHMAC-SHA256 hex digest of the request body
Content-Typeapplication/json

Verify Signature

const crypto = require('crypto');

function verify(body, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(JSON.stringify(body))
.digest('hex');
return signature === expected;
}

Events

EventDescription
payment.detectedPayment seen on-chain (not yet confirmed)
payment.confirmingPayment has some confirmations
payment.confirmedPayment fully confirmed
payment.failedPayment failed or insufficient
session.expiredSession expired without payment
settlement.completedUSDC settled to your wallet

Payload

{
"event": "payment.confirmed",
"data": {
"session_external_id": "cs_live_xxx",
"payment_external_id": "pi_live_xxx",
"amount_usd": 29.99,
"amount_token": 29.99,
"token": "USDC",
"chain": "base",
"tx_hash": "0x...",
"from_address": "0x...",
"metadata": { "order_id": "ord_123" }
},
"timestamp": "2026-02-16T00:30:00Z"
}

Retry Policy

Failed webhook deliveries are retried with exponential backoff:

AttemptDelay
130 seconds
22 minutes
310 minutes
430 minutes
52 hours

After 5 failed attempts, the webhook is marked as failed. Check delivery status in the dashboard.


Error Codes

CodeDescription
401Invalid API key
403Merchant deactivated
404Session not found
409Session already has a payment / duplicate idempotency key
422Invalid request body
500Server error

All errors return:

{
"detail": "Human-readable error message"
}