Documentation

API Reference

Overview

The Juni Payment API is organized around REST. Our API accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes and authentication. We provide APIs and other services to enable you initiate collection, disbursement and remitance transactions.

Authentication

You will make use of the Client ID, Secret, Token Link and generated tokens to authenticate all your requests to the Junipay API. The Client ID, Secret and Token Link and be found in your dashboard where you can also manage your private public key pair.

Tokens are generated for API endpoint requests by using your private key while tokens for Payment Form integration is generated by making a request to your Token Link. Your Secret and Client ID have to be passed in this request. Tokens have to be passed in the Authorization header parameter. Any request made to an API endpoint, or Payment Form integration without a token will receive a 401: Unauthorised response.

The Authorization header parameter should be passed in the format below.

Authorization: Bearer [TOKEN]

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without a valid authorization header parameter will also fail.

Secure your Secret Key and Private Key

Do not commit your secret and private keys to git, or use them in client-side code.

Errors

Junipay's API is RESTful and therefore, it uses conventional HTTP response codes to indicate the success or failure of requests.

Code Description
200, 201 Request was successful and intended action was carried out.
Note that we will always send a 200 if a charge or verify
request was made. Do check the data object to know how the
charge went (i.e. successful or failed).
400 A validation or client side error occurred and the request was
not fulfilled.
401 The request was not authorized. This can be triggered by passing
an invalid secret key in the authorization header or the lack of one
404 Request could not be fulfilled as the request resource does not exist.
500, 501, 502,
503, 504
Request could not be fulfilled due to an error on Junipay's end. This
shouldn't happen so please report as soon as you encounter any instance
of this.

Base URL

https://api.junipayments.com

Bank Codes

This is the list of Banks JuniPay integrates with and the codes to use for each bank

Code Bank
2001 Access Bank
2003 Agricultural Development Bank Limited
2004 ARB Apex Bank Limited
2005 Bank of Africa
2006 Bank of Ghana
2002 Absa Bank
2007 CalBank PLC
2008 Consolidated Bank Ghana Limited
2009 Ecobank Ghana Limited
2010 Fidelity Bank Ghana Limited
2011 First Atlantic Bank Limited
2012 First National Bank (Ghana) Limited
2013 GCB Bank Limited
2014 Guaranty Trust Bank (Ghana) Limited
2015 National Investment Bank Limited
2016 Prudential Bank Limited
2017 Republic Bank (Ghana) PLC
2018 Stanbic Bank Ghana Limited
2019 Standard Chartered Bank (Ghana) Limited
2020 OmniBSIC Bank
2021 United Bank of Africa
2022 Universal Merchant Bank Limited
2023 Zenith Bank (Ghana) Limited
2024 First Bank of Nigeria
2025 Societe Generale Ghana

Collections

Junipay offers three different ways to receive collections from customers: Payment Link, Payment Form and Payment API endpoint.

Personalized Payment Link

Prerequisites

  • You must be verified by going through compliance and get approved.

The Junipay Payment Link guides customers to a customized form after which users provide their account and other details such as thier emails and other details you specify on your Junipay Dashboard. This link can be sent to your payee through social media apps like Whatsapp and can be placed on buiness pages on Instagram and Twiter.

Your Payment Link will be:
https://junipayments.com/

payment-link-example
payment-link-example

Payment Link Form - Mobile Money

Payment Link Form - Card

Payment Form

Prerequisites

  • You must be verified by going through compliance and get approved.
  • Your Client ID, Secret key, and Token Generation Link which are located in the Getting Started page on your Dashboard.
  • JQuery will need to be imported into the webpage for the Payment Form integration to work

The Junipayment Form provides a simple and convenient payment flow for web. It can be integrated in easy steps, making it one of the easiest way to start accepting payments. See demo of the payment method here:

Test it out now:

To initialize the collection transaction, you will need to pass the customer's email, customer's phone number, transaction amount and the generated token. Email, phone number, amount and token are required.

Integration Steps

