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

# Get Payment Intent

> Retrieve a payment intent by its ID.

## Endpoint

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

## Authentication

Use your secret key in the `Authorization` header:

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

## Path Parameters

| Parameter | Type     | Description           |
| --------- | -------- | --------------------- |
| `id`      | `string` | The payment intent ID |

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl https://pay.sandbox.yabetoopay.com/v1/payment-intents/pi_XdLeavDjiiaEx2y5nRz0 \
    -H "Authorization: Bearer YOUR_SECRET_KEY"
  ```

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

  const yabetoo = new Yabetoo("YOUR_SECRET_KEY");

  const paymentIntent = await yabetoo.payments.retrieve("pi_XdLeavDjiiaEx2y5nRz0");
  ```

  ```python Python theme={null}
  from yabetoo import Yabetoo

  yabetoo = Yabetoo("YOUR_SECRET_KEY")

  payment_intent = yabetoo.payments.retrieve("pi_XdLeavDjiiaEx2y5nRz0")
  ```

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

  use Yabetoo\Yabetoo;

  $yabetoo = new Yabetoo("YOUR_SECRET_KEY");

  $paymentIntent = $yabetoo->payments->retrieve("pi_XdLeavDjiiaEx2y5nRz0");
  ```

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

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

  Yabetoo yabetoo = new Yabetoo(config);

  PaymentIntent paymentIntent = yabetoo.paymentIntents().retrieve("pi_XdLeavDjiiaEx2y5nRz0");
  ```
</CodeGroup>

## Response

### 200 OK

```json theme={null}
{
  "amount": 2000,
  "currency": "xaf",
  "label": "payment_intent",
  "id": "pi_XdLeavDjiiaEx2y5nRz0",
  "status": "succeeded",
  "client_secret": ""
}
```

### Payment Intent Status

| Status                    | Description                    |
| ------------------------- | ------------------------------ |
| `requires_payment_method` | Waiting for payment method     |
| `requires_confirmation`   | Waiting for confirmation       |
| `processing`              | Payment is being processed     |
| `succeeded`               | Payment completed successfully |
| `failed`                  | Payment failed                 |
| `canceled`                | Payment was canceled           |

### 404 Not Found

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

### 401 Unauthorized

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