PlexySDK DOCS

Two-Step Checkout

Separate authorization and capture for inventory management and reservation scenarios

Two-Step Checkout

Two-step checkout separates payment authorization from capture, giving you control over when funds are collected. This is essential for scenarios where you need to verify inventory, prevent fraud, or hold reservations before finalizing payment.

How Two-Step Checkout Works

Verify the customer's payment method and reserve funds. No money is transferred yet.

Check inventory, perform fraud review, ship products, or render services.

Collect the reserved funds when ready. You can capture the full amount or a partial amount.

When to Use Two-Step Checkout

Use CaseWhy Two-Step
E-commerce with shippingCapture when order ships to avoid charging for out-of-stock items
Hotel reservationsAuthorize at booking, capture at check-out
Car rentalsAuthorize for estimated total, capture actual charges
Pre-ordersAuthorize to confirm interest, capture when product ships
Fraud reviewAuthorize immediately, capture after manual verification
Marketplace ordersAuthorize at checkout, capture when seller confirms

Authorization

Create a payment with capture_method: "manual" to authorize without capturing.

curl -X POST https://api.plexypay.com/v2/payments \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": {
      "value": 150000,
      "currency": "KZT"
    },
    "payment_method": {
      "type": "card",
      "number": "4111111111111111",
      "expiry_month": "03",
      "expiry_year": "2028",
      "cvc": "737",
      "holder_name": "John Doe"
    },
    "capture_method": "manual",
    "reference": "order_12345",
    "merchant_id": "merchant_abc123",
    "return_url": "https://your-site.com/checkout/complete",
    "metadata": {
      "order_type": "pre_order",
      "expected_ship_date": "2026-04-01"
    }
  }'

Response:

{
  "payment_id": "pay_abc123xyz",
  "status": "authorized",
  "amount": {
    "value": 150000,
    "currency": "KZT"
  },
  "authorized_amount": {
    "value": 150000,
    "currency": "KZT"
  },
  "captured_amount": {
    "value": 0,
    "currency": "KZT"
  },
  "capture_method": "manual",
  "authorization": {
    "expires_at": "2026-04-01T10:30:00Z",
    "remaining_amount": {
      "value": 150000,
      "currency": "KZT"
    }
  },
  "reference": "order_12345",
  "merchant_id": "merchant_abc123"
}

Capture

When you're ready to collect funds, call the capture endpoint.

Full Capture

Capture the entire authorized amount.

curl -X POST https://api.plexypay.com/v2/payments/pay_abc123xyz/captures \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchant_id": "merchant_abc123",
    "idempotency_key": "capture_order_12345"
  }'

Partial Capture

Capture less than the authorized amount. The remaining authorization is released.

curl -X POST https://api.plexypay.com/v2/payments/pay_abc123xyz/captures \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": {
      "value": 120000,
      "currency": "KZT"
    },
    "merchant_id": "merchant_abc123",
    "idempotency_key": "capture_order_12345_partial",
    "reason": "Item out of stock, reduced quantity"
  }'

When you capture less than the authorized amount, the difference is automatically released back to the customer's available balance. This typically appears on their statement within 3-7 business days.

Cancel Authorization

If you don't need to capture (e.g., order cancelled, item unavailable), void the authorization.

curl -X POST https://api.plexypay.com/v2/payments/pay_abc123xyz/voids \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchant_id": "merchant_abc123",
    "reason": "Order cancelled by customer"
  }'

Authorization Expiry

Authorizations have a limited validity period. If you don't capture before expiry, the hold is automatically released.

Card NetworkDefault ValidityExtended MCC
Visa7 days30 days
Mastercard7 days30 days
American Express7 days7 days

Always monitor authorization expiry dates. Attempting to capture an expired authorization will fail, and you'll need to re-authorize with the customer.

Extending Authorization

For long-term reservations, you can re-authorize before expiry. Check the authorization.expires_at field from the payment response. If expiry is within 24 hours:

Step 1: Void the old authorization

curl -X POST https://api.plexypay.com/v2/payments/pay_abc123xyz/voids \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchant_id": "merchant_abc123",
    "reason": "Re-authorization for extended hold"
  }'

Step 2: Create a new authorization using the stored payment method token

