Démarrer

Documentation Dernière mise à jour : 2024-04-25

MyPayGa utilise des clés API pour permettre l'accès à l'API. Vous pouvez enregistrer une nouvelle clé API MyPayGa dans votre tableau de bord.
MyPayGa s'attend à ce que la clé API soit incluse dans toutes les requêtes API au serveur dans un paramètre.

Intégration rapides :

Vous souhaitez utiliser MYPAYGA sans coder découvrez comment vous pouvez profiter de MYPAYGA sans avoir à taper une seule ligne de code.

Accédez à vos API

Afin d'accéder à vos API, vous devez vous inscrire sur MYPAYGA. Cliquez ici pour créer un compte.

Une fois connecté, suivez ces étapes :
  1. Accédez à l'onglet API.
  2. Sélectionnez l'environnement que vous souhaitez utiliser.
Remarques :

Note

Vous devriez avoir renseingné les informations de votre entreprise afin de débloquer les API. Si vous n'avez pas les droits, merci de contacter votre adminnistrateur.
En cas de problèmes Contactez-nous.

Changez d'environnement

Vous pouvez tester MYPAYGA jusqu'à satisfaction, pour celal, vous disposez d'un environnement de test. Pour y accéder, rien de bien compliqué : basculez en mode test/production en un clic.

Environnements :
Données test Permet de passer en mode test.La section API affiche les api du mode test.
Données production Permet de passer en mode production. La section API affiche les api du mode production.

Données tests

Données de tests

Mobile Money :
Numéro Code Statut Message Opérateur
074111111 200 Success Trans ID: MPDDDD.YYYY.A3XXX. Votre PAIEMENT de XXXX FCFA a MTECH pour reference Testing transaction a ete effectue avec succes. Airtel Money
074121212 200 Success Payment success Airtel Money
074131313 400 Failed Dear customer,you have insuffient funds. Thank you. Airtel Money
650121212 200 Success Trans ID: MPDDDD.YYYY.A3XXX. Votre PAIEMENT de XXXX FCFA a MTECH pour reference Testing transaction a ete effectue avec succes. Orange Money
650131313 400 Failed Dear customer,you have insuffient funds. Thank you. Orange Money
242056549200 200 Success Payment success Airtel Money
242056549400 400 Failed Dear customer,you have insuffient funds. Thank you. Airtel Money
09306315 400 Failed Dear customer,you have insuffient funds. Thank you. Orange Money
09306316 200 Success Payment success OM CI Orange Money
07306316 200 Success Payment success OM CI Orange Money
074151522 200 Success Payment success Airtel Money
077508412 200 Success Payment success Airtel Money

Cartes bancaires :
Numéro Code Statut Message Opérateur
4285220922286457 200 Success PAYMENT SUCCESS visa
4242937137682335 200 Refus solde ins PAYMENT FAILED, INSUF FUND visa
4005075690593537 200 Refus Risk PAYMENT DECLINED, CONTACT YOUR BANK. visa
4102972145002274 200 Refus carte volée PAYMENT DECLINED, CONTACT YOUR BANK. visa
5335406367416736 200 Acceptée avec Risk PAYMENT SUCCESS mastercard

Paiements Airtel Money

Préréquis

Afin d'accepter les paiements, vous devriez avant tout déclarer une url de callback. Elle sera utilisée pour vous transmettre le statut final du paiement.

Paramètres Type Obligatoire Exemple de valeur
email String Oui client@gmail.com
firstname String Oui Jacob
lastname String Oui Larry
payment_token String Oui wYtzohguhoeighlzY65lhsi
amount Int Oui 2400
client_phone String Oui 07000000
description Text Oui The purpose of the payment
apikey String Oui sprod_xxxxxxxxxxx

Paiement

POST https://api.mypayga.com/mpayment/payment-request
Requête
$curl = curl_init();$apikey='sprod_XXXXXXXXXXX';
$postfields = array(
	"email" => 'client-examle@mail.com',
	"firstname" =>'Client Fname',
	"lastname" =>'Client Lname',
	"amount" => 100,
	"client_phone"=>'074000000',
	"apikey" => $apikey,
	"description"=>'Sample description',
	"payment_token"=>wYtzohguhoeighlzY65lhsi
);


