Skip to main content
POST
/
api
/
orders
/
:id
/
confirm
curl -X POST https://api.gatepass.io/api/orders/clx1234567890abcdef/confirm \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "transactionId": "FLW-TX-123456789",
    "paymentReference": "GP-clx1234567890-1234567890-a1b2c3d4",
    "gateway": "flutterwave",
    "amount": 102.50,
    "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
  }'
{
  "ok": true,
  "status": "COMPLETED",
  "order": {
    "id": "clx1234567890abcdef",
    "paymentStatus": "COMPLETED",
    "paymentTxId": "FLW-TX-123456789",
    "updatedAt": "2024-05-20T14:35:00Z"
  },
  "tickets": [
    {
      "id": "clx1111111111111111",
      "tokenId": 1001,
      "contractAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "txHash": "0xabc123def456789...",
      "metadataUri": "ipfs://QmX..."
    },
    {
      "id": "clx2222222222222222",
      "tokenId": 1002,
      "contractAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "txHash": "0xdef456abc789012...",
      "metadataUri": "ipfs://QmY..."
    }
  ],
  "notification": {
    "title": "Payment Successful",
    "message": "Your payment for 2 ticket(s) to Tech Conference 2024 was successful!",
    "type": "SUCCESS"
  }
}
This endpoint confirms a payment and updates the order status to COMPLETED. It triggers ticket minting and sends confirmation notifications.

Authentication

Authorization
string
required
Bearer token for authentication

Path Parameters

id
string
required
The unique identifier of the order to confirm

Request Body

transactionId
string
required
Payment gateway transaction ID
paymentReference
string
required
Payment reference from the gateway (tx_ref)
gateway
string
required
Payment gateway used: flutterwave, paystack, or mpesa
amount
number
Payment amount for verification
walletAddress
string
User’s wallet address for NFT ticket minting (required for blockchain tickets)

Response

ok
boolean
Indicates if the confirmation was successful
status
string
Updated order status: COMPLETED or FAILED
order
object
Updated order object
tickets
array
Array of minted ticket objects
notification
object
Confirmation notification sent to user
curl -X POST https://api.gatepass.io/api/orders/clx1234567890abcdef/confirm \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "transactionId": "FLW-TX-123456789",
    "paymentReference": "GP-clx1234567890-1234567890-a1b2c3d4",
    "gateway": "flutterwave",
    "amount": 102.50,
    "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
  }'
{
  "ok": true,
  "status": "COMPLETED",
  "order": {
    "id": "clx1234567890abcdef",
    "paymentStatus": "COMPLETED",
    "paymentTxId": "FLW-TX-123456789",
    "updatedAt": "2024-05-20T14:35:00Z"
  },
  "tickets": [
    {
      "id": "clx1111111111111111",
      "tokenId": 1001,
      "contractAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "txHash": "0xabc123def456789...",
      "metadataUri": "ipfs://QmX..."
    },
    {
      "id": "clx2222222222222222",
      "tokenId": 1002,
      "contractAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
      "txHash": "0xdef456abc789012...",
      "metadataUri": "ipfs://QmY..."
    }
  ],
  "notification": {
    "title": "Payment Successful",
    "message": "Your payment for 2 ticket(s) to Tech Conference 2024 was successful!",
    "type": "SUCCESS"
  }
}

Confirmation Flow

  1. Payment Verification: GatePass verifies the transaction with the payment gateway
  2. Amount Validation: Confirms the payment amount matches the order total
  3. Status Update: Updates order status to COMPLETED
  4. Ticket Minting: Mints NFT tickets on blockchain (if applicable)
  5. Notification: Sends confirmation email and in-app notification
  6. Response: Returns confirmed order with ticket details
This endpoint can only be called once per order. Attempting to confirm an already-completed order will return a 409 Conflict error.

Payment Gateway Integration

Flutterwave

After payment, Flutterwave redirects to your callback URL with transaction_id and tx_ref. Use these to confirm the order:
// Extract from redirect URL
const urlParams = new URLSearchParams(window.location.search);
const transactionId = urlParams.get('transaction_id');
const txRef = urlParams.get('tx_ref');

// Confirm order
await fetch(`/api/orders/${orderId}/confirm`, {
  method: 'POST',
  body: JSON.stringify({
    transactionId,
    paymentReference: txRef,
    gateway: 'flutterwave'
  })
});

Paystack

Paystack provides a reference parameter after successful payment:
const reference = urlParams.get('reference');

await fetch(`/api/orders/${orderId}/confirm`, {
  method: 'POST',
  body: JSON.stringify({
    transactionId: reference,
    paymentReference: reference,
    gateway: 'paystack'
  })
});

NFT Ticket Minting

If the event has a contractAddress and the user provides a walletAddress, NFT tickets are automatically minted:
  • Chain: Polygon (chainId: 137)
  • Standard: ERC-721
  • Metadata: Stored on IPFS
  • Transfer: Controlled by event settings
NFT tickets can be used for blockchain-verified check-ins and provide proof of attendance. They’re transferable if the event organizer enables transfers.

Error Codes

  • 400: Invalid payment information or verification failed
  • 404: Order not found
  • 409: Order already confirmed
  • 500: Blockchain minting failed (order still completed)

Build docs developers (and LLMs) love