> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yabetoopay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Confirm Payment Intent

> Confirm a payment intent to process the payment.

## Endpoint

```bash theme={null}
POST https://pay.sandbox.yabetoopay.com/v1/payment-intents/:id/confirm   # Sandbox
POST https://pay.api.yabetoopay.com/v1/payment-intents/:id/confirm       # Production
```

`:id` is the payment intent ID.

## Authentication

Use your secret key in the `Authorization` header:

```bash theme={null}
Authorization: Bearer YOUR_SECRET_KEY
```

## Request Body

| Parameter             | Type     | Required | Description                             |
| --------------------- | -------- | -------- | --------------------------------------- |
| `client_secret`       | `string` | Yes      | The client secret of the payment intent |
| `first_name`          | `string` | No       | Customer's first name                   |
| `last_name`           | `string` | No       | Customer's last name                    |
| `receipt_email`       | `string` | No       | Customer's email address                |
| `payment_method_data` | `object` | Yes      | Payment method details                  |

### payment\_method\_data structure

```json theme={null}
{
  "type": "momo",
  "momo": {
    "country": "cg",
    "msisdn": "+242123456789",
    "operator_name": "mtn"
  }
}
```

| Field                | Description                                   |
| -------------------- | --------------------------------------------- |
| `type`               | Payment method type (`momo` for Mobile Money) |
| `momo.country`       | Country code (e.g., `cg`, `cm`)               |
| `momo.msisdn`        | Phone number in international format          |
| `momo.operator_name` | Operator name (`mtn`, `airtel`)               |

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://pay.sandbox.yabetoopay.com/v1/payment-intents/PAYMENT_INTENT_ID/confirm \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer YOUR_SECRET_KEY" \
    -d '{
      "client_secret": "YOUR_CLIENT_SECRET",
      "first_name": "John",
      "last_name": "Doe",
      "receipt_email": "john.doe@example.com",
      "payment_method_data": {
        "type": "momo",
        "momo": {
          "country": "cg",
          "msisdn": "+242123456789",
          "operator_name": "mtn"
        }
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  import Yabetoo from "@yabetoo/sdk-js";

  const yabetoo = new Yabetoo("YOUR_SECRET_KEY");

  const confirmation = await yabetoo.payments.confirm("PAYMENT_INTENT_ID", {
    clientSecret: "YOUR_CLIENT_SECRET",
    firstName: "John",
    lastName: "Doe",
    receiptEmail: "john.doe@example.com",
    paymentMethodData: {
      type: "momo",
      momo: {
        country: "cg",
        msisdn: "+242123456789",
        operatorName: "mtn",
      },
    },
  });
  ```

  ```python Python theme={null}
  from yabetoo import Yabetoo
  from yabetoo.models.payment import ConfirmIntentRequest, PaymentMethodData, MomoData

  yabetoo = Yabetoo("YOUR_SECRET_KEY")

  confirmation = yabetoo.payments.confirm(
      payment_id="PAYMENT_INTENT_ID",
      data=ConfirmIntentRequest(
          client_secret="YOUR_CLIENT_SECRET",
          first_name="John",
          last_name="Doe",
          receipt_email="john.doe@example.com",
          payment_method_data=PaymentMethodData(
              type="momo",
              momo=MomoData(
                  country="cg",
                  msisdn="+242123456789",
                  operator_name="mtn"
              )
          )
      )
  )
  ```

  ```php PHP theme={null}
  <?php
  require 'vendor/autoload.php';

  use Yabetoo\Yabetoo;

  $yabetoo = new Yabetoo("YOUR_SECRET_KEY");

  $confirmation = $yabetoo->payments->confirm("PAYMENT_INTENT_ID", [
      "client_secret" => "YOUR_CLIENT_SECRET",
      "first_name" => "John",
      "last_name" => "Doe",
      "receipt_email" => "john.doe@example.com",
      "payment_method_data" => [
          "type" => "momo",
          "momo" => [
              "country" => "cg",
              "msisdn" => "+242123456789",
              "operator_name" => "mtn",
          ],
      ],
  ]);
  ```

  ```java Java theme={null}
  import com.yabetoo.Yabetoo;
  import com.yabetoo.YabetooConfig;
  import com.yabetoo.model.PaymentIntent;
  import com.yabetoo.model.PaymentMethod;
  import com.yabetoo.request.PaymentIntentConfirmRequest;

  YabetooConfig config = new YabetooConfig()
      .setApiKey("YOUR_SECRET_KEY");

  Yabetoo yabetoo = new Yabetoo(config);

  PaymentMethod.MomoDetails momoDetails = PaymentMethod.MomoDetails.builder()
      .msisdn("+242123456789")
      .country("cg")
      .operatorName("mtn")
      .build();

  PaymentMethod paymentMethod = PaymentMethod.builder()
      .type("momo")
      .momoDetails(momoDetails)
      .build();

  PaymentIntent confirmation = yabetoo.paymentIntents().confirm(
      "PAYMENT_INTENT_ID",
      PaymentIntentConfirmRequest.builder()
          .clientSecret("YOUR_CLIENT_SECRET")
          .firstName("John")
          .lastName("Doe")
          .email("john.doe@example.com")
          .paymentMethod(paymentMethod)
          .build()
  );
  ```
</CodeGroup>

## Response

### 200 OK - Payment Succeeded

```json theme={null}
{
  "intentId": "pi_3r8utQTUlCY5hjV2pMtjtaNYsZ30FylO3PZk",
  "financialTransactionId": "7331529368",
  "transactionId": "pi_3r8utQTUlCY5hjV2pMtjtaNYsZ30FylO3PZk",
  "amount": 2228,
  "currency": "xaf",
  "status": "succeeded",
  "captured": true,
  "externalId": "ext_7hp8lsjCFwTemoeL",
  "id": "ch_ADdQhObdEDlz4L0kl7qNRniFjruNcrcY85xq",
  "createdAt": "2026-02-16T06:51:43.103+00:00",
  "updatedAt": "2026-02-16T06:51:43.177+00:00",
  "paymentMethodId": "pm_evILNJIgAyJs7S4KYmy5n5Ect8itay2GeycL"
}
```

### 200 OK - Payment Failed

When the payment fails (e.g., timeout, insufficient balance), the response will still return a 200 status code but with a failed status:

```json theme={null}
{
  "intentId": "pi_HUHh0kAg9H8QZvHtFf0taIspdWlUVftSOLhB",
  "transactionId": "pi_HUHh0kAg9H8QZvHtFf0taIspdWlUVftSOLhB",
  "amount": 10363,
  "currency": "xaf",
  "status": "expired",
  "captured": false,
  "externalId": "ext_mQliBh5ZbdQ9w15S",
  "failureMessage": "Transaction timed out",
  "failureCode": "Transaction timed out",
  "id": "ch_nZBtA8euTJFnpFMTSO402WJOP1g2WwWSGiC7",
  "createdAt": "2026-02-16T14:07:02.061+00:00",
  "updatedAt": "2026-02-16T14:07:02.190+00:00",
  "paymentMethodId": "pm_tU0HivHLBjozujmhwbVk3LO0B2ttcd0Rk1j3"
}
```

### 422 Bad Request

```json theme={null}
{
  "status": 422,
  "path": "/v1/payment-intents/pi_2GlfKbBC6IMYBPDhOaFIRdn0nrXDDEAjBxyW/confirm",
  "timestamp": "2026-02-16T15:54:49.730+00:00",
  "code": "E_OPERATION_NOT_PERMITTED",
  "message": "Operation not permitted",
  "detail": "You are not permitted to perform this operation."
}
```

### 404 Not Found

```json theme={null}
{
  "message": "Row not found"
}
```

### 401 Unauthorized

```json theme={null}
{
  "error": {
    "message": "Unauthorized",
    "code": "Unauthorized"
  }
}
```

<Warning>
  Error handling is important, as confirmation can fail for various reasons
  (insufficient funds, incorrect payment information, etc.).
</Warning>
