Digitalpaye API
Digitalpaye API
  • Welcome 🥳
  • Introduction
  • API Références
    • v1
      • Créer un Token
      • Balance
      • Customers
        • Créer un client
        • Fetch data customer
        • Fetch all customers
      • Collecte
        • MTN Mobile Money
        • Moov Mobile Money
        • Orange Mobile Money
        • Wave Money
      • Disbursment (Transfert)
        • MTN Mobile Money
        • Moov Mobile Money
        • Orange Mobile Money
        • Wave Money
      • Get status transaction
      • Get all transactions
  • Change log
    • v1
  • SDK ET PLUGINS
    • SDK PHP
    • Flutter
  • Webhook
Propulsé par GitBook
Sur cette page

Cet article vous a-t-il été utile ?

  1. API Références
  2. v1

Créer un Token

Pour créer un jeton d'authentification en utilisant une méthode d'authentification basique (Basic Authentication) avec votre api_key et api_secret, vous pouvez suivre les étapes suivantes. Assurez-vous d'avoir accès à votre API et d'avoir les informations d'authentification nécessaires (clé API et secret).

Encodage des identifiants : Tout d'abord, vous devez encoder votre clé API (api_key) et votre Api secret (api_secret) dans un format approprié pour l'authentification basique. Pour cela, combinez vos identifiants sous la forme api_key:api_secret et encodez-les en base64.

Authentification

POST https://api.digitalpaye.com/v1/auth

Headers

Name
Value

X-Environment

Production

Authorization

Basic bGl2ZV9kaWdpdGFscGF5ZTY3OTg3Njo1OWJlYzU4Ni0yOWYwLTRjMWMtOGE2ZC0wY2MyMDk0ZjZhMzQ=

Response

{
    "statusCode": 200,
    "message": "Successful",
    "data": {
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wYW55SWQiOiI4NDM3ZGQxMy04OWFjLTQ1ZTEtYTdhYS1jOGJhMDk1ZDFiMjciLCJpYXQiOjE3Mjg2MzQyMDMsImV4cCI6MTcyODYzNDgwM30.A3-AD5mGawbhv9nUmio0k7c-hhx5K7lqnuPFCziJJqE",
        "exp": 1728634803
    }
}
{
    "statusCode": 400,
    "message": "BadRequestError",
    "reason": "Les identifiants API (apikey et apisecret) sont requis."
}
{
    "statusCode": 401,
    "message": "UnauthorizedError",
    "reason": "Identifiants API incorrects. Veuillez vérifier votre clé API et votre secret."
}
{
    "statusCode": 500,
    "message": "InternalServerError",
    "reason": "Une erreur est survenue. Veuillez réessayer"
}
curl --location --request POST 'https://api.digitalpaye.com/v1/auth' \
--header 'X-Environment: Production' \
--header 'Authorization: Basic i0yOWYwLTRjMWMtOGE2ZC0bGl2ZV9JlYzU4NiwY2MyMDk0ZjZhMzQkaWdpdGFscGF5ZTY3OTg3Njo1OW=' \
--data ''
<?php

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.digitalpaye.com/v1/auth',
  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',
  CURLOPT_HTTPHEADER => array(
    'X-Environment: Production',
    'Authorization: Basic i0yOWYwLTRjMWMtOGE2ZC0bGl2ZV9JlYzU4NiwY2MyMDk0ZjZhMzQkaWdpdGFscGF5ZTY3OTg3Njo1OW='
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
<?php
$client = new Client();
$headers = [
  'X-Environment' => 'Production',
  'Authorization' => 'Basic i0yOWYwLTRjMWMtOGE2ZC0bGl2ZV9JlYzU4NiwY2MyMDk0ZjZhMzQkaWdpdGFscGF5ZTY3OTg3Njo1OW='
];
$body = '';
$request = new Request('POST', 'https://api.digitalpaye.com/v1/auth', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
const axios = require('axios');
let data = '';

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.digitalpaye.com/v1/auth',
  headers: { 
    'X-Environment': 'Production', 
    'Authorization': 'Basic i0yOWYwLTRjMWMtOGE2ZC0bGl2ZV9JlYzU4NiwY2MyMDk0ZjZhMzQkaWdpdGFscGF5ZTY3OTg3Njo1OW='
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
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.digitalpaye.com/v1/auth")
  .method("POST", body)
  .addHeader("X-Environment", "Production")
  .addHeader("Authorization", "Basic i0yOWYwLTRjMWMtOGE2ZC0bGl2ZV9JlYzU4NiwY2MyMDk0ZjZhMzQkaWdpdGFscGF5ZTY3OTg3Njo1OW=")
  .build();
Response response = client.newCall(request).execute();
Précédentv1SuivantBalance

Dernière mise à jour il y a 7 mois

Cet article vous a-t-il été utile ?