The payment form can be integrated in 5 easy steps;

  1. Import the inline.js file into your web page.
  2. <script src="https://api.junipayments.com/js/inline.js"></script>
  3. Generate JWT (JSON Web Token) with your secret and token link.
  4. 
    curl --location --request GET 'https://api.junipayments.com/obtaintoken/{unique_id}' \
    --header 'Content-Type: application/json' \
    --header 'xderd: {secret}'
                                            
    
    var request = require("request");
    
    var options = { method: 'GET',
        url: 'https://api.junipayments.com/obtaintoken/{unique_id}',
        headers: 
        { 
            'cache-control': 'no-cache',
            xderd: '{secret}' } };
    
    request(options, function (error, response, body) {
        if (error) throw new Error(error);
                                            
        console.log(body);
    });
                                            
     $request  = new HttpRequest();
    $request->setUrl('https://api.junipayments.com/obtaintoken/{unique_id}');
    $request->setMethod(HTTP_METH_GET);
    
    $request->setHeaders(array(
        'cache-control' => 'no-cache',
        'xderd' => '{secret}'
    ));
    
    try {
        $response = $request->send();
    
        echo $response->getBody();
    } catch (HttpException $ex) {
        echo $ex;
    } 
        
  5. Copy and paste the payWithJunipay() function to your webpage. Then update attributes as needed and assign the generated token to the key attribute in the setup object.
  6. 
    // Code snippet to call the default payment form
    
    function payWithJunipay() {
        var handler = JuniPop.setup({
            key: {token}, //put your token here
            clientid: {client ID},
            email: 'customer@email.com', //put your customer's email here
            amount: 1, //amount the customer is supposed to pay
            color: "white",
            desc: "payment for service",
            total_amt: 1,
            foreignID:"2384374323484",
            customer_token: {customer_id} //eg. RCP_607ee694abc0c67c32822d54,
            callbackUrl: 'https://yoururl/callbackUrl',
            redirectUrl: 'https://yoururl/redirectUrl',
            onClose: function() {
                alert('Transaction cancelled');
            }
        });
    }
    
    // Default way of using the default payment form from Junipayments. your Button must have onclick function payWithJuni. example onclick="payWithJunipay();"
    
  7. Assign the payWithJunipay() function to the button you want to trigger the payment form with.
  8. <button onclick="payWithJunipay();">Pay Now</button>
  9. Start receiving money from customers.

Options

Paramter Type Description
key String Token generated using your secret key
clientid String Your client ID
email String Email address of customer
amount Double Amount debiting customer.
color String Background color of payment form.
desc String Description of item/service being paid for.
total_amnt Double Total amount to be paid (for multiple products).
customer_token String ID of customer who has made payment before
onClose Callback Javascript function that is called if the customer closes the payment window instead of making a payment.
foreignID String Optional, Unique string that will be used to query a specific transaction
callbackUrl String URL the callback request will be sent to

Must be of method POST

redirectUrl String The url payers will be redirected to after payment is made

Payment Form Color Variations

White

Blue

Red

Collections API

/payment

Prerequisites

  • You must be verified by going through compliance and get approved.
  • You must request and be approved to use Direct Access APIs.
  • Your private and public key which has to be generated on the Getting Started page on your Dashboard.
  • A package to generate your token from your private key. eg. jsonwebtoken

The Collections API allows you to easily receive money with your integration. This API endpoint was created mainly for aggregators and users will have to be approved to use it.

Tokens are required to be generated and defined in the headers parameter for that request to be authorized. Tokens must be generated from private keys with the RS256 algorithm and are defined in the request paramters.

The example below shows how a token is generated from a private key using the jsonwebtoken npm package in NodeJS.


// Import the jsonwebtoken packge into your project 
var jwt = require("jsonwebtoken");

// Get your private key 
var privateKey = fs.readFileSync('{private_key_file_location}');

// Generate token 
var token;
try{
    token = await jwt.sign({ payload : 'payload_example' }, privateKey, { algorithm: 'RS256'});
} catch(err){
    throw err;
}

// Return token 
return token;
Header Parameters
Paramter Type Description
Authorization String Set value to

Bearer TOKEN

clientid String Set value to

Your Client ID on you Dashboard

Content-Type String Set value to

application/json

