API Reference

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. Using the Juni Payment test mode does not affect your live data or interact with the banking networks. The API key you use to authenticate the request determines whether the request is live mode or test mode.

Base Url

https://api.junipayments.com


Authentication

You can view and manage your API keys in the Juni Payement Dashboard. Authenticate your API calls by including your secret key in the Authorization header of every request you make.

We provide both public and secret keys, Public keys are from your front-end when integrating using our Juni Payment Inline.

Authorization headers should be in the following format: Authorization: Bearer SECRET_KEY

All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.


Bank Codes

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

CodeBank
2001 Access Bank
2003 Agricultural Development Bank Limited
2004 ARB Apex Bank Limited
2005 Bank of Africa
2006 Bank of Ghana
2002 Barclays Bank Ghana
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 Sahel Sahara Bank (BSIC)
2021 United Bank of Africa
2022 Universal Merchant Bank Limited
2023 Zenith Bank (Ghana) Limited

Transfers Recipients

This allows you to create and manage those who will receive transfers

Create Transfers Recipient

create a receipient

Headers

Authorization String Set value to Bearer SECRET_KEY
Content-Type String Set value to application/json

Params

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
Customer
 curl -X POST \
  https://api.junipayments.com/customer \

  -H 'authorization: Bearer SECRET_KEY' \
-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 SECRET_KEY"
    }
};
        
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 SECRET_KEY',
    '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;
    }     

Transfers

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

Note. In order to transfer money, you need to run the resolve endpoint to ensure the validity of the phone number or bank account number you are transfering money to.

Verify account

resolve

This allows you to verify if a phone number or account number is valid

Headers

Authorization String Set value to Bearer SECRET_KEY

Params

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

  -H 'authorization: Bearer SECRET_KEY' \

                                    

var request = require("request");

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

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' => '0248813184',
    'provider' => 'mtn'
));

$request->setHeaders(array(
    'cache-control' => 'no-cache',
    'authorization' => 'Bearer SECRET_KEY'
));

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

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

Transfer

Headers
Authorization String Set value to Bearer SECRET_KEY
Content-Type String Set value to application/json
Params
channel String Chanel to transfer money to, either moblie_money or bank_transfer
recipient String Code for transfer recipient
amount Double Amount to transfer in Cedis
reason String The reason for the transfer
Transfer
 curl -X POST \
https://api.junipayments.com/transfer \
-H 'authorization: Bearer SECRET_KEY' \
-H 'content-type: application/json' \
-d '{
    "channel": "bank_transfer",
    "bank_code": "300322",
    "amount": "1",
    "account_number": "0000000000000",
    "sender": "Amina Atta",
    "foreignID": "234322",
    "callbackUrl": "https://yoururl/callbackUrl",
    "receiver": "John Doe"
}'
                

var http = require("https");

var options = {
    "method": "POST",
    "hostname": "https://api.junipayments.com",
    "port": "3000",
    "path": "/transfer",
    "headers": {
        "content-type": "application/json",
        "authorization": "Bearer SECRET_KEY"
    }
};
                                        
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_transfer',
    bank_code: '300322',
    amount: '1000',
    account_number: '0000000000000',
    sender: 'John Doe',
    foreignID: '234322',
    callbackUrl: 'https://yoururl/callbackUrl',
    receiver: 'Amina Atta' 
}));

req.end();

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

Accept Payments

To accept a payment, create a transaction using our Popup JS. Every transaction includes a link that can be used to complete payment.

Popup

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

Pay now

Collect customer information

To initialize the transaction, you'll need to pass the payee's email, amount and key. Email and amount and key are required. Here is the full list of parameters you can pass

First embed JuniPay inline.js in the header of your page where payment is to be made

https//:junipayments.com/inline.js
Params
key String Your public key from junipayments. Use test key for test mode and live key for live mode
email String Email address of customer
amount Double Amount (in the lowest currency value - kobo, pesewas or cent) you are debiting customer. Do not pass this if creating subscriptions.
onClose No Javascript function that is called if the customer closes the payment window instead of making a payment.

Types of payment checkout

 
// Code snippet to call the default payment form      

function payWithJuni() {
  var handler = JuniPop.setup({
    key: public_key, //put your public key here
    email: 'customer@email.com', //put your customer's email here
    amount: 1, //amount the customer is supposed to pay 
    color: "white", //form background color you prefer
    desc: "payment for service",
    tax: 0.2, //tax amount you are charging for product or service
    total_amt: 1.2,
    onClose: function() {
        alert('Transaction cancelled');
    }
 });
}
// Default way of using the default payment form from Junipayments. your Button must have onclick function payWithJuni. example onclick="payWithJuni();"
    
    
 

// Code snippet to call the blue payment form     

