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

# Récupérer une intention de paiement

> Récupérez une intention de paiement par son 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
```

## Authentification

Utilisez votre clé secrète dans l'en-tête `Authorization` :

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

## Paramètres de chemin

| Paramètre | Type     | Description                     |
| --------- | -------- | ------------------------------- |
| `id`      | `string` | L'ID de l'intention de paiement |

## Exemple de requête

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

## Réponse

### 200 OK

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

### Statuts de l'intention de paiement

| Statut                    | Description                       |
| ------------------------- | --------------------------------- |
| `requires_payment_method` | En attente de méthode de paiement |
| `requires_confirmation`   | En attente de confirmation        |
| `processing`              | Paiement en cours de traitement   |
| `succeeded`               | Paiement réussi                   |
| `failed`                  | Paiement échoué                   |
| `canceled`                | Paiement annulé                   |

### 404 Not Found

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

### 401 Unauthorized

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