Body Parameters
Paramter Type Description
channel String Payment method to be used to collect money from payer mobile_money or card
phoneNumber (required for mobile_money channel) String Customer's phone number
provider (required for mobile_money channel) String Customer's phone network provider
amount Double Amount to transfer in Cedis
tot_amnt Double Total amount to transfer in Cedis
senderEmail String Payer's email address. Receipt will be sent to this email when transaction is done.
description String Transaction description
foreignID String Unique string that will be used to query a specific transaction
callbackUrl String URL the callback request will be sent to

Must be of method POST

/payment
 curl -X POST \
https://api.junipayments.com/payment \
-H 'authorization: Bearer TOKEN' \
-H 'clientid: Your Client ID' \
-H 'content-type: application/json' \
-d '{
    amount: '0.1',
    tot_amnt: '0.1',
    provider: 'mtn',
    phoneNumber: '0240000000',
    channel:'mobile_money'
    senderEmail:'payer@email.com',
    description: 'test payment'
    foreignID: '132222223'
    "callbackUrl": "https://yoururl/callbackUrl"
}'                             
                                            
                                        
 var http = require("https");

var options = {
    "method": "POST",
    "hostname": "https://api.junipayments.com",
    "port": "3000",
    "path": "/payment",
    "headers": {
        "content-type": "application/json",
        "authorization": "Bearer TOKEN",
        "clientid": "You Client ID",
    }
};
                                        
var req = http.request(options, function (res) {
    var chunks = [];
                                        
    res.on("data", function (chunk) {
        chunks.push(chunk);
    });
                                        
    res.on("end", function () {
        var body = Buffer.concat(chunks);
    });
});
                                        
req.write(JSON.stringify({ 
    amount: '0.1',
    tot_amnt: '0.1',
    provider: 'mtn',
    phoneNumber: '0240000000',
    channel:'mobile_money',
    senderEmail:'payer@email.com',
    description: 'test payment'
    foreignID: '132222223',
    "callbackUrl": 'https://yoururl/callbackUrl',
},
  json: true 
}));

req.end();
                                    
                                
 $request = new HttpRequest();
$request->setUrl('https://api.junipayments.com/payment');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
'authorization' => 'Bearer TOKEN',
'clientid' => 'Your Client ID',
'content-type' => 'application/json'
));

$request->setBody('{
    amount: '0.1',
    tot_amnt: '0.1',
    provider: 'mtn',
    phoneNumber: '0240000000',
    channel:'mobile_money',
    senderEmail:'payer@email.com',
    description: 'test payment'
    foreignID: '132222223' ,
    callbackUrl: 'https://yoururl/callbackUrl',
    json: true 
}
');

try {
$response = $request->send();

echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
                                        
                                    

Your account will be deducted

The easiest way to try JuniPay is to make a live payment. Choose a small amount that you can afford to give away. Please note that this is a real transaction, and that your account will be debited.

Transaction Status Check API

Verify the status for transactions initiated.

/checktranstatus

Prerequisites

  • You must be verified by going through compliance and get approved.
  • You must request and be approved to use Direct Access APIs.
  • Your private and public key which has to be generated on the Getting Started page on your Dashboard.
  • A package to generate your token from your private key. eg. jsonwebtoken

This API enables you to check the status of previously initiated transactions.

Tokens are required to be generated and defined in the headers parameter for that request to be authorized. Tokens are generated from private keys and are defined in the request paramters. The example shows how a token is generated from a private key using the jsonwebtoken npm package in NodeJS.


// Import the jsonwebtoken packge into your project 
var jwt = require("jsonwebtoken");

// Get your private key 
var privateKey = fs.readFileSync('{private_key_file_location}');

// Generate token 
var token;
try{
    token = await jwt.sign({ payload : 'payload_example' }, privateKey, { algorithm: 'RS256'});
} catch(err){
    throw err;
}

// Return token 
return token;

Header Parameters

Parameter Type Description
Authorization String Set value to

Bearer [TOKEN]

clientid String Set value to

Your Client ID on you Dashboard

Content-Type String Set value to

application/json

Body Parameters

Parameter Type Description
transID String Unique transaction id to be used to query transaction status

/checktranstatus

 curl -X POST \
  https://api.junipayments.com/checktranstatus \

  -H 'authorization: Bearer TOKEN' \
  -H 'clientid: Your Client ID' \
-H 'content-type: application/json' \

-d '{"transID":"1644578865354"}'
                                    

var http = require("https");

const params = JSON.stringify({ 
    transID: '1644578865398'
})

var options = {
    "method": "POST",
    "hostname": "https://api.junipayments.com",
    "port": "3000",
    "path": "/checktranstatus",
    "headers": {
        "content-type": "application/json",
        "authorization": "Bearer TOKEN"
        "clientid": "Your Client ID"
    }
};
        
var req = http.request(options, function (res) {
    var chunks = [];
        
    res.on("data", function (chunk) {
        chunks.push(chunk);
    });
        
    res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
    });
});
        
