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

# Vue d'ensemble de l'intégration Navio

> Guide complet pour intégrer le système de paiement OneClick dans votre application

## Bienvenue sur Navio

OneClick Payment (Navio) vous permet d'accepter des paiements en ligne sécurisés en Algérie avec un minimum d'effort d'intégration. Créez des liens de paiement, suivez les transactions et gérez vos fonds - le tout via notre API simple.

<CardGroup cols={2}>
  <Card title="Configuration rapide" icon="rocket" color="#0D9373">
    Démarrez en quelques minutes avec notre API simple
  </Card>

  <Card title="Paiements sécurisés" icon="shield-check" color="#0D9373">
    Sécurité bancaire propulsée par SATIM
  </Card>

  <Card title="Suivi en temps réel" icon="chart-line" color="#0D9373">
    Surveillez le statut des paiements en temps réel
  </Card>

  <Card title="Frais flexibles" icon="money-bill-wave" color="#0D9373">
    Choisissez qui paie les frais de transaction
  </Card>
</CardGroup>

## Ce que vous allez construire

En suivant ce guide, vous implémenterez un flux de paiement complet :

1. **Le client crée une commande** dans votre application
2. **Votre système génère un lien de paiement** via l'API Navio
3. **Le client complète le paiement** sur la page de paiement sécurisée
4. **Votre système suit le statut du paiement** et traite la commande

## Prérequis

