Skip to main content
POST

Charge Installment

Intro

Charges one installment to the card saved by the first installment, off session. Requires an Idempotency-Key header.

Context

Use this when you decide when to collect. The customer isn’t present, so if their bank asks for 3-D Secure or the card is declined, send a pay link instead. A plan on automatic collection is charged by Khaime on its due dates; you can still charge an installment early with this endpoint.

Hows

POST /installment-plans/{plan_id}/installments/{position}/charge

Headers

Idempotency

  • Retrying with the same key returns the first response — same status, same body — with Idempotent-Replayed: true, and never charges again.
  • The same key for a different installment, or while the first request is still running, answers 409 IDEMPOTENCY_CONFLICT.
  • Responses are kept for 24 hours. Server errors (5xx) aren’t kept, so a retry with the same key runs again.
  • An installment that’s already paid is never charged twice, whatever the key: a new key answers 409 INSTALLMENT_ALREADY_PAID.

Response

installment.paid is sent for the installment, and installment_plan.completed if it was the last one.

Errors

Whys

A charge moves money, and a timeout doesn’t tell you whether it happened. The idempotency key makes retrying safe: the retry either replays the result or waits for the first attempt, and never charges a second time.

Why nots

  • It can’t charge a different amount than the installment’s, or several installments at once — call it once per position.
  • A declined card isn’t retried by this endpoint; retry later with a new key, or send a pay link.