req.write(params);
req.end();

 $request  = new HttpRequest();
$request->setUrl('https://api.junipayments.com/checktranstatus');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
    'authorization' => 'Bearer TOKEN',
    'cientid' => 'Your Client ID',
    'content-type' => 'application/json'
));
                                        
$request->setBody(
    '{ "transID": "1644578865398"}'
);
    try {
        $response = $request->send();
        echo $response->getBody();
    } catch (HttpException $ex) {
        echo $ex;
    }     

Disbursements

To send money to people using the Junipay API users will go through a number of processes and make use of a number of API endpoints.

Verify Accounts API

/resolve

Prerequisites

  • You must be verified by going through compliance and get approved.
  • Your private and public key which has to be generated on the Getting Started page on your Dashboard.
  • A package to generate your token from your private key. eg. jsonwebtoken

This API allows you to verify a phone number or account number of a recipient before creation or transfer.

Tokens are required to be generated and defined in the headers parameter for that request to be authorized. Tokens are generated from private keys and are defined in the request paramters. The example shows how a token is generated from a private key using the jsonwebtoken npm package in NodeJS.


// Import the jsonwebtoken packge into your project 
var jwt = require("jsonwebtoken");

// Get your private key 
var privateKey = fs.readFileSync('{private_key_file_location}');

// Generate token 
var token;
try{
    token = await jwt.sign({ payload : 'payload_example' }, privateKey, { algorithm: 'RS256'});
} catch(err){
    throw err;
}

// Return token 
return token;

Header Parameters

Parameter Type Description
Authorization String Set value to

Bearer TOKEN

clientid String Set value to

Your Client ID on you Dashboard

URL Query Parameters

Parameter Type Description
channel String Channel, either mobile_money or bank
phoneNumber (required for mobile_money channel) String Phone number to be verified
provider (required for mobile_money channel) String network provider of the Phone number to be verified mtn, vodafone, airteltigo
account_number (required for bank channel) String Customer account number
bank_code (required for bank channel) String Customer's bank code
/resolve
 curl -X GET \
  https://api.junipayments.com/resolve?channel=mobile_money&phoneNumber=0248813184&provider=mtn \

  -H 'authorization: Bearer TOKEN' \
  -H 'clientid: Your Client ID' \

                                    

var request = require("request");

var options = { method: 'GET',
    url: 'https://api.junipayments.com/resolve',
    qs: 
    { channel: 'mobile_money',
        phoneNumber: '0240000000',
        provider: 'mtn' },
    headers: 
    { 
        'cache-control': 'no-cache',
        'authorization': 'Bearer TOKEN',
        'clientid': 'Your Client ID'
    } };

request(options, function (error, response, body) {
    if (error) throw new Error(error);
                                        
    console.log(body);
});
                                        

 $request  = new HttpRequest();
$request->setUrl('https://api.junipayments.com/resolve');
$request->setMethod(HTTP_METH_GET);

$request->setQueryData(array(
    'channel' => 'mobile_money',
    'phoneNumber' => '0240000000',
    'provider' => 'mtn'
));

$request->setHeaders(array(
    'cache-control' => 'no-cache',
    'authorization' => 'Bearer TOKEN'
    'clientid' => 'Your Client ID'
));

try {
    $response = $request->send();

    echo $response->getBody();
} catch (HttpException $ex) {
    echo $ex;
} 

Create Transfers Recipient API

/customer

This API allows you to create the recipients of money transferred using the Junipay Disbursement API.

Prerequisites

  • You must be verified by going through compliance and get approved.
  • Your private and public key which has to be generated on the Getting Started page on your Dashboard.
  • A package to generate your token from your private key. eg. jsonwebtoken

Verify first

