Introduction

Cette section décrit Corena Payme l'API de la passerelle de paiement.


Corena Payme The PaymentHub API is simple to integrate into your company's software. Our API takes cURL requests, has well-formatted URLs, and produces JSON responses.

The API can be used in test mode without affecting your real data. The request is authenticated using the API key, which also establishes whether the payment is legitimate or not. For test mode just use the sandbox URL and In case of live mode use the live URL from section Initier le paiement .

Devises prises en charge

Les devises prises en charge par Corena Payme sont listées ci-dessous.


Devise Symbole monétaire
USD $

Obtenir la clé API

Comment obtenir la clé API est expliqué ici.


Pour accéder à votre Corena Payme merchant account, please log in. In case you don't have an account, you can cliquer ici.

Rendez-vous maintenant dans Account > Settings > API Key depuis le panneau marchand.

Vous y trouverez les clés API : Clé publique et clé secrète. Utilisez ces clés pour vos requêtes API. Vous pouvez en générer de nouvelles à tout moment en cliquant sur Générer une clé API . Ne partagez jamais ces clés.

Initier le paiement

Cette section explique comment initier un paiement.


To begin the payment process, use the sample code provided, and pay close attention to the parameters. The API endpoints mentioned below will need to be used to make the request.

Endpoint en production : https://www.corenapayme.com/payment/initiate

Endpoint de test : https://www.corenapayme.com/test/payment/initiate

Envoyez une requête avec les paramètres suivants :

Nom du paramètre Type Description
public_key string (50) Obligatoire Votre clé API publique
identifier string (20) Obligatoire Identifiant pour reconnaître le paiement côté client
currency string (4) Obligatoire Code devise en majuscules (ex: USD, EUR)
amount decimal Obligatoire Montant du paiement
details string (100) Obligatoire Détails du paiement
ipn_url string Obligatoire URL de notification instantanée (IPN)
success_url string Obligatoire URL de redirection après succès
cancel_url string Obligatoire URL de redirection après annulation
site_name string Obligatoire Nom de votre site
site_logo string/url Optionnel Logo de votre site
checkout_theme string Optionnel Thème clair/sombre du formulaire (par défaut clair)
Client
customer[] tableau Obligatoire customer doit être un tableau
customer.first_name string Obligatoire Customer's first name
customer.last_name string Obligatoire Customer's last name
customer.email string Obligatoire Customer's valid email
customer.mobile string Obligatoire Customer's valid mobile
Informations de livraison
shipping_info[] tableau Optionnel shipping_info doit être un tableau
shipping_info.address_one string Optionnel Customer's address one
shipping_info.address_two string Optionnel Customer's address two
shipping_info.area string Optionnel Quartier de livraison
shipping_info.city string Optionnel Ville de livraison
shipping_info.sub_city string Optionnel Sous-ville de livraison
shipping_info.state string Optionnel État/Région de livraison
shipping_info.postcode string Optionnel Code postal de livraison
shipping_info.country string Optionnel Pays de livraison
shipping_info.others string Optionnel Autres informations
Informations de facturation
billing_info[] tableau Optionnel billing_info doit être un tableau
billing_info.address_one string Optionnel Customer's address one
billing_info.address_two string Optionnel Customer's address two
billing_info.area string Optionnel Quartier de facturation
billing_info.city string Optionnel Ville de facturation
billing_info.sub_city string Optionnel Sous-ville de facturation
billing_info.state string Optionnel État/Région de facturation
billing_info.postcode string Optionnel Code postal de facturation
billing_info.country string Optionnel Pays de facturation
billing_info.others string Optionnel Autres informations
Exemple de code PHP
<?php
    $parameters = [
        'identifier' => 'DFU80XZIKS',
        'currency' => 'USD',
        'amount' => 11.00,
        'gateway_methods' => [
            // Please write the name of the gateway method you want to use
        ],
        'details' => 'Purchase T-shirt',
        'ipn_url' => 'http://example.com/ipn_url.php',
        'cancel_url' => 'http://example.com/cancel_url.php',
        'success_url' => 'http://example.com/success_url.php',
        'public_key' => 'your_public_key',
        'site_name' => 'your_site_name',
        'site_logo' => 'http://yoursite.com/logo.png',
        'checkout_theme' => 'light',
        'customer'=>[
            'first_name'=>'John',
            'last_name'=>'Doe',
            'email'=>'joan@gmail.com',
            'mobile'=>'12345789',
        ],
        'shipping_info'=>[
            'address_one'=>'',
            'address_two'=>'',
            'area'=>'',
            'city'=>'',
            'sub_city'=>'',
            'state'=>'',
            'postcode'=>'',
            'country'=>'',
            'others'=>'',
        ],
        'billing_info'=>[
            'address_one'=>'',
            'address_two'=>'',
            'area'=>'',
            'city'=>'',
            'sub_city'=>'',
            'state'=>'',
            'postcode'=>'',
            'country'=>'',
            'others'=>'',
        ]
    ];

    $parameters = http_build_query($parameters);

    //live end point
    $url = 'https://www.corenapayme.com/payment/initiate';

    //test end point
    $url = 'https://www.corenapayme.com/test/payment/initiate';

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS,  $parameters);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    curl_close($ch);

?>
Exemples de réponses
//Error Response.
{
    "status": "error",
    "message": [
        "Invalid api key"
    ]
}

//Success Response.
{
    "status": "success",
    "message": [
        "Payment initiated"
    ],
    "redirect_url": "https://example.com/payment/checkout?payment_trx=eyJpdiI6IkFyNllSNU1lOFdkYTlPTW52cytPNGc9PSIsInZhbHVlIjoiWWowRTRjdzZ1S1BBRm4ydS81OWR1WjdXeFIxcjE1WkZRVE9BcmZYeXpzND0iLCJtYWMiOiJjNDdhODUzYzY2NmZlZGJjZTI5ODQyMmRkYzdjYjRmM2NiNjg4M2RiMWZjN2EyMzFkODI4OWMwYjk3ZWYwNGQwIiwidGFnIjoiIn0%3D"
}

Valider le paiement et l'IPN

Cette section explique comment recevoir la notification instantanée de paiement.


To initiate the payment follow the example code and be careful with the perameters. You will need to make request with these following API end points.

Endpoint : URL IPN de votre application.

Méthode : POST

Vous recevrez les paramètres suivants :

Nom du paramètre Description
status Statut de succès du paiement.
identifier Identifiant pour reconnaître le paiement côté client.
signature Signature de vérification du paiement.
data Données contenant les informations de base (frais, montant, devise, ID de transaction, etc.)
Exemple de code PHP
<?php
    //Receive the response parameter
    $status = $_POST['status'];
    $signature = $_POST['signature'];
    $identifier = $_POST['identifier'];
    $data = $_POST['data'];

    // Generate your signature
    $customKey = $data['amount'].$identifier;
    $secret = 'YOUR_SECRET_KEY';
    $mySignature = strtoupper(hash_hmac('sha256', $customKey , $secret));

    $myIdentifier = 'YOUR_GIVEN_IDENTIFIER';

    if($status == "success" && $signature == $mySignature &&  $identifier ==  $myIdentifier){
        //your operation logic
    }
?>

We may use cookies or any other tracking technologies when you visit our website, including any other media form, mobile website, or mobile application related or connected to help customize the Site and improve your experience. en savoir plus

Autoriser