ArgusDocs
English Türkçe

Pre-authorization, capture and cancel

On this page

Authorize a card now and collect the money later, for example when you ship.

The authorized amount stays reserved on the customer's card until you capture it or cancel it.

1. Authorize

Create the payment with capture_method: manual. Everything else, 3D Secure included, works as in card payments. The sample uses a card that you tokenized in the browser. To authorize a card your server received, send payment_method_data.card as in the quickstart instead of payment_method.

{
  "amount": 50000,
  "currency": "try",
  "capture_method": "manual",
  "confirm": true,
  "payment_method": "pm_01J9ZQA2B4C6D8E1F3G5H7J9K2",
  "payment_method_data": {
    "billing_details": {
      "name": "Ayşe Yılmaz",
      "address": {"line1": "Caferağa Mah. Moda Cad. No:12", "city": "Kadıköy", "country": "TR"}
    }
  },
  "return_url": "https://modakitabevi.com.tr/odeme/sonuc",
  "metadata": {"order_id": "SIP-2026-10431"}
}

A successful authorization ends in requires_capture. When 3D Secure applies, the payment is requires_action first and moves on after the customer approves:

{
  "id": "pi_01J9ZQ5W9L3N4P6Q8S1V3X5Z7B",
  "object": "payment_intent",
  "amount": 50000,
  "amount_capturable": 50000,
  "currency": "try",
  "status": "requires_capture",
  "capture_method": "manual",
  "auth_expires_at": 1795775400,
  "metadata": {"order_id": "SIP-2026-10431"},
  "created": 1795170600,
  "livemode": false
}

auth_expires_at is when the authorization lapses, so capture before then. An authorization still open at that time is canceled automatically, and the payment becomes canceled.

2. Capture

Capture the full amount:

curl -X POST https://api.pf.organizer.tr/v1/payment_intents/pi_01J9ZQ5W9L3N4P6Q8S1V3X5Z7B/capture \
  -H "Authorization: Bearer sk_sandbox_YOUR_KEY" \
  -H "Idempotency-Key: capture-order-SIP-2026-10431"

To capture less, for example when an item is out of stock, send amount_to_capture. The rest of the authorization is released on the customer's card.

{
  "amount_to_capture": 42000
}
curl -X POST https://api.pf.organizer.tr/v1/payment_intents/pi_01J9ZQ5W9L3N4P6Q8S1V3X5Z7B/capture \
  -H "Authorization: Bearer sk_sandbox_YOUR_KEY" \
  -H "Idempotency-Key: capture-order-SIP-2026-10431-partial" \
  -H "Content-Type: application/json" \
  -d '{"amount_to_capture": 42000}'

The payment becomes succeeded with amount_received: 42000. You can capture a payment only once.

If the bank does not allow a partial capture, the call returns 400 partial_capture_not_supported. Capture the full amount, then refund the difference.

3. Cancel

Release an authorization you will not capture:

{
  "cancellation_reason": "requested_by_customer"
}
curl -X POST https://api.pf.organizer.tr/v1/payment_intents/pi_01J9ZQ5W9L3N4P6Q8S1V3X5Z7B/cancel \
  -H "Authorization: Bearer sk_sandbox_YOUR_KEY" \
  -H "Idempotency-Key: cancel-order-SIP-2026-10431" \
  -H "Content-Type: application/json" \
  -d '{"cancellation_reason": "requested_by_customer"}'

cancellation_reason is optional. It is one of duplicate, fraudulent, requested_by_customer or abandoned. The payment becomes canceled, and the reserved amount is released on the customer's card.

You can also cancel a payment that was never confirmed. To give back money for a payment that is already succeeded, create a refund. On the day of the sale, we turn the refund into a cancellation automatically.

Events

Event When
payment_intent.amount_capturable_updated The authorization succeeded. The payment is requires_capture.
payment_intent.succeeded The capture went through.
payment_intent.canceled You canceled, or the authorization expired.

Errors

Error Meaning
400 payment_intent_unexpected_state The payment is not requires_capture: it is already captured, canceled or not yet authorized. Or a capture or cancel is already running, or auth_expires_at has passed.
400 parameter_invalid, param: amount_to_capture The amount is below 1 or above the authorized amount.
400 partial_capture_not_supported The bank does not allow a partial capture for this payment. Capture the full amount.
402 card_declined The bank declined the capture or the cancel. The payment stays requires_capture.
502 capture_failed, 502 void_failed The bank did not confirm it. The payment is unchanged. Retry with a new Idempotency-Key.
503 capture_booking_pending The bank captured the money and we are still recording it. Repeat the request with the same Idempotency-Key.
503 capture_outcome_unknown The bank's answer is not known yet. We check with the bank, and the payment stays requires_capture meanwhile. Read the payment or wait for the webhook. A retry with the same Idempotency-Key is safe.

In the API reference

Next: Return money after a capture with Refunds, and follow each step with Webhooks.