You are advised to run the verify (resolve) endpoint to ensure the validity of the phone number or bank account number for the transfer recipients to be created.

Tokens are required to be generated and defined in the headers parameter for that request to be authorized. Tokens are generated from private keys and are defined in the request paramters. The example shows how a token is generated from a private key using the jsonwebtoken npm package in NodeJS.


// Import the jsonwebtoken packge into your project 
var jwt = require("jsonwebtoken");

// Get your private key 
var privateKey = fs.readFileSync('{private_key_file_location}');

// Generate token 
var token;
try{
    token = await jwt.sign({ payload : 'payload_example' }, privateKey, { algorithm: 'RS256'});
} catch(err){
    throw err;
}

// Return token 
return token;

Header Parameters

Parameter Type Description
Authorization String Set value to

Bearer [TOKEN]

clientid String Set value to

Your Client ID on you Dashboard

Content-Type String Set value to

application/json

Body Parameters

Parameter Type Description
useremail String Customer's email
first_name String Customer's first name
last_name String Customer's last name
phoneNumber (optional) String Customer's phone number
provider (required for phoneNumber) String Customer's phone network provider
account_number (optional) String Customer account number
bank_code (required for account_number) String Customer's bank code
callbackUrl String URL the response will be sent to

/customer

 curl -X POST \
  https://api.junipayments.com/customer \

  -H 'authorization: Bearer TOKEN' \
  -H 'clientid: Your Client ID' \
-H 'content-type: application/json' \

-d '{"useremail":"johndoe@example.com",
    "first_name":"John",
    "last_name":"Doe",
    "account_number":"0158020000000",
    "bank_code":"300328"}'
                                    

var http = require("https");

const params = JSON.stringify({ 
    useremail: 'johndoe@example.com',
    first_name: 'John',
    account_number: '0158020000000',
    bank_code: '300328'
})

var options = {
    "method": "POST",
    "hostname": "https://api.junipayments.com",
    "port": "3000",
    "path": "/customer",
    "headers": {
        "content-type": "application/json",
        "authorization": "Bearer TOKEN"
        "clientid": "Your Client ID"
    }
};
        
var req = http.request(options, function (res) {
    var chunks = [];
        
    res.on("data", function (chunk) {
        chunks.push(chunk);
    });
        
    res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
    });
});
        
req.write(params);
req.end();

 $request  = new HttpRequest();
$request->setUrl('https://api.junipayments.com/customer');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
    'authorization' => 'Bearer TOKEN',
    'cientid' => 'Your Client ID',
    'content-type' => 'application/json'
));
                                        
$request->setBody(
    '{ "useremail": "johndoe@example.com", 
    "first_name": "John", 
    "last_name": "Doe", 
    "account_number": "0158020000000", 
    "bank_code":"300328"}'
);
    try {
        $response = $request->send();
        echo $response->getBody();
    } catch (HttpException $ex) {
        echo $ex;
    }     

Disbursements API

/transfer

Prerequisites

  • You must be verified by going through compliance and get approved.
  • You must request and be approved to use Direct Access APIs.
  • Your private and public key which has to be generated on the Getting Started page on your Dashboard.
  • A package to generate your token from your private key. eg. jsonwebtoken

The Disbursement API allows you to easily send money to Bank accounts or Mobile Money with your integration

Verify first

You are advised to run the verify (resolve) endpoint to ensure the validity of the phone number or bank account number for the transfer recipients to be created.

Tokens are required to be generated and defined in the headers parameter for that request to be authorized. Tokens are generated from private keys and are defined in the request paramters. The example shows how a token is generated from a private key using the jsonwebtoken npm package in NodeJS.


// Import the jsonwebtoken packge into your project 
var jwt = require("jsonwebtoken");

// Get your private key 
var privateKey = fs.readFileSync('{private_key_file_location}');

// Generate token 
var token;
try{
    token = await jwt.sign({ payload : 'payload_example' }, privateKey, { algorithm: 'RS256'});
} catch(err){
    throw err;
}

// Return token 
return token;

Header Parameters

Parameter Type Description
Authorization String Set value to

Bearer TOKEN

clientid String Set value to

Your Client ID on you Dashboard

Content-Type String Set value to

application/json

Body Parameters