<Steps>
  <Step title="Compte OneClick">
    Créez un compte sur [app.oneclickdz.com](https://enterprise.oneclickdz.com/)
  </Step>

  <Step title="Validation marchand">
    Effectuez la validation marchand sur [Navio Merchant
    Info](https://enterprise.oneclickdz.com/profile)

    <Warning>
      Cette étape est **obligatoire** avant de pouvoir créer des liens de paiement
    </Warning>
  </Step>

  <Step title="Clé API">
    Obtenez votre clé API depuis le tableau de bord (utilisez la clé Sandbox pour les tests)
  </Step>

  <Step title="Prérequis techniques">
    * Serveur backend pour gérer les appels API - Base de données pour stocker les commandes et références de paiement - Compréhension de base des API REST
  </Step>
</Steps>

## Comment ça fonctionne

1. Le client passe une commande → Vous la sauvegardez comme `PENDING`
2. Vous appelez `/v3/ocpay/createLink` → Obtenez `paymentUrl` et `paymentRef`
3. **Sauvegardez `paymentRef` avec votre commande** (important !)
4. Redirigez le client vers `paymentUrl`
5. Le client paie → Retourne sur votre site
6. Vous vérifiez le statut avec `/v3/ocpay/checkPayment/:ref`
7. Mettez à jour la commande si le statut est `CONFIRMED`

## Concepts clés

<AccordionGroup>
  <Accordion title="Référence de paiement (paymentRef)" icon="hashtag">
    Identifiant unique pour chaque paiement (format : `OCPL-XXXXXX-YYYY`). Sauvegardez-le avec votre commande pour vérifier le statut ultérieurement.
  </Accordion>

  <Accordion title="Expiration du lien de paiement" icon="clock">
    Les liens expirent après 20 minutes. Créez un nouveau lien si le client doit réessayer.
  </Accordion>

  <Accordion title="Vérification du statut" icon="rotate">
    Vérifiez le statut du paiement lorsque le client revient sur votre site ou lorsque votre tâche cron s'exécute toutes les 20 minutes.
  </Accordion>
</AccordionGroup>

## Structure des frais

<Info>
  **Frais réduits :** 0% en conservant le solde sur OneClick, seulement 1% au retrait
</Info>

Vous pouvez choisir qui paie les frais de retrait :

| Mode de frais  | Description                   | Cas d'usage                 |
| -------------- | ----------------------------- | --------------------------- |
| `NO_FEE`       | Vous absorbez tous les frais  | Meilleure expérience client |
| `SPLIT_FEE`    | Partage 50/50                 | Responsabilité partagée     |
| `CUSTOMER_FEE` | Le client paie tous les frais | Maximisez votre profit      |

## Étapes d'intégration

Suivez ces guides dans l'ordre :

<CardGroup cols={2}>
  <Card title="1. Configuration marchand" icon="user-check" href="/fr/ocpay-guides/1-merchant-setup">
    Complétez la validation marchand et obtenez votre clé API
  </Card>

  <Card title="2. Flux de paiement" icon="diagram-project" href="/fr/ocpay-guides/2-payment-flow">
    Implémentez l'intégration de paiement complète
  </Card>

  <Card title="3. Suivi du statut" icon="clock-rotate-left" href="/fr/ocpay-guides/3-status-polling">
    Suivez les paiements et mettez à jour le statut des commandes
  </Card>

  <Card title="4. Bonnes pratiques" icon="star" href="/fr/ocpay-guides/4-best-practices">
    Conseils pour la production et gestion des erreurs
  </Card>
</CardGroup>

## Démarrage rapide

<CodeGroup>
  ```javascript Node.js theme={null}
  const fetch = require("node-fetch");

  // Créer un lien de paiement
  async function createPayment(orderId, amount, title) {
    const response = await fetch(
      "https://api.oneclickdz.com/v3/ocpay/createLink",
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "X-Access-Token": process.env.ONECLICK_API_KEY,
        },
        body: JSON.stringify({
          productInfo: { title, amount },
          redirectUrl: `https://yoursite.com/orders/${orderId}`,
        }),
      }
    );

    const data = await response.json();

    // Sauvegardez paymentRef avec votre commande !
    await db.orders.update(orderId, {
      paymentRef: data.data.paymentRef,
    });

    return data.data.paymentUrl; // Redirigez le client ici
  }

  // Check payment status
  async function checkPayment(paymentRef) {
    const response = await fetch(
      `https://api.oneclickdz.com/v3/ocpay/checkPayment/${paymentRef}`,
      { headers: { "X-Access-Token": process.env.ONECLICK_API_KEY } }
    );

    const data = await response.json();
    return data.data.status; // PENDING, CONFIRMED, ou FAILED
  }
  ```

  ```python Python theme={null}
  import requests
  import os

  # Créer un lien de paiement
  def create_payment(order_id, amount, title):
      response = requests.post(
          'https://api.oneclickdz.com/v3/ocpay/createLink',
          headers={
              'Content-Type': 'application/json',
              'X-Access-Token': os.getenv('ONECLICK_API_KEY')
          },
          json={
              'productInfo': {'title': title, 'amount': amount},
              'redirectUrl': f'https://yoursite.com/orders/{order_id}'
          }
      )

      data = response.json()

      # Sauvegardez paymentRef avec votre commande !
      db.orders.update(order_id, {
          'paymentRef': data['data']['paymentRef']
      })

      return data['data']['paymentUrl']  # Redirigez le client ici

  # Check payment status
  def check_payment(payment_ref):
      response = requests.get(
          f'https://api.oneclickdz.com/v3/ocpay/checkPayment/{payment_ref}',
          headers={'X-Access-Token': os.getenv('ONECLICK_API_KEY')}
      )

      data = response.json()
      return data['data']['status']  # PENDING, CONFIRMED, ou FAILED
  ```

  ```php PHP theme={null}
  <?php

  // Créer un lien de paiement
  function createPayment($orderId, $amount, $title) {
      $ch = curl_init('https://api.oneclickdz.com/v3/ocpay/createLink');
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_HTTPHEADER, [
          'Content-Type: application/json',
          'X-Access-Token: ' . getenv('ONECLICK_API_KEY')
      ]);
      curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
          'productInfo' => ['title' => $title, 'amount' => $amount],
          'redirectUrl' => "https://yoursite.com/orders/$orderId"
      ]));

      $response = curl_exec($ch);
      $data = json_decode($response, true);

      // Sauvegardez paymentRef avec votre commande !
      $db->orders->update($orderId, [
          'paymentRef' => $data['data']['paymentRef']
      ]);

      return $data['data']['paymentUrl']; // Redirigez le client ici
  }

  // Check payment status
  function checkPayment($paymentRef) {
      $ch = curl_init("https://api.oneclickdz.com/v3/ocpay/checkPayment/$paymentRef");
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_HTTPHEADER, [
          'X-Access-Token: ' . getenv('ONECLICK_API_KEY')
      ]);

      $response = curl_exec($ch);
      $data = json_decode($response, true);

      return $data['data']['status']; // PENDING, CONFIRMED, ou FAILED
  }
  ?>
  ```
</CodeGroup>

## Support et ressources

<CardGroup cols={2}>
  <Card title="Référence API" icon="book" href="/fr/api-reference/ocpay/create-link">
    Documentation API détaillée
  </Card>

  <Card title="Contacter le support" icon="headset" href="/fr/contact">
    Obtenez l'aide de notre équipe
  </Card>

  <Card title="Tableau de bord" icon="gauge" href="https://enterprise.oneclickdz.com/">
    Gérez votre compte
  </Card>

  <Card title="Guide de sécurité" icon="lock" href="/fr/security-best-practices">
    Sécurisez votre intégration
  </Card>
</CardGroup>

## Prochaine étape : Configuration marchand

Prêt à commencer ? Démarrez par la validation marchand :

<Card title="Démarrer l'intégration" icon="arrow-right" href="/fr/ocpay-guides/1-merchant-setup">
  Complétez la configuration et la validation marchand
</Card>
