# Confirm a step of a charge.

> Finishes, from your server, a charge that answered `202` with a step only the payer can complete: send back the identifier the charge returned for that step with what the payer gave. `otp_id` with `code` for `confirm_otp`, `pin_id` with `pin`, `phone_id` with `phone`, `birthday_id` with `birthday`, `address_id` with `address`, `city`, `state` and `zip_code`, or `client_session_id` (the charge's `client_session.id`) once the payer is back from the provider's own window. One step per call. The hosted payment page and the Components confirm on their side and never need this call. The answer is the charge's: `200` once the payment is paid, `202` with the next step when the provider asks for another one, `402` when it refuses what was sent. A code, PIN, phone, birthday or address gets three tries per step: `attempts_remaining` says how many are left, and with none left the payment has to be charged again. Send an `Idempotency-Key`: the same key returns the first answer instead of sending the payer's code twice.

`POST https://api.wajub.com/payments/{id}/confirm`

Finishes, from your server, a charge that answered `202` with a step only the payer can complete: send back the identifier the charge returned for that step with what the payer gave. `otp_id` with `code` for `confirm_otp`, `pin_id` with `pin`, `phone_id` with `phone`, `birthday_id` with `birthday`, `address_id` with `address`, `city`, `state` and `zip_code`, or `client_session_id` (the charge's `client_session.id`) once the payer is back from the provider's own window. One step per call. The hosted payment page and the Components confirm on their side and never need this call.

The answer is the charge's: `200` once the payment is paid, `202` with the next step when the provider asks for another one, `402` when it refuses what was sent. A code, PIN, phone, birthday or address gets three tries per step: `attempts_remaining` says how many are left, and with none left the payment has to be charged again. Send an `Idempotency-Key`: the same key returns the first answer instead of sending the payer's code twice.

A payment made for a Sync seller (through `X-Sync`, or shared with them) whose platform or Wajub froze them with `block_payments` is refused at this step with `403 account_frozen`, however long before the freeze the charge started: nothing is sent to the provider and no try is counted. `client_session_id` is not refused: the payer already paid in the provider's window. A payment the provider completes all the same is collected and is not paid out to the seller while the freeze lasts.

## Path parameters

- `id` (string, required): Payment `id`.

## Headers

- `Idempotency-Key` (string): Your key for this request, 1 to 128 characters of letters, digits and `. _ : -`. The same request sent again with the same key returns the first answer instead of doing the work twice. See [Idempotency](https://docs.wajub.com/api/idempotency).

## Body (application/json)

- `otp_id` (string, nullable): With `confirm_otp`: the `otp_id` of the charge's answer.
- `code` (string, nullable): With `otp_id`: the code the payer received.
- `pin_id` (string, nullable): With `confirm_pin`: the `pin_id` of the charge's answer.
- `pin` (string, nullable): With `pin_id`: the card's PIN, as the payer typed it.
- `phone_id` (string, nullable): With `confirm_phone`: the `phone_id` of the charge's answer.
- `phone` (string, nullable): With `phone_id`: the payer's phone number.
- `birthday_id` (string, nullable): With `confirm_birthday`: the `birthday_id` of the charge's answer.
- `birthday` (string, nullable): With `birthday_id`: the payer's date of birth, `YYYY-MM-DD`.
- `address_id` (string, nullable): With `confirm_address`: the `address_id` of the charge's answer.
- `address` (string, nullable): With `address_id`: the billing street address.
- `city` (string, nullable): With `address_id`: the billing city.
- `state` (string, nullable): With `address_id`: the billing state or region.
- `zip_code` (string, nullable): With `address_id`: the billing postal code.
- `client_session_id` (string, nullable): With `client_session`: the `client_session.id` of the charge's answer, once the payer has finished in the provider's window.
- `psp_transaction_id` (string, nullable): With `client_session_id`, for a provider whose window hands back its own payment id.

## Responses

- `200`: Confirmed, the payment is paid
- `202`: The provider asks for another step
- `402`: Payment Required
- `403`: Seller frozen with their payments blocked
- `404`: Unknown payment
- `422`: Unprocessable Content

## Example response (200)

```json
{
  "code": 200,
  "status": "OK",
  "message": "Payment confirmed.",
  "transaction": {
    "id": "trx_CSUGajfv9xh0XQ5wu2lx",
    "status": "succeeded",
    "amount": 5000,
    "currency": "NGN"
  }
}
```