Parameter Type Description
channel String Channel to transfer money to, either mobile_money or bank
phoneNumber (required for mobile_money channel) String Customer's phone number
provider (required for mobile_money channel) String Customer's phone network provider
account_number (required for bank channel) String Customer account number
bank_code (required for bank channel) String Customer's bank code
receiver_phone String Recipients phone number
amount Double Amount to transfer in Cedis
sender String Name of the sender
receiver String Name of the receiver
narration String The reason for the transfer
foreignID String Unique string that will be used to query a specific transaction
callbackUrl String URL the callback request will be sent to

Must be of method POST

/transfer
 curl -X POST \
https://api.junipayments.com/transfer \
-H 'authorization: Bearer TOKEN' \
-H 'clientid: Your Client ID' \
-H 'content-type: application/json' \
-d '{
    "channel": "bank",
    "bank_code": "2001",
    "amount": "1",
    "account_number": "0000000000000",
    "foreignID": "23432200282",
    "sender": "Amina Atta",
    "receiver": "John Doe"
    "callbackUrl": "https://yoururl/callbackUrl",
}'
                

var http = require("https");

var options = {
    "method": "POST",
    "hostname": "https://api.junipayments.com",
    "port": "3000",
    "path": "/transfer",
    "headers": {
        "content-type": "application/json",
        "authorization": "Bearer TOKEN"
        "clientid": "Your Client ID"
    }
};
                                        
var req = http.request(options, function (res) {
    var chunks = [];
                                        
    res.on("data", function (chunk) {
        chunks.push(chunk);
    });
                                        
    res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
    });
});

req.write(JSON.stringify({ 
    channel: 'bank',
    bank_code: '2001',
    amount: '1',
    account_number: '0000000000000',
    foreignID: '23432200282',
    sender: 'John Doe',
    receiver: 'Amina Atta' 
    callbackUrl: 'https://yoururl/callbackUrl',
}));

req.end();

 $request  = new HttpRequest();
$request->setUrl('https://api.junipayments.com/transfer');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'authorization' => 'Bearer TOKEN',
'clientid' => 'Your Client ID',
'content-type' => 'application/json'
));
                    
$request->setBody(
'{"channel": "bank",
"bank_code": "2001",
"amount": "1",
"account_number": "0000000000000",
"foreignID": "23432200282",
"sender": "John Doe",
"receiver": "Amina Atta"}'
"callbackUrl": "youcallbackUrl",
);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}     

Remittance

Verify Beneficiaries API

/resolve

Prerequisites

  • You must be verified by going through compliance and get approved.
  • Your private and public key which has to be generated on the Getting Started page on your Dashboard.
  • A package to generate your token from your private key. eg. jsonwebtoken

This API allows you to verify a phone number or account number of a remittance beneficiary.

Tokens are required to be generated and defined in the headers parameter for that request to be authorized. Tokens are generated from private keys and are defined in the request paramters. The example shows how a token is generated from a private key using the jsonwebtoken npm package in NodeJS.


// Import the jsonwebtoken packge into your project 
var jwt = require("jsonwebtoken");

// Get your private key 
var privateKey = fs.readFileSync('{private_key_file_location}');

// Generate token 
var token;
try{
    token = await jwt.sign({ payload : 'payload_example' }, privateKey, { algorithm: 'RS256'});
} catch(err){
    throw err;
}

// Return token 
return token;

Header Parameters

Parameter Type Description
Authorization String Set value to

Bearer TOKEN

clientid String Set value to

Your Client ID on you Dashboard

URL Query Parameters

Parameter Type Description
channel String Channel, either mobile_money or bank
phoneNumber (required for mobile_money channel) String Phone number to be verified
provider (required for mobile_money channel) String Network provider of the Phone number to be verified mtn, vodafone, airteltigo
account_number (required for bank channel) String Customer's bank account number
bank_code (required for bank channel) String Customer's bank code
/resolve
 curl -X GET \
  https://api.junipayments.com/resolve?channel=mobile_money&phoneNumber=0248813184&provider=mtn \

  -H 'authorization: Bearer TOKEN' \
  -H 'clientid: Your Client ID' \

                                    

var request = require("request");