function payWithJuniBlue() {
var handler = JuniPop.setup({
    key: public_key, //put your public key here
    email: 'customer@email.com', //put your customer's email here
    amount: 1, //amount the customer is supposed to pay 
    color: "blue", //form background color you prefer
    desc: "payment for service",
    tax: 0.2, //tax amount you are charging for product or service
    total_amt: 1.2,
    onClose: function() {
        alert('Transaction cancelled');
    }
});
}
// Pay button must have onclick function payWithJuniBlue to use the blue payment form. example  onclick="payWithJuniBlue();"

 

// Code snippet to call the red payment form   

function payWithJuniRed() {
var handler = JuniPop.setup({
    key: public_key, //put your public key here
    email: 'customer@email.com', //put your customer's email here
    amount: 1, //amount the customer is supposed to pay 
    color: "red", //form background color you prefer
    desc: "payment for service",
    tax: 0.2, //tax amount you are charging for product or service
    total_amt: 1.2,
    onClose: function() {
        alert('Transaction cancelled');
    }
});
}
// Pay button must have onclick function payWithJuniRed to use the Red payment form. example  onclick="payWithJuniRed();"

In this sample, notice how:

  • The Junipayments inline javascript is included using a script tag. This is how you import Junipayments into your code.
  • The amount here can be hardcoded if you want to charge a specific amount.
  • The Pay button has been tied to an onClick function called pay With Junipayments. This is the action that causes the Junipayments popup to load.
  • Mobile Money Transactions

    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.

    Remmitance

    This API serves as the primary gateway to facilitate money transfers through JuniPay's platform. The Money Transfer API is organized according to REST principles and provides the following functionality:

    Base Url

    https://api.junipayments.com/sendremittance

    Collect

    Make it easier for your customers to get paid from overseas, reducing the financial risk associated with international transfers and receive funds faster with local bank account numbers.

    Sender details

  • Firstname
  • Lastname
  • Email
  • Phone number
  • Country
  • Currency
  • Sender amount
  • Recieve amount
  • Recipient details

  • Full name
  • Email
  • Phone number
  • Headers

    Authorization String Set value to Bearer SECRET_KEY
    Content-Type String Set value to application/json
    Params
    sender_firstName String First Name of the sender
    sender_lastName String Last name of sender
    sender_email String Email of the sender
    sender_phoneNumber String Phone number of sender
    sender_country String Country of sender
    channel String Chanel to transfer money to, either momo or bank
    rec_fullName String Full name of receiver
    rec_phoneNumber String Phone number of receiver if channel is momo
    rec_provider String Provider of receiver if channel is momo
    rec_bankName String Bank name of receiver if channel is bank
    rec_bankNumber String Bank account number of receiver if channel is bank
    reason String Reason for sending Remittance
    sendAmount Double Amount to be sent, in Cedis

    Transfer
     curl --location --request POST 'https://api.junipayments.com/sendremittance' \
      --header 'Content-Type: application/json' \
      --header 'Authorization: Bearer sk_live_809ee8446b3f72eab112ada338cca82a49e7015f361f8653c5a27c4589daad59dc555f158c4d9033' \
      --data-raw '{
      "sender_phoneNumber": "+1-202-555-0194",
      "sender_firstName": "John",
      "sender_lastName": "Doe",
      "sender_email": "sender@example.com",
      "sender_country": "USA",
      "channel": "mobile_money",
      "rec_provider": "mtn",
      "rec_phoneNumber": "0248813184",
      "rec_fullName": "Antoinnette Tettey",
      "sendAmount": 1,
      "desc": "Miscellaneous"
      }
                                                        
                                                          
                                    
    
                    var unirest = require("unirest");
                    var req = unirest("POST", "https://api.junipayments.com/sendremittance");
                                                            
                    req.headers({
                        "cache-control": "no-cache",
                        "authorization": "Bearer SECRET_KEY",
                        "content-type": "application/json"
                    });
                                                            
                    req.type("json");
                    req.send({
                      "sender_phoneNumber": "0240000826",
                      "sender_firstName": "John",
                      "sender_lastName": "Doe",
                      "sender_email": "sender@example.com",
                      "sender_country": "USA",
                      "channel": "momo",
                      "rec_provider": "mtn",
                      "rec_phoneNumber": "0240000004",
                      "rec_fullName": "Antoinnette Tettey",
                      "rec_email": "receiver@example.com",
                      "sendAmount": 200,
                      "reason": "Miscellaneous"
                    });
                                                            
                    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 SECRET_KEY',
                    'content-type' => 'application/json'
                    ));
                                        
                    $request->setBody(
                    '"sender_phoneNumber": "0240000826",
                    "sender_firstName": "John",
                    "sender_lastName": "Doe",
                    "sender_email": "sender@example.com",
                    "sender_country": "USA",
                    "channel": "momo",
                    "rec_provider": "mtn",
                    "rec_phoneNumber": "0240000004",
                    "rec_fullName": "Antoinnette Tettey",
                    "rec_email": "receiver@example.com",
                    "sendAmount": 200,
                    "reason": "Miscellaneous"'
                    );
                    try {
                    $response = $request->send();
                    echo $response->getBody();
                    } catch (HttpException $ex) {
                    echo $ex;
                    }     
                    
    >