1. Go to this page and download the library: Download camerpay/php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
camerpay / php-sdk example snippets
use CamerPay\CamerPay;
$camerpay = new CamerPay($_ENV['CAMERPAY_TOKEN']);
$tx = $camerpay->payments->initiate([
'amount' => 5000,
'currency' => 'XAF',
'payment_method' => 'orange_money',
'customer_phone' => '+237690000000',
'customer_email' => '[email protected]',
'merchant_invoice_id' => 'FACT-001',
'merchant_callback_url' => 'https://votre-site.com/webhooks/camerpay',
'merchant_return_url' => 'https://votre-site.com/merci',
]);
// Rediriger le client vers la page de paiement
header('Location: ' . $tx['pay_url']);
$tx = $camerpay->payments->status('5add2319-f71b-4f2d-a4f4-97fe0d11c1d4');
if ($tx['transaction']['status'] === 'completed') {
// Marquer la commande comme payée
}