Skip to main content

Sessions API

Manage checkout sessions for payments.

Create Session

Create a new checkout session.

POST /api/checkout/sessions

Request

{
"merchantId": "merch_abc123",
"amountUsdc": "50.00",
"destinationChainId": 8453,
"destinationToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"recipientAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f8fE71",
"successUrl": "https://mystore.com/success",
"cancelUrl": "https://mystore.com/cancel",
"metadata": {
"orderId": "order_123"
}
}
FieldTypeRequiredDescription
merchantIdstringYesYour merchant ID
amountUsdcstringYesAmount in USDC (e.g., "50.00")
destinationChainIdnumberYesTarget chain (8453 for Base)
destinationTokenstringYesToken address
recipientAddressstringYesWallet to receive funds
successUrlstringNoRedirect after success
cancelUrlstringNoRedirect on cancel
metadataobjectNoCustom key-value pairs

Response

{
"success": true,
"message": "Session created successfully",
"responseObject": {
"session": {
"id": "sess_xyz789",
"merchantId": "merch_abc123",
"amountUsdc": "50.00",
"destinationChainId": 8453,
"destinationToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"recipientAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f8fE71",
"status": "CREATED",
"successUrl": "https://mystore.com/success",
"cancelUrl": "https://mystore.com/cancel",
"metadata": { "orderId": "order_123" },
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-15T10:00:00.000Z"
},
"checkoutUrl": "https://checkout.zkp2p-pay.xyz/checkout?session=sess_xyz789"
}
}

Get Session

Retrieve a session by ID.

GET /api/checkout/sessions/:id

Response

{
"success": true,
"responseObject": {
"id": "sess_xyz789",
"merchantId": "merch_abc123",
"amountUsdc": "50.00",
"status": "ACTIVE",
"selectedPaymentPlatform": "venmo",
"selectedFiatCurrency": "USD",
"activeOrderId": "ord_abc123",
"merchant": {
"id": "merch_abc123",
"name": "my-store",
"displayName": "My Store"
},
"activeOrder": {
"id": "ord_abc123",
"status": "SIGNAL_MINED",
...
},
...
}
}

Select Platform

Save the user's payment platform selection.

POST /api/checkout/sessions/:id/select-platform

Request

{
"paymentPlatform": "venmo",
"fiatCurrency": "USD"
}

Response

{
"success": true,
"responseObject": {
"session": {
"id": "sess_xyz789",
"selectedPaymentPlatform": "venmo",
"selectedFiatCurrency": "USD",
...
}
}
}

Start Session

Get a quote and create an order for the session.

POST /api/checkout/sessions/:id/start

Request

{
"paymentPlatform": "venmo",
"fiatCurrency": "USD"
}

Response

{
"success": true,
"responseObject": {
"session": {
"id": "sess_xyz789",
"status": "ACTIVE",
...
},
"order": {
"id": "ord_abc123",
"status": "SIGNAL_MINED",
"intentHash": "0x1234...",
"signalTx": "0xabcd...",
"paymentPlatform": "venmo",
"recipient": "@merchant-venmo",
...
},
"quote": {
"fiatAmount": "50.00",
"fiatAmountFormatted": "$50.00",
"tokenAmount": "50000000",
"tokenAmountFormatted": "50.00 USDC",
"paymentMethod": "venmo",
"payeeAddress": "@merchant-venmo",
"conversionRate": "1.00"
},
"intentHash": "0x1234...",
"expiresAt": "2024-01-15T11:00:00.000Z"
}
}

Get Active Order

Get the active order for a session.

GET /api/checkout/sessions/:id/order

Response

{
"success": true,
"responseObject": {
"order": {
"id": "ord_abc123",
"sessionId": "sess_xyz789",
"status": "SIGNAL_MINED",
"intentHash": "0x1234...",
...
}
}
}

Mark Payment Sent

Indicate that the user has sent the fiat payment.

POST /api/checkout/sessions/:id/payment-sent

Response

{
"success": true,
"responseObject": {
"order": {
"id": "ord_abc123",
"status": "PAYMENT_SENT",
...
}
}
}

Session Status Values

StatusDescription
CREATEDSession created, awaiting user
ACTIVEUser started checkout, order created
COMPLETEDPayment successful
EXPIREDSession expired (24 hours)
CANCELLEDUser cancelled checkout