1 - Créer le lien de paiement

Étape 1 : Créer un lien de paiement

Une URL unique qui redirige vos clients vers une page de paiement sécurisée.

Le lien de paiement est une URL qui affiche la page de paiement en ligne. L’URL de base à invoquer pour initier le paiement dépend de l’environnement utilisé. Voici un exemple de structure d’URL permettant à votre client de démarrer un paiement :

Structure de l’URL :

https://pay.centralbill.app/?applicationId=<applicationId>&invoice[id]=1&invoice[customerId]=<customerId>&invoice[totalAmount][amount]=100&invoice[totalAmount][currency]=XOF&invoice[issuedAt]=<issuedAt>&invoice[dueDate]=<dueDate>&invoice[expiresAt]=<expiresAt>&description=<description>&signature=<signature>&callbackUrl=<callbackUrl>&redirectUrl=<redirectUrl>

Required Fields:

Field Name

Type

Description

applicationId

String

The merchant application identifier.

invoice[id]

String

The unique identifier for the invoice.

invoice[customerId]

String

The customer identifier (email recommended).

invoice[totalAmount]

Float

Total amount for the invoice.

invoice[totalAmount]

String

Currency (ISO 4217 format, e.g., XOF).

invoice[issuedAt]

String

Invoice issue date (ISO 8601 format).

invoice[dueDate]

String

Invoice due date (ISO 8601 format).

invoice[expiresAt]] (Optional)

String

The date when the invoice will expire (ISO 8601 format)

description

String

A description for the payment.

signature

String

Signature generated from the data.

callbackUrl (optional)

String

URL for receiving IPN notifications.

redirectUrl (optional)

String

URL for customer redirection after payment.

https://pay.centralbill.app/?applicationId=fbab3ccc-719e-11ed-93ad-02420a0003c1&invoice%5Bid%5D=1&invoice%5BcustomerId%5D=johndoe%40example.com&invoice%5BtotalAmount%5D%5Bamount%5D=100&invoice%5BtotalAmount%5D%5Bcurrency%5D=XOF&invoice%5BissuedAt%5D=2022-12-12T00%3A00%3A00%2B00%3A00&invoice%5BdueDate%5D=1970-01-01T00%3A00%3A00%2B00%3A00&invoice%5BexpiresAt%5D=2023-12-12T00%3A00%3A00%2B00%3A00&description=ACME+-+Facture+%23107285&signature=9407f193b8a53f68e6184ef28cffc7a7524cff81d6e6dd76a4c624b990a3e1cf&callbackUrl=https%3A%2F%2Facme.net%2Fmodules%2Fgateways%2Fcallback%2Fcentralbill.php&redirectUrl=https%3A%2F%2Facme.net%2Fviewinvoice.php%3Fid%3D1

Generate a Signature (PHP):

To generate a payment signature you must combine the following payment informations : application.id,invoice.id , invoice.customerid, invoice.totalAmount.amount, invoice.totalAmount.currencyandapplication.secret. The identifier and secret of the application can be retrieved from your administration console.

$applicationId = 'fbab3ccc-719e-11ed-93ad-02420a0003c1';
$applicationSecret = app!secret';
$invoiceId = '1';
$invoiceCustomerId = 'johndoe@example.com';
$invoiceTotalAmountAmount = 1000;
$invoiceTotalAmountCurrency = 'XOF';

$signature = hash('sha256', sprintf('%s,%s,%s,%s,%s,%s',
    $applicationId,  
    $invoiceId,  
    $invoiceCustomerId,  
    $invoiceTotalAmountAmount,  
    $invoiceTotalAmountCurrency,  
    $applicationSecret
));

Dernière mise à jour