Skip to main content

Orders API

Manage orders and process payment fulfillment.

Get Order

Retrieve an order by ID.

GET /api/orders/:id

Response

{
"success": true,
"responseObject": {
"id": "ord_abc123",
"sessionId": "sess_xyz789",
"merchantId": "merch_abc123",
"status": "SIGNAL_MINED",
"intentHash": "0x1234567890abcdef...",
"signalTx": "0xabcdef1234567890...",
"fulfillTx": null,
"paymentPlatform": "venmo",
"fiatCurrency": "USD",
"amountUsdc": "50.00",
"conversionRate": "1.00",
"recipient": "@merchant-venmo",
"quote": {
"fiatAmount": "50.00",
"tokenAmount": "50000000",
"payeeAddress": "@merchant-venmo"
},
"expiresAt": "2024-01-15T11:00:00.000Z",
"createdAt": "2024-01-15T10:00:00.000Z",
"updatedAt": "2024-01-15T10:05:00.000Z"
}
}

Fulfill Order

Submit a payment proof to verify and fulfill the order.

POST /api/orders/fulfill

Request

{
"intentHash": "0x1234567890abcdef...",
"proof": {
"identifier": "...",
"claimData": { ... },
"signatures": [ ... ],
"witnesses": [ ... ]
}
}
FieldTypeRequiredDescription
intentHashstringYesThe on-chain intent hash
proofobjectYesReclaim proof object

Success Response

{
"success": true,
"message": "Order fulfilled successfully",
"responseObject": {
"order": {
"id": "ord_abc123",
"status": "FULFILLED",
"fulfillTx": "0x9876543210fedcba...",
...
},
"proofAttemptId": "proof_xyz789",
"txHash": "0x9876543210fedcba..."
}
}

Error Response

When proof verification fails, users can retry with a new proof:

{
"success": false,
"message": "Payment proof validation failed",
"responseObject": {
"proofAttemptId": "proof_xyz789",
"errorCode": "PROOF_INVALID",
"errorMessage": "Payment amount does not match intent",
"canRetry": true
}
}
Error CodeDescriptionCan Retry
PROOF_INVALIDProof verification failedYes
PROOF_EXPIREDProof timestamp too oldYes
FULFILL_TIMEOUTOn-chain tx timed outNo
FULFILL_REVERTEDOn-chain tx revertedNo
ORDER_NOT_FOUNDOrder doesn't existNo
ORDER_ALREADY_FULFILLEDAlready completedNo

Get Proof Attempts

Get all proof attempts for an order.

GET /api/orders/:id/proof-attempts

Response

{
"success": true,
"responseObject": {
"proofAttempts": [
{
"id": "proof_xyz789",
"orderId": "ord_abc123",
"intentHash": "0x1234...",
"status": "FULFILLED",
"submittedAt": "2024-01-15T10:10:00.000Z",
"verifiedAt": "2024-01-15T10:10:05.000Z",
"txHash": "0x9876...",
"txConfirmedAt": "2024-01-15T10:10:30.000Z"
},
{
"id": "proof_abc456",
"orderId": "ord_abc123",
"intentHash": "0x1234...",
"status": "REJECTED",
"submittedAt": "2024-01-15T10:08:00.000Z",
"verificationError": "PROOF_INVALID",
"verificationMessage": "Payment amount does not match"
}
]
}
}

Order Status Values

StatusDescription
SESSION_CREATEDInitial state
SIGNAL_SENTIntent tx submitted
SIGNAL_MINEDIntent confirmed on-chain
PAYMENT_SENTUser marked payment sent
PROOF_VERIFIEDProof verified off-chain
PROOF_SUBMITTEDProof submitted to chain
FULFILL_SUBMITTEDFulfillment tx submitted
FULFILLEDPayment complete, USDC transferred
CANCELLEDOrder cancelled
EXPIREDOrder expired
FAILEDOrder failed

Order Lifecycle

SESSION_CREATED

SIGNAL_SENT → (tx pending)

SIGNAL_MINED → (intent on-chain)

PAYMENT_SENT → (user sent fiat)

PROOF_VERIFIED → (proof checked)

PROOF_SUBMITTED → (proof on-chain)

FULFILL_SUBMITTED → (tx pending)

FULFILLED ✓

Alternative paths:

  • SIGNAL_MINED → EXPIRED (timeout)
  • SIGNAL_MINED → CANCELLED (user cancelled)
  • PROOF_VERIFIED → FAILED (tx reverted)