Pay-in

Payment Intents

Un payment intent représente une intention d'encaissement.

Créer un paiement

POST /v1/payment_intents. Les montants sont des entiers en unité mineure.

Requête

curl https://api.validif.com/v1/payment_intents \
  -H "Authorization: Bearer vl_sec_xxxxx" \
  -H "Idempotency-Key: order_98231" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 250000,
    "currency": "XOF",
    "description": "Order 98231",
    "capture_method": "automatic"
  }'

Réponse 201

{
  "id": "pi_3f81b2c9",
  "reference": "pay_98231_af12",
  "amount": 250000,
  "currency": "XOF",
  "state": "created",
  "checkout_url": "https://checkout.validif.com/pay_98231_af12",
  "request_id": "req_8f21c0d4"
}
ChampTypeDescription
amountintegerMontant en unité mineure, strictement positif.
currencystringCode ISO 4217. Défaut : devise du marchand (XOF).
descriptionstringLibellé libre affiché au checkout.
capture_methodautomatic | manualCapture immédiate après autorisation, ou capture différée.
Idempotency-KeyheaderObligatoire. Rejouable pendant 24 h.

Machine à états

Les transitions sont strictes ; toute transition non autorisée renvoie invalid_request.

created ──authorize──▶ authorized ──capture──▶ captured
   │                    │
   ├──fail──▶ failed    └──cancel──▶ canceled
   └──cancel──▶ canceled
ChampTypeDescription
createdstateIntention créée, en attente du moyen de paiement.
authorizedstateFonds autorisés, capture possible.
capturedstateEncaissement confirmé. État terminal.
canceledstateAnnulé avant capture. État terminal.
failedstateRefus ou échec technique. État terminal.

Capturer

POST /v1/payment_intents/{id}/capture

curl -X POST \
  https://api.validif.com/v1/payment_intents/pi_3f81b2c9/capture \
  -H "Authorization: Bearer vl_sec_xxxxx" \
  -H "Idempotency-Key: capture_98231"

Annuler

POST /v1/payment_intents/{id}/cancel

curl -X POST \
  https://api.validif.com/v1/payment_intents/pi_3f81b2c9/cancel \
  -H "Authorization: Bearer vl_sec_xxxxx" \
  -H "Idempotency-Key: cancel_98231"

Récupérer / lister

GET

curl https://api.validif.com/v1/payment_intents/pi_3f81b2c9 \
  -H "Authorization: Bearer vl_sec_xxxxx"

curl "https://api.validif.com/v1/payment_intents?limit=25" \
  -H "Authorization: Bearer vl_sec_xxxxx"

Sécurité des données de carte

Aucun PAN ni CVV ne transite par votre serveur ni par vos journaux : la saisie a lieu sur la page de checkout hébergée par VALIDIF.