Documentation API Démarrage

Démarrage

Créez votre compte, obtenez vos clés et effectuez votre premier paiement.

Prérequis

Étape 1 : Créez votre compte

Inscrivez-vous et renseignez vos informations. Notre équipe valide votre compte sous 24h.

S'inscrire

Étape 2 : Obtenez vos clés API

Depuis votre tableau de bord, générez vos clés API :

Note de sécurité La clé secrète n'est affichée qu'une seule fois. Stockez-la de manière sécurisée dans une variable d'environnement, jamais dans votre code source.

Étape 3 : Votre premier appel API

POST https://api.germinopay.com/v1/paiement/initier
curl -X POST https://api.germinopay.com/v1/paiement/initier \
  -H "Content-Type: application/json" \
  -H "X-Public-Key: pk_live_votre_cle_publique" \
  -H "X-Timestamp: 1730000000" \
  -H "X-Signature: hmac_sha256_signature" \
  -d '{
    "montant": 5000,
    "devise": "XOF",
    "fournisseur": "cinetpay",
    "reference": "CMD-1042",
    "client_email": "client@example.com",
    "return_url": "https://monsite.com/paiement/succes",
    "cancel_url": "https://monsite.com/paiement/annule"
  }'
<?php
$payload = [
    "montant"      => 5000,
    "devise"       => "XOF",
    "fournisseur"  => "cinetpay",
    "reference"    => "CMD-1042",
    "client_email" => "client@example.com",
    "return_url"   => "https://monsite.com/paiement/succes",
    "cancel_url"   => "https://monsite.com/paiement/annule",
];

$body = json_encode($payload);
$timestamp = time();
$signature = hash_hmac("sha256", "POST/v1/paiement/initier" . $body . $timestamp, $secretKey);

$ch = curl_init("https://api.germinopay.com/v1/paiement/initier");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Content-Type: application/json",
        "X-Public-Key: " . $publicKey,
        "X-Timestamp: " . $timestamp,
        "X-Signature: " . $signature,
    ],
    CURLOPT_POSTFIELDS => $body,
]);

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

if ($data["success"]) {
    header("Location: " . $data["data"]["payment_url"]);
    exit;
}
const crypto = require('crypto');

const payload = {
  montant: 5000,
  devise: "XOF",
  fournisseur: "cinetpay",
  reference: "CMD-1042",
  client_email: "client@example.com",
  return_url: "https://monsite.com/paiement/succes",
  cancel_url: "https://monsite.com/paiement/annule",
};

const body = JSON.stringify(payload);
const timestamp = Math.floor(Date.now() / 1000);
const signature = crypto
  .createHmac('sha256', process.env.GERMINOPAY_SECRET)
  .update(`POST/v1/paiement/initier${body}${timestamp}`)
  .digest('hex');

const res = await fetch('https://api.germinopay.com/v1/paiement/initier', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Public-Key': process.env.GERMINOPAY_PUBLIC,
    'X-Timestamp': timestamp,
    'X-Signature': signature,
  },
  body,
});

const data = await res.json();
if (data.success) {
  // Rediriger l'utilisateur
  console.log(data.data.payment_url);
}
import hashlib
import hmac
import json
import time
import requests

payload = {
    "montant": 5000,
    "devise": "XOF",
    "fournisseur": "cinetpay",
    "reference": "CMD-1042",
    "client_email": "client@example.com",
    "return_url": "https://monsite.com/paiement/succes",
    "cancel_url": "https://monsite.com/paiement/annule",
}

body = json.dumps(payload, separators=(',', ':'))
timestamp = int(time.time())
message = f"POST/v1/paiement/initier{body}{timestamp}"
signature = hmac.new(
    b"votre_cle_secrete",
    message.encode(),
    hashlib.sha256
).hexdigest()

response = requests.post(
    "https://api.germinopay.com/v1/paiement/initier",
    data=body,
    headers={
        "Content-Type": "application/json",
        "X-Public-Key": "pk_live_votre_cle_publique",
        "X-Timestamp": str(timestamp),
        "X-Signature": signature,
    }
)

data = response.json()
if data["success"]:
    print(data["data"]["payment_url"])
200 OK Réponse en cas de succès
{
  "success": true,
  "message": "Payment initiated",
  "data": {
    "reference": "GP-20251001-ABC123",
    "transaction_id": "txn_9f8e7d6c5b4a",
    "fournisseur": "cinetpay",
    "montant": 5000,
    "devise": "XOF",
    "frais": 75,
    "montant_net": 4925,
    "statut": "initie",
    "payment_url": "https://checkout.cinetpay.com/pay/GP-20251001-ABC123",
    "expires_at": "2025-10-01T14:30:00Z",
    "created_at": "2025-10-01T13:30:00Z"
  }
}

Étape 4 : Configurez votre webhook

Un webhook est un POST HTTP envoyé à votre serveur quand le statut d'un paiement change. Configurez-le une fois dans votre tableau de bord et nous vous notifierons automatiquement.

Pourquoi utiliser les webhooks ? Car les redirections peuvent être annulées par l'utilisateur. Les webhooks garantissent la livraison même si l'utilisateur ferme le navigateur.

Voir le guide complet → Webhooks

Et ensuite ?