curl -X POST https://api.plexypay.com/v2/payments \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": { "value": 150000, "currency": "KZT" },
    "payment_method": { "type": "token", "token_id": "tok_card_visa_4242" },
    "capture_method": "manual",
    "reference": "order_12345",
    "merchant_id": "merchant_abc123"
  }'

Store the new payment_id and the updated authorization.expires_at from the response.

Inventory Management Pattern

A common pattern for e-commerce with physical goods.

Step 1: Authorize payment at checkout

curl -X POST https://api.plexypay.com/v2/payments \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": { "value": 150000, "currency": "KZT" },
    "payment_method": {
      "type": "card",
      "number": "4111111111111111",
      "expiry_month": "03",
      "expiry_year": "2028",
      "cvc": "737"
    },
    "capture_method": "manual",
    "reference": "order_12345",
    "merchant_id": "merchant_abc123"
  }'

If the response status is authorized, proceed to reserve inventory. If inventory is unavailable, void the authorization:

curl -X POST https://api.plexypay.com/v2/payments/pay_abc123xyz/voids \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchant_id": "merchant_abc123",
    "reason": "Inventory not available"
  }'

Step 2: Capture payment when the order ships

curl -X POST https://api.plexypay.com/v2/payments/pay_abc123xyz/captures \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchant_id": "merchant_abc123",
    "idempotency_key": "ship_order_12345"
  }'

Hotel Reservation Pattern

For hotels and rentals where the final amount may differ from the estimate.

At booking: authorize the estimated amount

curl -X POST https://api.plexypay.com/v2/payments \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": { "value": 150000, "currency": "KZT" },
    "payment_method": {
      "type": "card",
      "number": "4111111111111111",
      "expiry_month": "03",
      "expiry_year": "2028",
      "cvc": "737"
    },
    "capture_method": "manual",
    "reference": "booking_456",
    "merchant_id": "merchant_abc123",
    "metadata": {
      "check_in": "2026-04-01",
      "check_out": "2026-04-05",
      "room_type": "deluxe"
    }
  }'

At check-out: capture the actual final amount (partial capture if less than authorized)

curl -X POST https://api.plexypay.com/v2/payments/pay_abc123xyz/captures \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": { "value": 130000, "currency": "KZT" },
    "merchant_id": "merchant_abc123",
    "reference": "checkout_booking_456"
  }'

If the final amount exceeds the authorization, first capture the full authorized amount, then create a new payment for the excess using the stored payment method token:

curl -X POST https://api.plexypay.com/v2/payments \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": { "value": 20000, "currency": "KZT" },
    "payment_method": { "type": "token", "token_id": "tok_card_visa_4242" },
    "capture_method": "automatic",
    "reference": "additional_booking_456",
    "merchant_id": "merchant_abc123"
  }'

Webhook Events

AUTHORIZATION

Sent when a payment is authorized.

{
  "event_type": "AUTHORIZATION",
  "event_id": "evt_abc123",
  "created_at": "2026-03-25T10:30:00Z",
  "data": {
    "payment_id": "pay_abc123xyz",
    "reference": "order_12345",
    "merchant_id": "merchant_abc123",
    "status": "authorized",
    "amount": {
      "value": 150000,
      "currency": "KZT"
    },
    "authorization": {
      "expires_at": "2026-04-01T10:30:00Z"
    }
  }
}

CAPTURE

Sent when a payment is captured.

{
  "event_type": "CAPTURE",
  "event_id": "evt_def456",
  "created_at": "2026-03-25T15:45:00Z",
  "data": {
    "payment_id": "pay_abc123xyz",
    "capture_id": "cap_xyz789",
    "reference": "order_12345",
    "merchant_id": "merchant_abc123",
    "status": "captured",
    "captured_amount": {
      "value": 150000,
      "currency": "KZT"
    }
  }
}

Testing

Test CardBehavior
4111 1111 1111 1111Successful authorization and capture
4000 0000 0000 3055Authorization succeeds, capture fails
4000 0000 0000 0069Requires 3D Secure for authorization

Best Practices

Set up alerts for authorizations approaching expiry. Either capture or void before they expire.

Always include idempotency keys for capture requests to prevent duplicate captures from retries.

Capture as soon as you're ready to fulfill. Long-held authorizations can frustrate customers.

Let customers know their card will show a pending charge until capture or release.

If the final amount is less than authorized, use partial capture rather than voiding and re-charging.

Next Steps

On this page