var options = { method: 'GET',
    url: 'https://api.junipayments.com/resolve',
    qs: 
    { channel: 'mobile_money',
        phoneNumber: '0240000000',
        provider: 'mtn' },
    headers: 
    { 
        'cache-control': 'no-cache',
        'authorization': 'Bearer TOKEN',
        'clientid': 'Your Client ID'
    } };

request(options, function (error, response, body) {
    if (error) throw new Error(error);
                                        
    console.log(body);
});
                                        

 $request  = new HttpRequest();
$request->setUrl('https://api.junipayments.com/resolve');
$request->setMethod(HTTP_METH_GET);

$request->setQueryData(array(
    'channel' => 'mobile_money',
    'phoneNumber' => '0240000000',
    'provider' => 'mtn'
));

$request->setHeaders(array(
    'cache-control' => 'no-cache',
    'authorization' => 'Bearer TOKEN'
    'clientid' => 'Your Client ID'
));

try {
    $response = $request->send();

    echo $response->getBody();
} catch (HttpException $ex) {
    echo $ex;
} 

Remittance API

/sendremittance

Prerequisites

  • You must be verified by going through compliance and get approved.
  • You must request and be approved to use Direct Access APIs.
  • Your private and public key which has to be generated on the Getting Started page on your Dashboard.
  • A package to generate your token from your private key. eg. jsonwebtoken

This API serves as the primary gateway to facilitate money transfers across the world through JuniPay's platform.

Verify first

You are advised to run the verify (resolve) endpoint to ensure the validity of the phone number or bank account number for the transfer recipients to be created.

Tokens are required to be generated and defined in the headers parameter for that request to be authorized. Tokens are generated from private keys and are defined in the request paramters. The example shows how a token is generated from a private key using the jsonwebtoken npm package in NodeJS.


// Import the jsonwebtoken packge into your project 
var jwt = require("jsonwebtoken");

// Get your private key 
var privateKey = fs.readFileSync('{private_key_file_location}');

// Generate token 
var token;
try{
    token = await jwt.sign({ payload : 'payload_example' }, privateKey, { algorithm: 'RS256'});
} catch(err){
    throw err;
}

// Return token 
return token;

Header Parameters

Parameter Type Description
Authorization String Set value to

Bearer TOKEN

clientid String Set value to

Your Client ID on you Dashboard

Content-Type String Set value to

application/json

Body Parameters

Parameter Type Description
sender_firstName String First Name of the sender
sender_lastName String Last name of sender
sender_email String Email of the sender
sender_country String Country of sender
channel String Chanel to transfer money to, either mobile_money or bank
sendAmount Double Amount to be sent, in Cedis
desc String Reason for sending Remittance
rec_fullName String Full name of receiver
rec_phoneNumber String Phone number of receiver if channel is mobile_money
rec_provider String Provider of receiver if channel is mobile_money
rec_bankNumber String Bank account number of receiver if channel is bank
rec_bankCode String Bank code of receiver if channel is bank
foreignID String Unique string that will be used to query a specific transaction
sendingCurrency new! String 3 Digit ISO Currency code for the sending currency eg. USD, GBP
receivingCurrency new! String 3 Digit ISO Currency code for the receiving currency eg. GHS, INR
sendAmountForeign new! String Amount to be sent, in sending currency
exchangeRate new! String Exchange rate used in transaction
callbackUrl String URL the callback request will be sent to

Must be of method POST

/sendremittance
 curl --location --request POST 'https://api.junipayments.com/sendremittance' \
