Naira Cards
All endpoints for Naira cards
This documentation explains how you can issue Naira cards (Mastercard) to your customers, your customers can make global payments worth $1,500 monthly using this card. We'll also be assuming that you have finished the integration process of creating a cardholder to continue this implementation.
Create Card
This API allows you to create an NGN virtual card for an already verified cardholder.
The card pin should be 4 digits and encrypted before passing it as a parameter to call the API to create a card, we use an open-source package called AES-Anywhere for this. The encryption key is the live or test secret key for your account, you can find these keys on the homepage of your dashboard. See Examples Below
$ pip install aes-everywhere
from AesEverywhere import aes256
# encryption
encrypted = aes256.encrypt('4 digit pin', 'Bridgecard Secret Key')
encrypted = encrypted.decode()
print(encrypted)
$ npm install aes-everywhere
var AES256 = require('aes-everywhere');
// or
// import AES256 from 'aes-everywhere';
// encryption
var encrypted = AES256.encrypt('3d secure pin', 'Bridgecard Secret Key')
console.log(encrypted);
$ composer require mervick/aes-everywhere
require '../../vendor/mervick/aes-everywhere/php/src/AES256.php';
use mervick\aesEverywhere\AES256;
$encrypt = AES256::encrypt('3d secure pin', 'Bridgecard Secret Key')
import "github.com/mervick/aes-everywhere/go/aes256"
// encryption
encrypted := aes256.Encrypt("3d secure pin", "Bridgecard Secret Key")
Then use the encrypted details to call the API below
curl -X 'POST' \
'https://issuecards.api.bridgecard.co/v1/issuing/sandbox/cards/create_card' \
-H 'accept: application/json' \
-H 'token: Bearer ******' \
-H 'Content-Type: application/json' \
-d '{
"cardholder_id": "d0658fedf8284207866d96183fa",
"card_type": "virtual" || "physical",
"card_brand": "Mastercard",
"card_currency": "NGN",
"pin" : "39sksksie3902023020dj03020203039",
"nin": "22236748901",
"meta_data": {"user_id": "d0658fedf828420786e4a7083fa"}
}'
import requests
import json
url = "https://issuecards.api.bridgecard.co/v1/issuing/sandbox/cards/create_card"
payload = json.dumps({
"cardholder_id": "d0658fedf8284207866d96183fa",
"card_type": "virtual" || "physical",
"card_brand": "Mastercard",
"card_currency": "NGN",
"pin" : "39sksksie3902023020dj03020203039",
"nin": "22236748901",
"meta_data": {"user_id": "d0658fedf828420786e4a7083fa"}
})
headers = {
'accept': 'application/json',
'token': 'Bearer ******',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://issuecards.api.bridgecard.co/v1/issuing/sandbox/cards/create_card',
'headers': {
'accept': 'application/json',
'token': 'Bearer ******',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"cardholder_id": "d0658fedf8284207866d96183fa",
"card_type": "virtual" || "physical",
"card_brand": "Mastercard",
"card_currency": "NGN",
"pin" : "39sksksie3902023020dj03020203039",
"nin": "22236748901",
"meta_data": {"user_id": "d0658fedf828420786e4a7083fa"}
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://issuecards.api.bridgecard.co/v1/issuing/sandbox/cards/create_card');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'accept' => 'application/json',
'token' => 'Bearer ******',
'Content-Type' => 'application/json'
));
$request->setBody('{\n "cardholder_id": "d0658fedf8284207866d96183fa",\n "card_type": "virtual" || "physical",\n "card_brand": "Mastercard",\n "card_currency": "NGN",\n "meta_data": {"user_id": "d0658fedf828420786e4a7083fa"}\n}, \n"pin" : "39sksksie3902023020dj03020203039", \n"nin" : "22236748901"');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://issuecards.api.bridgecard.co/v1/issuing/sandbox/cards/create_card"
method := "POST"
payload := strings.NewReader(`{
"cardholder_id": "d0658fedf8284207866d96183fa",
"card_type": "virtual" || "physical",
"card_brand": "Mastercard",
"card_currency": "NGN",
"pin" : "39sksksie3902023020dj03020203039",
"nin": "22236748901",
"meta_data": {"user_id": "d0658fedf828420786e4a7083fa"}
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("accept", "application/json")
req.Header.Add("token", "Bearer ******")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Body
cardholder_id : string *required
card_type (can either be "virtual" or "physical") : String *required
card_brand ("Mastercard") : String *required
card_currency ("NGN") : String *required
pin (AES 256 encrypted 4 digit pin): string *required
meta_data : Dictionary *Optional
Response
🟢 200
{
"status": "success",
"message": "The Mastercard NGN card was created successfully",
"data": {
"card_id": "216ef11a58bf468baeb9cdbb94765865",
"currency": "NGN"
}
}
🔴 400: Invalid Cardholder ID
{
"message": "Invalid cardholder ID, there's no cardholder with this ID."
}
🔴 504: ErrorPerfromingOperation
{
"message": "We ran into an error running this operation, please try again.
}
Get Card Details
Use this endpoint to fetch the details for a card you created.
Because a card's data contains sensitive information like the card number, CVV, and expiry date the details are encrypted when they're sent over to you but are decrypted automatically when they get to your server.
We strongly advise that you do not store the card data on your server except if you're PCI-DSS certified.
We have provided you with two endpoints to keep you compliant.
Use these endpoints below when the user doesn't really need to see the card details, for example in a screen where you show them the list of cards they have, or where you display general information about the card like the last 4 digits etc.
sandbox: http://issuecards.api.bridgecard.co/v1/issuing/sandbox/cards/get_card_details
production: http://issuecards.api.bridgecard.co/v1/issuing/cards/get_card_details
You can also use this other endpoint when you need to display the card details to the user may be at the point when they need to make a payment or when they click the view card details button on your app
sandbox:
https://issuecards-api-bridgecard-co.relay.evervault.com/v1/issuing/sandbox/cards/get_card_details
production:
https://issuecards-api-bridgecard-co.relay.evervault.com/v1/issuing/cards/get_card_details
curl --location --request GET 'https://issuecards.api.bridgecard.co/v1/issuing/sandbox/cards/get_card_details?card_id=216ef11a58bf468baeb9cdbb97777777' \
--header 'token: Bearer *****' \
--data-raw ''
import requests
url = "https://issuecards.api.bridgecard.co/v1/issuing/sandbox/cards/get_card_details?card_id=216ef11a58bf468baeb9cdbb97777777"
payload = ""
headers = {
'token': 'Bearer *****'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://issuecards.api.bridgecard.co/v1/issuing/sandbox/cards/get_card_details?card_id=216ef11a58bf468baeb9cdbb97777777',
'headers': {
'token': 'Bearer *****'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://issuecards.api.bridgecard.co/v1/issuing/sandbox/cards/get_card_details?card_id=216ef11a58bf468baeb9cdbb97777777');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'token' => 'Bearer *****'
));
$request->setBody('');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://issuecards.api.bridgecard.co/v1/issuing/sandbox/cards/get_card_details?card_id=216ef11a58bf468baeb9cdbb97777777"
method := "GET"
payload := strings.NewReader(``)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("token", "Bearer *****")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response
🟢 200: card details fetched successfully.
{
"status": "success",
"message": "Card details was fetched successfully",
"data": {
"billing_address": {
"billing_address1": "256 Chapman Road STE 105-4",
"billing_city": "Newark",
"billing_country": "US",
"billing_zip_code": "19702",
"country_code": "US",
"state": "Delaware",
"state_code": "DE"
},
"brand": "Visa",
"card_currency": "USD",
"card_id": "216ef11a58bf468baeb9cdbb947",
"card_name": "John Doe",
"card_number": "ev:RFVC:x9Fyh+9rI0BekZ5i:AgQHRjIQa7BzqhGXYuZwV/lXqiTb8Uq07nBYWWbuu46I:XXbJWyrBwDicifdA3exFewXRLSnR71whuMYKMhj5FVA:$",
"card_type": "virtual",
"cardholder_id": "d0658fedf8284207866d961e4a7083fa",
"created_at": 1659958652,
"cvv": "ev:RFVC:b9Qu3KGE+LBIhZEo:AgQHRjIQa7BzqhGXYuZwV/lXqiTb8Uq07nBYWWbuu46I:BJhJBGa/87QT8YCCLoCWvh9STg:$",
"expiry_month": "ev:RFVC:f24e5mMw/sVAQxtl:AgQHRjIQa7BzqhGXYuZwV/lXqiTb8Uq07nBYWWbuu46I:i05HSrBrHf2hKfn0cUDTcYnX:$",
"expiry_year": "ev:RFVC:2b0lTiBTfLcht3ju:AgQHRjIQa7BzqhGXYuZwV/lXqiTb8Uq07nBYWWbuu46I:JtZ1xVK3hJnFrW+sMjC1P7BP2LY:$",
"is_active": true,
"issuing_app_id": "842352f4-8a6f-4a19-89c6-4e8a240a2355",
"last_4": "8649",
"livemode": false,
"meta_data": {
"user_id": "d0658fedf8284207866d961e4a7083fa"
},
"balance": "0",
"blocked_due_to_fraud": false,
"pin_3ds_activated": true
}
}
🔴 400: Invalid Cardholder ID
{
"message": "Invalid cardholder ID, there's no cardholder with this ID."
}
🔴 504: We ran into an error creating the card
{
"message": "We ran into an error running this operation, please try again."
Get Card Balance
This endpoint can be used to get the balance on the Naira card.
curl -X 'GET' 'https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/get_card_balance?cardholder_id=12jjh2h2bcasdsjhds8s7ssd' \
--header 'accept: application/json' \
--header 'token: Bearer *******'
import requests
url = "https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/get_card_balance?cardholder_id=12jjh2h2bcasdsjhds8s7ssd"
payload={}
headers = {
'accept': 'application/json',
'token': 'Bearer *******'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/get_card_balance?cardholder_id=12jjh2h2bcasdsjhds8s7ssd',
'headers': {
'accept': 'application/json',
'token': 'Bearer *******'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/get_card_balance?cardholder_id=12jjh2h2bcasdsjhds8s7ssd');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'accept' => 'application/json',
'token' => 'Bearer *******'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/get_card_balance?cardholder_id=12jjh2h2bcasdsjhds8s7ssd"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("accept", "application/json")
req.Header.Add("token", "Bearer *******")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response
🟢 200
{
"status": "success",
"message": "Account balance fetched successfully",
"data": {
"available_balance": "0"
}
🔴 400: Invalid Cardholder ID
{
"message": "Invalid cardholder ID, there's no cardholder with this ID."
}
🔴 504: ErrorPerfromingOperation
{
"message": "We ran into an error running this operation, please try again.
}
Get Transaction OTP
A merchant might trigger the 3DS process on a user's card when they try to make a purchase, by asking them to provide an OTP to confirm a transaction. This endpoint allows your users to generate an OTP for a pending amount on their card. All the user has to do is enter the amount and we'll provide them with an OTP if there's a pending transaction on the card for that amount.
The amount should be passed to the API in Kobo and to test the 400 error response you can pass 0 as the amount.
Use these endpoint URLs to fetch the OTP in order to ensure secure transmission of the OTP
sandbox:
https://issuecards-api-bridgecard-co.relay.evervault.com/v1/issuing/sandbox/naira_cards/get_otp_message
production:
https://issuecards-api-bridgecard-co.relay.evervault.com/v1/issuing/naira_cards/get_otp_message
curl --location --request GET 'https://issuecards-api-bridgecard-co.relay.evervault.com/v1/issuing/naira_cards/get_otp_message?card_id=f1a33838939393d33939939e5999&amount=1000' \
--header 'accept: application/json' \
--header 'token: Bearer at_live_****'
import requests
url = "https://issuecards-api-bridgecard-co.relay.evervault.com/v1/issuing/naira_cards/get_otp_message?card_id=f1a33838939393d33939939e5999&amount=1000"
payload = {}
headers = {
'accept': 'application/json',
'token': 'Bearer at_live_****'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://issuecards-api-bridgecard-co.relay.evervault.com/v1/issuing/naira_cards/get_otp_message?card_id=f1a33838939393d33939939e5999&amount=1000',
'headers': {
'accept': 'application/json',
'token': 'Bearer at_live_****'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://issuecards-api-bridgecard-co.relay.evervault.com/v1/issuing/naira_cards/get_otp_message?card_id=f1a33838939393d33939939e5999&amount=1000');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'accept' => 'application/json',
'token' => 'Bearer at_live_****'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://issuecards-api-bridgecard-co.relay.evervault.com/v1/issuing/naira_cards/get_otp_message?card_id=f1a33838939393d33939939e5999&amount=1000"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("accept", "application/json")
req.Header.Add("token", "Bearer at_live_****")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response
🟢 200
{
"status": "success",
"message": "otp fetched successfully.",
"data": {
"otp": "632433"
}
}
🔴 400: No pending OTP
{
"message": "You do not have a pending OTP for this amount on your card, Please confirm the amount you entered is correct and try generating another OTP from the merchant.",
"status": false
}
Fund Naira Card
This endpoint allows you to fund a naira Card from the NGN issuing wallet. Please listen to this webhook event to know whether the card funding was successful or failed.
curl -X 'POST' \
'https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/fund_naira_card' \
-H 'accept: application/json' \
-H 'token: Bearer *********' \
-H 'Content-Type: application/json' \
-d '{
"card_id": "dsjdg7d8s7d78s8auhdskd",
"amount": "100",
"transaction_reference": "473783839939393030"
}'
import requests
import json
url = "https://issuecards.api.bridgecard.co/v1/issuing/naira_cards/fund_naira_card"
payload = json.dumps({
"card_id": "dsjdg7d8s7d78s8auhdskd",
"amount": "100",
"transaction_reference": "473783839939393030"
})
headers = {
'accept': 'application/json',
'token': 'Bearer ********',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://issuecards.api.bridgecard.co/v1/issuing/naira_cards/fund_naira_card',
'headers': {
'accept': 'application/json',
'token': 'sdssda',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"card_id": "dsjdg7d8s7d78s8auhdskd",
"amount": "100",
"transaction_reference": "473783839939393030"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://issuecards.api.bridgecard.co/v1/issuing/naira_cards/fund_naira_card');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'accept' => 'application/json',
'token' => 'sdssda',
'Content-Type' => 'application/json'
));
$request->setBody('{
\n "card_id": "dsjdg7d8s7d78s8auhdskd",
\n "amount": "100",
\n "transaction_reference": "473783839939393030"
\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://issuecards.api.bridgecard.co/v1/issuing/naira_cards/fund_naira_card"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"card_id": "dsjdg7d8s7d78s8auhdskd",`+"
"+`
"amount": "100",`+"
"+`
"transaction_reference": "473783839939393030"`+"
"+`
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("accept", "application/json")
req.Header.Add("token", "sdssda")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response
🟢 202
{
"status": "success",
"message": "Transaction is processing",
"data": {
"transaction_reference": "7e409b3ec10f4ea99fd5bd0a77d07eab"
}
}
🔴 504: ErrorPerfromingOperation
{
"message": "We ran into an error running this operation, please try again.
}
Unload Naira Card
This endpoint allows you to unload funds from a naira card and the funds go back into your NGN issuing wallet. Please listen to this webhook event to know whether the card funding was successful or failed.
curl -X 'PATCH' \
'https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/unload_naira_card' \
-H 'accept: application/json' \
-H 'token: Bearer *********' \
-H 'Content-Type: application/json' \
-d '{
"card_id": "dsjdg7d8s7d78s8auhdskd",
"amount": "100",
"transaction_reference": "473783839939393030"
}'
import requests
import json
url = "https://issuecards.api.bridgecard.co/v1/issuing/naira_cards/unload_naira_card"
payload = json.dumps({
"card_id": "dsjdg7d8s7d78s8auhdskd",
"amount": "100",
"transaction_reference": "473783839939393030"
})
headers = {
'accept': 'application/json',
'token': 'Bearer ********',
'Content-Type': 'application/json'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)
var request = require('request');
var options = {
'method': 'PATCH',
'url': 'https://issuecards.api.bridgecard.co/v1/issuing/naira_cards/unload_naira_card',
'headers': {
'accept': 'application/json',
'token': 'sdssda',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"card_id": "dsjdg7d8s7d78s8auhdskd",
"amount": "100",
"transaction_reference": "473783839939393030"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://issuecards.api.bridgecard.co/v1/issuing/naira_cards/unload_naira_card');
$request->setMethod(HTTP_Request2::METHOD_PATCH);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'accept' => 'application/json',
'token' => 'sdssda',
'Content-Type' => 'application/json'
));
$request->setBody('{
\n "card_id": "dsjdg7d8s7d78s8auhdskd",
\n "amount": "100",
\n "transaction_reference": "473783839939393030"
\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://issuecards.api.bridgecard.co/v1/issuing/naira_cards/unload_naira_card"
method := "PATCH"
payload := strings.NewReader(`{`+"
"+`
"card_id": "dsjdg7d8s7d78s8auhdskd",`+"
"+`
"amount": "100",`+"
"+`
"transaction_reference": "473783839939393030"`+"
"+`
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("accept", "application/json")
req.Header.Add("token", "sdssda")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response
🟢 202
{
"status": "success",
"message": "Transaction is processing",
"data": {
"transaction_reference": "7e409b3ec10f4ea99fd5bd0a77d07eab"
}
}
🔴 504: ErrorPerfromingOperation
{
"message": "We ran into an error running this operation, please try again.
}
Mock a debit transaction
You can use this endpoint to create a debit transaction on a card in the sandbox environment to see how a purchase will look.
curl --location --request PATCH 'https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/mock_debit_naira_card' \
--header 'token: Bearer ****' \
--header 'Content-Type: application/json' \
--data-raw '{
"card_id": "216ef11a58bf468baeb9cdbb965"
}'
import requests
import json
url = "https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/mock_debit_naira_card"
payload = json.dumps({
"card_id": "216ef11a58bf468baeb9cdbb965",
"amount": "0",
"transaction_reference": "216ef11a58bf468baeb9cdbb965",
"currency": "USD"
})
headers = {
'token': 'Bearer *****',
'Content-Type': 'application/json'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)
var request = require('request');
var options = {
'method': 'PATCH',
'url': 'https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/mock_debit_naira_card',
'headers': {
'token': 'Bearer *****',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"card_id": "216ef11a58bf468baeb9cdbb94765865",
"amount": "0",
"transaction_reference": "216ef11a58bf468baeb9cdbb94765111",
"currency": "USD"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/mock_debit_naira_card');
$request->setMethod('PATCH');
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'token' => 'Bearer *****',
'Content-Type' => 'application/json'
));
$request->setBody('{\n "card_id": "216ef11a58bf468baeb9cdbb999030",\n "amount": "0",\n "transaction_reference": "216ef11a58bf468baeb9cdbb94765111",\n "currency": "USD"\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/mock_debit_naira_card"
method := "PATCH"
payload := strings.NewReader(`{
"card_id": "216ef11a58bf468baeb9cdbb94765865",
"amount": "100",
"transaction_reference": "216ef11a58bf468baeb9cdbb94765865",
"currency": "USD"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("token", "Bearer *****")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Response
🟢 200: card was funded successfully.
{
"status": "success",
"message": "Debit transaction was done Successfully",
"data": {
"transaction_reference": "216ef11a58bf468baeb9cdbb94765865"
}
}
🔴 400: Invalid Cardholder ID
{
"message": "Invalid cardholder ID, there's no cardholder with this ID."
}
🔴 400: Transaction reference already exists
{
"message": "This transaction reference exists please enter another reference"
}
🔴 401: Insufficient balance on the card
{
"message": "This card doesn\'t have enough funds to sufficient balance to perform this operation"
}
🔴 504: We ran into an error unloading the card
{
"message": "We ran into an error running this operation, please try again.
}
Freeze Card
This endpoint allows your users to freeze their card. After freezing a card the is_active
field in the get card details endpoint is immediately updated to False
.
curl --location --request PATCH 'https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/freeze_card?card_id=3d0220250f6b4addbfef1c5ffa39250b' \
--header 'token: Bearer *****' \
--data-raw ''
import requests
url = "https://issuecards.api.bridgecard.co/v1/issuing/sandbox/naira_cards/freeze_card?card_id=3d0220250f6b4addbfef1c5ffa39250b"
payload = ""
headers = {
'token': 'Bearer *****'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)