> ## 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.

# Create Payment Intent

> Create a payment intent to process a payment.

## Endpoint

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

## Authentication

Use your secret key in the `Authorization` header:

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

## Request Body

| Parameter     | Type     | Required | Description                                       |
| ------------- | -------- | -------- | ------------------------------------------------- |
| `amount`      | `number` | Yes      | The amount to be paid (in smallest currency unit) |
| `currency`    | `string` | Yes      | Currency code (e.g., `xaf`, `xof`)                |
| `description` | `string` | No       | Description of the payment                        |
| `metadata`    | `object` | No       | Custom key-value data for your reference          |

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://pay.sandbox.yabetoopay.com/v1/payment-intents \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer YOUR_SECRET_KEY" \
    -d '{
      "amount": 2000,
      "currency": "xaf",
      "description": "Payment for product",
      "metadata": { "orderId": "1234" }
    }'
  ```

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

  const yabetoo = new Yabetoo("YOUR_SECRET_KEY");

  const paymentIntent = await yabetoo.payments.create({
    amount: 2000,
    currency: "xaf",
    description: "Payment for product",
    metadata: { orderId: "1234" },
  });
  ```

  ```python Python theme={null}
  from yabetoo import Yabetoo
  from yabetoo.models.payment import CreateIntentRequest

  yabetoo = Yabetoo("YOUR_SECRET_KEY")

  payment_intent = yabetoo.payments.create(CreateIntentRequest(
      amount=2000,
      currency="xaf",
      description="Payment for product",
      metadata={"orderId": "1234"}
  ))
  ```

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

  use Yabetoo\Yabetoo;

  $yabetoo = new Yabetoo("YOUR_SECRET_KEY");

  $paymentIntent = $yabetoo->payments->create([
      "amount" => 2000,
      "currency" => "xaf",
      "description" => "Payment for product",
      "metadata" => ["orderId" => "1234"],
  ]);
  ```

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

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

  Yabetoo yabetoo = new Yabetoo(config);

  PaymentIntentRequest request = PaymentIntentRequest.builder()
      .amount(2000)
      .currency("xaf")
      .description("Payment for product")
      .putMetadata("orderId", "1234")
      .build();

  PaymentIntent paymentIntent = yabetoo.paymentIntents().create(request);
  ```
</CodeGroup>

## Response

### 200 OK

```json theme={null}
{
  "amount": 10000,
  "currency": "xaf",
  "description": "Payment for product",
  "metadata": {
    "orderId": "orderId-22"
  },
  "accountId": "acct_xsd",
  "liveMode": false,
  "label": "payment_intent",
  "id": "pi_OYgGCdY1VaWvszwZcAY7VXvuXI70Ao9rsuMl",
  "createdAt": "2026-02-16T15:33:55.048+00:00",
  "updatedAt": "2026-02-16T15:33:55.062+00:00",
  "clientSecret": "pi_OYgGCdY1VaWvszwZcAY7VXvuXI70Ao9rsuMl_secret_JYtxzKNhuwDCilaH72rEtMGuAlJl29qYAnOe"
}
```

### 422 Bad Request

```json theme={null}
{
  "errors": [
    {
      "rule": "required",
      "field": "currency",
      "message": "required validation failed"
    }
  ]
}
```

### 401 Unauthorized

```json theme={null}
{
  "error": "Unauthorized"
}
```