--H 'content-type: application/json' \
--H 'authorization: Bearer TOKEN' \
--H 'clientid: Your Client ID' \
--d '{
"sender_firstName": "John",
"sender_lastName": "Doe",
"sender_email": "sender@example.com",
"sender_country": "USA",
"channel": "mobile_money",
"sendAmount": 1,
"desc": "Miscellaneous"
"rec_provider": "mtn",
"rec_phoneNumber": "0200000000",
"rec_fullName": "Jane Black",
"callbackUrl": "https://yoururl/callbackUrl"
}
                                        
                                          
                    

    var unirest = require("unirest");
    var req = unirest("POST", "https://api.junipayments.com/sendremittance");
                                            
    req.headers({
        "cache-control": "no-cache",
        "authorization": "Bearer TOKEN",
        "clientid": "Your Client ID",
        "content-type": "application/json"
    });
                                            
    req.type("json");
    req.send({
      "sender_firstName": "John",
      "sender_lastName": "Doe",
      "sender_email": "sender@example.com",
      "sender_country": "USA",
      "channel": "mobile_money",
      "sendAmount": 1`,
      "reason": "Miscellaneous",
      "rec_provider": "mtn",
      "rec_phoneNumber": "0200000000",
      "rec_fullName": "Jane Black",
      "callbackUrl": 'https://yoururl/callbackUrl',
    });
                                            
    req.end(function (res) {
      if (res.error) throw new Error(res.error);
         console.log(res.body);
    });
                                            
    
    
 $request  = new HttpRequest();
    $request->setUrl('https://api.junipayments.com/sendremittance');
    $request->setMethod(HTTP_METH_POST);
    $request->setHeaders(array(
    'authorization' => 'Bearer TOKEN',
    'clientid' => 'Your Client ID',
    'content-type' => 'application/json'
    ));
                        
    $request->setBody(
    "sender_firstName": "John",
    "sender_lastName": "Doe",
    "sender_email": "sender@example.com",
    "sender_country": "USA",
    "channel": "mobile_money",
    "sendAmount": 1,
    "reason": "Miscellaneous"'
    "rec_provider": "mtn",
    "rec_phoneNumber": "0200000000",
    "rec_fullName": "Jane Black",
    "callbackUrl": 'https://yoururl/callbackUrl',
    );
    try {
    $response = $request->send();
    echo $response->getBody();
    } catch (HttpException $ex) {
    echo $ex;
    }     
    

Transaction Status Check API

Verify the status for transactions initiated.

/checkremittancestatus

Prerequisites

  • You must be verified by going through compliance and get approved.
  • You must request and be approved to use Direct Access APIs.
  • Your private and public key which has to be generated on the Getting Started page on your Dashboard.
  • A package to generate your token from your private key. eg. jsonwebtoken

This API enables you to check the status of previously initiated transactions.

Tokens are required to be generated and defined in the headers parameter for that request to be authorized. Tokens are generated from private keys and are defined in the request paramters. The example shows how a token is generated from a private key using the jsonwebtoken npm package in NodeJS.


// Import the jsonwebtoken packge into your project 
var jwt = require("jsonwebtoken");

// Get your private key 
var privateKey = fs.readFileSync('{private_key_file_location}');

// Generate token 
var token;
try{
    token = await jwt.sign({ payload : 'payload_example' }, privateKey, { algorithm: 'RS256'});
} catch(err){
    throw err;
}

// Return token 
return token;

Header Parameters

Parameter Type Description
Authorization String Set value to

Bearer [TOKEN]

clientid String Set value to

Your Client ID on you Dashboard

Content-Type String Set value to

application/json

Body Parameters

Parameter Type Description
trans_id String Unique transaction id to be used to query transaction status

/checkremittancestatus

 curl -X POST \
  https://api.junipayments.com/checkremittancestatus \

  -H 'authorization: Bearer TOKEN' \
  -H 'clientid: Your Client ID' \
-H 'content-type: application/json' \

-d '{"trans_id":"1644578865354"}'
                                    

var http = require("https");

const params = JSON.stringify({ 
    trans_id: '1644578865398'
})

var options = {
    "method": "POST",
    "hostname": "https://api.junipayments.com",
    "port": "3000",
    "path": "/checkremittancestatus",
    "headers": {
        "content-type": "application/json",
        "authorization": "Bearer TOKEN"
        "clientid": "Your Client ID"
    }
};
        
var req = http.request(options, function (res) {
    var chunks = [];
        
    res.on("data", function (chunk) {
        chunks.push(chunk);
    });
        
    res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
    });
});
        
req.write(params);
req.end();

 $request  = new HttpRequest();
$request->setUrl('https://api.junipayments.com/checkremittancestatus');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
    'authorization' => 'Bearer TOKEN',
    'cientid' => 'Your Client ID',
    'content-type' => 'application/json'
));
                                        
$request->setBody(
    '{ "trans_id": "1644578865398"}'
);
    try {
        $response = $request->send();
        echo $response->getBody();
    } catch (HttpException $ex) {
        echo $ex;
    }