$curl = curl_init();
	curl_setopt_array($curl, array(
	CURLOPT_URL => $baseUrl,
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_FOLLOWLOCATION=>true,
	CURLOPT_ENCODING => "",
	CURLOPT_MAXREDIRS => -1,
	CURLOPT_TIMEOUT => 60,
	CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	CURLOPT_CUSTOMREQUEST => "POST",
	CURLOPT_POSTFIELDS => $postfields,
CURLOPT_HTTPHEADER =>array(1),
));

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
Réponse

{
    "message": "Request Sent.Please Wait.",
    "payment_token": "eagE7x1884MLgyj9MqIAAy4yb",
    "description": "Paiement - MTECH",
    "statusRequest": "200",
    "transaction": {
        "amount": 100,
        "country": "GA",
        "currency": "CFA",
        "id": "1131AJS"
    }
}

Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.mypayga.com/mpayment/payment-request?apikey=stest_xxxxx
&client_phone=077000000
&description=Description
&lastname=ClientLname,
&amount=100
&payment_token=wYtzohguhoeighlzY65lhsi");

xhr.send();
Réponse
{
    "message": "Request Sent.Please Wait.",
    "payment_token": "eagE7x1884MLgyj9MqIAAy4yb",
    "description": "Paiement - MTECH",
    "statusRequest": "200",
    "transaction": {
        "amount": 100,
        "country": "GA",
        "currency": "CFA",
        "id": "1131AJS"
    }
}
Requête
import http.client
conn = http.client.HTTPSConnection("api.mypayga.com")
payload = ''
headers = {}
conn.request("POST", "/mpayment/payment-request?apikey=stest_xxxx
&client_phone=076574654
&description=Description
&lastname=ClientLname
payment_token=wYtzohguhoeighlzY65lhsi
&amount=100", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Réponse
{
    "message": "Request Sent.Please Wait.",
    "payment_token": "eagE7x1884MLgyj9MqIAAy4yb",
    "description": "Paiement - MTECH",
    "statusRequest": "200",
    "transaction": {
        "amount": 100,
        "country": "GA",
        "currency": "CFA",
        "id": "1131AJS"
    }
}

Transfert

Transférer des fonds vers un client ou un partenaire. Vous avez une markteplace ? Vous souhaitez rembourser un client? Cette option est faite pour vous.

POST https://api.mypayga.com/mpayment/sendClientTransfert
Requête
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mypayga.com/mpayment/sendClientTransfert
  ?amount=100&receiver_phone=074XXXXX
  &country=GA&apikey=sprod_xxxxxxxx&type_clt=client',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse
{
    "message": "Vous avez envoye 100 FCFA à 074XXXXX.",
    "description": "Balance Transfert to client",
    "statusRequest": "200",
    "transfert": {
        "transfert_status": "200",
        "amount": "100",
        "transfert_id": "16sI2OpZHGZ",
        "country": "GA",
        "currency": "CFA"
    }
}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.mypayga.com/mpayment/sendClientTransfert?
amount=100&receiver_phone=074XXXXX
&country=GA
&apikey=sprod_xxxxxxxx&type_clt=client");

xhr.send();
Réponse
{
    "message": "Vous avez envoye 100 FCFA à 074XXXXX.",
    "description": "Balance Transfert to client",
    "statusRequest": "200",
    "transfert": {
        "transfert_status": "200",
        "amount": "100",
        "transfert_id": "16sI2OpZHGZ",
        "country": "GA",
        "currency": "CFA"
    }
}
Requête
import http.client

conn = http.client.HTTPSConnection("api.mypayga.com")
payload = ''
headers = {}
conn.request("POST", "/mpayment/sendClientTransfert?amount=100
&receiver_phone=074XXXXX&country=GA
&apikey=sprod_XXxxxxxx
&type_clt=client", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Réponse
{
    "message": "Vous avez envoye 100 FCFA à 074XXXXX.",
    "description": "Balance Transfert to client",
    "statusRequest": "200",
    "transfert": {
        "transfert_status": "200",
        "amount": "100",
        "transfert_id": "16sI2OpZHGZ",
        "country": "GA",
        "currency": "CFA"
    }
}

Paiement carte bancaire

Acceptez les paiements par carte bancaire sur vote plateforme.

Préréquis

Afin d'accepter les paiements par carte, vous devriez avant tout déclarer vos urls de Succès et d'échec. Votre url de callback sera utilisée pour vous transmettre le statut final du paiement.

Votre formulaire de paiment doit contenir au moins le payment_token et votre clé API publique.

POST https://www.mypayga.com/mpgga-form-cbpay
Requête

Le client sera redirigé vers le formulaire hébergé de notre partenaire bancaire.

									"FormData": {"payment_token": "200","apikey": "pprod_xxxxx"}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.mypayga.com/mpayment/payment-request?apikey=stest_xxxxx
&client_phone=077000000
&description=Description
&mpga_uniqueId=123456&amount=100");

xhr.send();
Réponse

WIP

Requête
import http.client
conn = http.client.HTTPSConnection("api.mypayga.com")
payload = ''
headers = {}
conn.request("POST", "/mpayment/payment-request?apikey=stest_xxxx
&client_phone=076574654
&description=Description
&mpga_uniqueId=211951
&amount=100", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Réponse

WIP

Hash et Token

Lors de l'envoi du formulaire ou de toute requête de paiement, un hash et un payment_token (une référence interne de MYPAYGA) doivent être générés.

Paramètres :

Paramètre Type Obligatoire Exemple de valeur
email String Oui client@gmail.com
firstname String Oui Jacob
lastname String Oui Larry
uniqueID String Oui 2345
amount Int Oui 2400
phone String Oui 07000000
description Text Oui The purpose of the payment
apikey String Oui sprod_xxxxxxxxxxx
POST https://api.mypayga.com/payment/gethash
Requête

Génération du hash et du payment_token.

$postfields = array( 
    "email" => 'client@gmail.com',
    "firstname" =>'Client firstname',
    "lastname" => 'Client lastname',
    "uniqueID" => 12345,
    "amount" => 1500,
    "phone"=>'07000000',
    "apikey" => 'sprod_xxxxxxxxxxx',
    "description"=>'The purpose of the payment'
);
$baseUrl='https://api.mypayga.com/payment/gethash';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $baseUrl);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postfields);

$response = json_decode(curl_exec($curl));
$hash=$response->hash;
$payment_token=$response->payment_token;
curl_close($curl);
Réponse
{
    "code": "200",
    "message": "References created successfully",
    "hash": "797cb06dacec43b4861a4637759653a2cb126f4f2f4d3d4c4913edadb583a05bf1029",
    "payment_token": "Cr83WMcojwcAnGjMB1U5cGCHY",
    "uniqueID": "1234A"
}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.mypayga.com/payment/gethash?
email=m@m.com&firstname=Fname
&lastname=Lname&uniqueID=1234A&amount=1500
&apikey=ptest_xxxxdXS
&description=Description test
&phone=07000000");
xhr.send();
Réponse
{
    "code": "200",
    "message": "References created successfully",
    "hash": "797cb06dacec43b4861a4637759653a2cb126f4f2f4d3d4c4913edadb583a05bf1029",
    "payment_token": "Cr83WMcojwcAnGjMB1U5cGCHY",
    "uniqueID": "1234A"
}
Requête
iimport http.client
conn = http.client.HTTPSConnection("api.mypayga.com")
payload = ''
headers = {}
conn.request("POST", "/payment/gethash?email=m@m.com
&firstname=Fname&lastname=Lname
&uniqueID=1234A&amount=1500
&apikey=ptest_xxxxxx&description=Description test
&phone=07000000", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Réponse
{
    "code": "200",
    "message": "References created successfully",
    "hash": "797cb06dacec43b4861a4637759653a2cb126f4f2f4d3d4c4913edadb583a05bf1029",
    "payment_token": "Cr83WMcojwcAnGjMB1U5cGCHY",
    "uniqueID": "1234A"
}

Suivi des transactions.

Consultez les de vos transactions via API (pour des transactions finalisées).

Détails d'un paiement

GET https://api.mypayga.com/payment/paiement-detail
Requête
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mypayga.com/payment/paiement-detail?
  payment_ref=eI4zOJd5uE2W5qx7
  &apikey=pprod_lsdzmbzfezt',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse
{"payment": [
        {
            "merchand_ref": "9745",
            "payment_token": "eI4zUOJd5uE2W5qx7Em1HOTr00lev7rvt6E",
            "paymentMethod": "Mobile Money",
            "mobile_callback": 1,
            "OrderStatus": "200",
            "message_data": "Success",
            "totalAmount": 144,
            "clientNumber": "074151522",
            "orderDateTime": "2021-05-15 21:53:38",
            "pmt_banque": "AM",
            "last_4_digits": "0000",
            "nom_prenom_client": null,
            "frais_transaction": 154.032,
            "montant_net": -10.03,
            "final_status": "200"
        }
    ],
    "code": "200",
    "final_status": "200",
    "merchand_ref": "9745",
    "environnement": "production"
}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.mypayga.com/payment/paiement-detail?
payment_ref=HOTr00lev7rvt6E&apikey=pprod_sqhvdkhsqkzt");

xhr.send();
Réponse
{
    "payment": [
        {
            "merchand_ref": "9745",
            "payment_token": "eI4zUOJd5uE2W5qx7Em1HOTr00lev7rvt6E",
            "paymentMethod": "Mobile Money",
            "mobile_callback": 1,
            "OrderStatus": "200",
            "message_data": "Success",
            "totalAmount": 144,
            "clientNumber": "074151522",
            "orderDateTime": "2021-05-15 21:53:38",
            "pmt_banque": "AM",
            "last_4_digits": "0000",
            "nom_prenom_client": null,
            "frais_transaction": 154.032,
            "montant_net": -10.03,
            "final_status": "200"
        }
    ],
    "code": "200",
    "final_status": "200",
    "merchand_ref": "9745",
    "environnement": "production"
}
Requête
import http.client
conn = http.client.HTTPSConnection("api.mypayga.com")
payload = ''
headers = {}
conn.request("GET", "/payment/paiement-detail?payment_ref=eI4zUev7rvt6E
&apikey=pprod_KGNqhkdvze74t", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Réponse
{
    "payment": [
        {
            "merchand_ref": "9745",
            "payment_token": "eI4zUOJd5uE2W5qx7Em1HOTr00lev7rvt6E",
            "paymentMethod": "Mobile Money",
            "mobile_callback": 1,
            "OrderStatus": "200",
            "message_data": "Success",
            "totalAmount": 144,
            "clientNumber": "074151522",
            "orderDateTime": "2021-05-15 21:53:38",
            "pmt_banque": "AM",
            "last_4_digits": "0000",
            "nom_prenom_client": null,
            "frais_transaction": 154.032,
            "montant_net": -10.03,
            "final_status": "200"
        }
    ],
    "code": "200",
    "final_status": "200",
    "merchand_ref": "9745",
    "environnement": "production"
}

Statut d'un transfert

GET https://api.mypayga.com/mpayment/getClientTransfert
Requête
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mypayga.com/mpayment/getClientTransfert?
  trans_ref=184528Hp2bj&apikey=pprod_sbllaz53fJpgFCuVetPx15pfq8',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse
{
    "status": "200",
    "message": "Transaction found",
    "data": [
        {
            "montant_demande": "23000",
            "statut_demande": "Echec-solde ins.",
            "date_demande": "2021-11-05 13:20:52",
            "numero_de_compte": "074654326,
            "description": "Transfert client",
            "type_destinataire": "client"
        }
    ]
}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.mypayga.com/mpayment/getClientTransfert?
trans_ref=18452CN8Hp2bj
&apikey=sprod_Ne9DHYqsklablx15q8");

xhr.send();
Réponse
{
    "status": "200",
    "message": "Transaction found",
    "data": [
        {
            "montant_demande": "23000",
            "statut_demande": "Echec-solde ins.",
            "date_demande": "2021-11-05 13:20:52",
            "numero_de_compte": "074654326,
            "description": "Transfert client",
            "type_destinataire": "client"
        }
    ]
}
Requête
import http.client

conn = http.client.HTTPSConnection("api.mypayga.com")
payload = ''
headers = {}
conn.request("GET", "/mpayment/getClientTransfert?
trans_ref=zzN8Hp2bj&apikey=pprod_zavd53fJFCuVetPjba", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Réponse
{
    "status": "200",
    "message": "Transaction found",
    "data": [
        {
            "montant_demande": "23000",
            "statut_demande": "Echec-solde ins.",
            "date_demande": "2021-11-05 13:20:52",
            "numero_de_compte": "074654326,
            "description": "Transfert client",
            "type_destinataire": "client"
        }
    ]
}

Calcul des frais

Calculez les frais d'une transaction.


GET https://api.mypayga.com/mpayment/getFees
Requête
$curl = curl_init();
	curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mypayga.com/mpayment/getFees?
  apikey=spub_xjbzlzbazzpizeiad&ope=AM
  &country=GA',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse
{
    "message": "Request OK.",
    "statusRequest": 200,
    "fees": {
        "merchand_custom_fees": "0.0175",
        "standard_fees": "0.0175",
        "platform_fees": "0",
        "bank_fees": "0.01",
        "fees_source": "merchant",
        "short_partner": "AM",
        "cty_partner": "GA",
        "currency": "CFA"
    }
}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});
xhr.open("GET", "https://api.mypayga.com/mpayment/getFees?
apikey=sprod_xxxxx&ope=AM&country=GA");

xhr.send();
Réponse
{
    "message": "Request OK.",
    "statusRequest": 200,
    "fees": {
        "merchand_custom_fees": "0.0175",
        "standard_fees": "0.0175",
        "platform_fees": "0",
        "bank_fees": "0.01",
        "fees_source": "merchant",
        "short_partner": "AM",
        "cty_partner": "GA",
        "currency": "CFA"
    }
}
Requête
import http.client

conn = http.client.HTTPSConnection("api.mypayga.com")
payload = ''
headers = {}
conn.request("GET", "/mpayment/getFees?apikey=sprod_xxxxxx
&ope=AM&country=GA", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Réponse
{
    "message": "Request OK.",
    "statusRequest": 200,
    "fees": {
        "merchand_custom_fees": "0.0175",
        "standard_fees": "0.0175",
        "platform_fees": "0",
        "bank_fees": "0.01",
        "fees_source": "merchant",
        "short_partner": "AM",
        "cty_partner": "GA",
        "currency": "CFA"
    }
}

Créer un remboursement

Création d'une demande de remboursement.


POST https://api.mypayga.com/refund/create
Requête
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mypayga.com/refund/create?
  apikey=sprod_xxxxx&payment_token=xxx
  &amount=100&description=description',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse
{
    "message": "Refund created",
    "statusRequest": 200,
    "totalAmount": 100,
    "clientNumber": "07700000",
    "frais_transaction": 2.75,
    "updatedFees": 0,
    "refundId": "rfd_165533.IzkknzlJuU3p"
}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.mypayga.com/refund/create?
apikey=sprod_xxx&payment_token=Dxx
&amount=100&description=description");

xhr.send();
Réponse
{
    "message": "Refund created",
    "statusRequest": 200,
    "totalAmount": 100,
    "clientNumber": "07700000",
    "frais_transaction": 2.75,
    "updatedFees": 0,
    "refundId": "rfd_165533.IzkknzlJuU3p"
}
Requête
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://api.mypayga.com/refund/create?apikey=sprod_xxxx&payment_token=xx
  &amount=100&description=description")
  .method("POST", body)
  .build();
Response response = client.newCall(request).execute();
Réponse
{
    "message": "Refund created",
    "statusRequest": 200,
    "totalAmount": 100,
    "clientNumber": "07700000",
    "frais_transaction": 2.75,
    "updatedFees": 0,
    "refundId": "rfd_165533.IzkknzlJuU3p"
}

Envoyer un remboursement

Validation d'une demande de remboursement.


POST https://api.mypayga.com/refund/send
Requête
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mypayga.com/refund/send?apikey=sprod_xx
  &refund_id=rfd_123.IU3p',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Réponse
{
    "message": "Refund OK.",
    "refund_id": "rfd_16333.ICJ53p",
    "RefundStatus": "200",
}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.mypayga.com/refund/send?apikey=sprod_xx&refund_id=rfd_1333.JuU3p");

xhr.send();
Réponse
{
    "message": "Refund OK.",
    "refund_id": "rfd_16333.ICJ53p",
    "RefundStatus": "200",
}
Requête
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://api.mypayga.com/refund/send?apikey=sprod_xxx&refund_id=rfd_133.ICJU3p")
  .method("POST", body)
  .build();
Response response = client.newCall(request).execute();
Réponse
{
    "message": "Refund OK.",
    "refund_id": "rfd_16333.ICJ53p",
    "RefundStatus": "200",
}

Détails d'un remboursement

Détails d'une demande de remboursement.


POST https://api.mypayga.com/refund/infos
Requête
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mypayga.com/refund/infos?apikey=sprod_xx&refId=rfd_16333.IJuU3p',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse
{
    "message": "Refund found",
    "exists": 1,
    "refund": {
        "orderAmount": 100,
        "amount": 100,
        "status": "200",
        "requestDate": "2021-12-07 23:05:33",
        "opeDate": "2021-12-07 23:05:43",
        "paymentMethod": "Airtel Money",
        "refundType": "TO",
        "refundId": "rfd_16333.IVU3p",
        "message": "Remboursement en attente de validation.",
        "description": "description"
    },
    "statusRequest": "200"
}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.mypayga.com/refund/infos?apikey=sprod_xx&refId=rfd_18333.VJuU3p");

xhr.send();
Réponse
{
    "message": "Refund found",
    "exists": 1,
    "refund": {
        "orderAmount": 100,
        "amount": 100,
        "status": "200",
        "requestDate": "2021-12-07 23:05:33",
        "opeDate": "2021-12-07 23:05:43",
        "paymentMethod": "Airtel Money",
        "refundType": "TO",
        "refundId": "rfd_16333.IVU3p",
        "message": "Remboursement en attente de validation.",
        "description": "description"
    },
    "statusRequest": "200"
}
Requête
import requests

url = "https://api.mypayga.com/refund/infos?apikey=sprod_xx&refId=rfd_8933.VJuU3p"

payload={}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
Réponse
{
    "message": "Refund found",
    "exists": 1,
    "refund": {
        "orderAmount": 100,
        "amount": 100,
        "status": "200",
        "requestDate": "2021-12-07 23:05:33",
        "opeDate": "2021-12-07 23:05:43",
        "paymentMethod": "Airtel Money",
        "refundType": "TO",
        "refundId": "rfd_16333.IVU3p",
        "message": "Remboursement en attente de validation.",
        "description": "description"
    },
    "statusRequest": "200"
}

Créer un lien de paiement

Générez un lien de paiement depuis votre Application ou site Internet.

Génération d'un lien

POST https://api.mypayga.com/payment/generateLink
Requête
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mypayga.com/payment/generateLink?firstname=Fname
  &lastname=Lname&email=contact@gmail.com
  &phone=07488888&amount=1000&description=Test
  &apikey=stest_xxxszjkbzdjbzbzeozeihppezhprpi',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse
{
"message": "Link created",
    "code": 200,
    "link": {
        "order_ref": "s-8mpfjiSj",
        "description": "Test lien API",
        "email": "contact@gmail.com",
        "phone": "074101112",
        "expired": 0,
        "paid": 0,
        "url": "https://mypayga.com/payment/sharedLink/pay?token_url=spjzioguifKmzsaFjNYliv"
    }
}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.mypayga.com/payment/generateLink?firstname=Fname&lastname=Lname
&email=contact@gmail.com&phone=074111111&amount=1000&description=Test
&apikey=stest_9klqnpbeùzprozepn");

xhr.send();
Réponse
{
"message": "Link created",
    "code": 200,
    "link": {
        "order_ref": "s-8mpfjiSj",
        "description": "Test lien API",
        "email": "contact@gmail.com",
        "phone": "074101112",
        "expired": 0,
        "paid": 0,
        "url": "https://mypayga.com/payment/sharedLink/pay?token_url=spjzioguifKmzsaFjNYliv"
    }
}
Requête
import http.client

conn = http.client.HTTPSConnection("api.mypayga.com")
payload = ''
headers = {}
conn.request("POST", "/payment/generateLink?firstname=fname&lastname=lname
&email=contact@gmail.com&phone=074222222&amount=1000&description=Test
&apikey=stest_s;dbluvuzeegolvuqigofvurog", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Réponse
{
"message": "Link created",
    "code": 200,
    "link": {
        "order_ref": "s-8mpfjiSj",
        "description": "Test lien API",
        "email": "contact@gmail.com",
        "phone": "074101112",
        "expired": 0,
        "paid": 0,
        "url": "https://mypayga.com/payment/sharedLink/pay?token_url=spjzioguifKmzsaFjNYliv"
    }
}

Voir un lien

Consulter le statut de vos liens

POST https://api.mypayga.com/payment/getLink/{ref}?apikey=stest_ksliqvfighrqvgrqv
Requête
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mypayga.com/payment/getLink/Re9W4HbO3aZr4A1cxy0v?apikey=stest_gfcievyxwkjbk',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse
{"message": "Link created",
    "created_at": "2021-11-18 22:20:17",
    "link": {
        "ref": "Re9W4HbO3aZr4A1cxy0v",
        "description": "Test lien API",
        "email": "contact@minerve-tech.com",
        "phone": "074112233",
        "expired": 0,
        "final_status": "400",
        "url": "https://mypayga.com/payment/sharedLink/pay?token_url=Re9W4HbO3aZr4A1cxy0v"
    }
}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.mypayga.com/payment/getLink/Re9W4HbO3aZr4A1cxy0v?apikey=stest_s9WeQAbqj8WG");

xhr.send();
Réponse
{"message": "Link created",
    "created_at": "2021-11-18 22:20:17",
    "link": {
        "ref": "Re9W4HbO3aZr4A1cxy0v",
        "description": "Test lien API",
        "email": "contact@minerve-tech.com",
        "phone": "074112233",
        "expired": 0,
        "final_status": "400",
        "url": "https://mypayga.com/payment/sharedLink/pay?token_url=Re9W4HbO3aZr4A1cxy0v"
    }
}
Requête
import http.client

conn = http.client.HTTPSConnection("api.mypayga.com")
payload = ''
headers = {}
conn.request("POST", "/payment/getLink/Re9W4HbO3aZr4A1cxy0v?apikey=stest_WuxAuwegsqjdluzve", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Réponse
{"message": "Link created",
    "created_at": "2021-11-18 22:20:17",
    "link": {
        "ref": "Re9W4HbO3aZr4A1cxy0v",
        "description": "Test lien API",
        "email": "contact@minerve-tech.com",
        "phone": "074112233",
        "expired": 0,
        "final_status": "400",
        "url": "https://mypayga.com/payment/sharedLink/pay?token_url=Re9W4HbO3aZr4A1cxy0v"
    }
}

Annuler un lien

Vous pouvez annuler un lien préalablement crée.

GET https://api.mypayga.com/mpayment/linkCancel/{ref}?apikey=stest_qhkvdkhsdjvjks
Requête
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.mypayga.com/payment/linkCancel/Re9W4HbO3aZr4A1cxy0v?apikey=stest_ssssssfuvzelkh',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Réponse
{
    "message": "Link updated : Changed to Expired",
    "code": 200,
    "link": "Re9W4HbO3aZr4A1cxy0v"
}
Requête
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.mypayga.com/payment/linkCancel/Re9W4HbO3aZr4A1cxy0v?apikey=stest_nWLpyhWGWuxAu3XR2w");

xhr.send();
Réponse
{
    "message": "Link updated : Changed to Expired",
    "code": 200,
    "link": "Re9W4HbO3aZr4A1cxy0v"
}
Requête
import http.client

conn = http.client.HTTPSConnection("api.mypayga.com")
payload = ''
headers = {}
conn.request("GET", "/payment/linkCancel/Re9W4HbO3aZr4A1cxy0v?apikey=stest_GWuxAu3X", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Réponse
{
    "message": "Link updated : Changed to Expired",
    "code": 200,
    "link": "Re9W4HbO3aZr4A1cxy0v"
}