Tokenize a Card
curl --request POST \
--url https://seerbitapi.com/api/v2/payments/tokenize \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"publicKey": "SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT",
"amount": "0.00",
"fullName": "john doe",
"mobileNumber": 8033456599,
"currency": "NGN",
"country": "NG",
"paymentReference": "KES0092992991",
"email": "johndoe@gmail.com",
"productId": "Foods",
"productDescription": "RASPBERRY",
"cardNumber": "5123450000000008",
"cvv": "100",
"expiryMonth": "05",
"expiryYear": "21"
}
'import requests
url = "https://seerbitapi.com/api/v2/payments/tokenize"
payload = {
"publicKey": "SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT",
"amount": "0.00",
"fullName": "john doe",
"mobileNumber": 8033456599,
"currency": "NGN",
"country": "NG",
"paymentReference": "KES0092992991",
"email": "johndoe@gmail.com",
"productId": "Foods",
"productDescription": "RASPBERRY",
"cardNumber": "5123450000000008",
"cvv": "100",
"expiryMonth": "05",
"expiryYear": "21"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
publicKey: 'SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT',
amount: '0.00',
fullName: 'john doe',
mobileNumber: 8033456599,
currency: 'NGN',
country: 'NG',
paymentReference: 'KES0092992991',
email: 'johndoe@gmail.com',
productId: 'Foods',
productDescription: 'RASPBERRY',
cardNumber: '5123450000000008',
cvv: '100',
expiryMonth: '05',
expiryYear: '21'
})
};
fetch('https://seerbitapi.com/api/v2/payments/tokenize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://seerbitapi.com/api/v2/payments/tokenize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'publicKey' => 'SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT',
'amount' => '0.00',
'fullName' => 'john doe',
'mobileNumber' => 8033456599,
'currency' => 'NGN',
'country' => 'NG',
'paymentReference' => 'KES0092992991',
'email' => 'johndoe@gmail.com',
'productId' => 'Foods',
'productDescription' => 'RASPBERRY',
'cardNumber' => '5123450000000008',
'cvv' => '100',
'expiryMonth' => '05',
'expiryYear' => '21'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://seerbitapi.com/api/v2/payments/tokenize"
payload := strings.NewReader("{\n \"publicKey\": \"SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT\",\n \"amount\": \"0.00\",\n \"fullName\": \"john doe\",\n \"mobileNumber\": 8033456599,\n \"currency\": \"NGN\",\n \"country\": \"NG\",\n \"paymentReference\": \"KES0092992991\",\n \"email\": \"johndoe@gmail.com\",\n \"productId\": \"Foods\",\n \"productDescription\": \"RASPBERRY\",\n \"cardNumber\": \"5123450000000008\",\n \"cvv\": \"100\",\n \"expiryMonth\": \"05\",\n \"expiryYear\": \"21\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://seerbitapi.com/api/v2/payments/tokenize")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"publicKey\": \"SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT\",\n \"amount\": \"0.00\",\n \"fullName\": \"john doe\",\n \"mobileNumber\": 8033456599,\n \"currency\": \"NGN\",\n \"country\": \"NG\",\n \"paymentReference\": \"KES0092992991\",\n \"email\": \"johndoe@gmail.com\",\n \"productId\": \"Foods\",\n \"productDescription\": \"RASPBERRY\",\n \"cardNumber\": \"5123450000000008\",\n \"cvv\": \"100\",\n \"expiryMonth\": \"05\",\n \"expiryYear\": \"21\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://seerbitapi.com/api/v2/payments/tokenize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"publicKey\": \"SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT\",\n \"amount\": \"0.00\",\n \"fullName\": \"john doe\",\n \"mobileNumber\": 8033456599,\n \"currency\": \"NGN\",\n \"country\": \"NG\",\n \"paymentReference\": \"KES0092992991\",\n \"email\": \"johndoe@gmail.com\",\n \"productId\": \"Foods\",\n \"productDescription\": \"RASPBERRY\",\n \"cardNumber\": \"5123450000000008\",\n \"cvv\": \"100\",\n \"expiryMonth\": \"05\",\n \"expiryYear\": \"21\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"data": {
"code": "S20",
"payments": {
"paymentReference": "KES0092992991",
"linkingReference": "SEERBIT428813491603106540088",
"status": "TOKENIZED",
"card": {
"bin": "512345",
"last4": "0008",
"token": "tk_fa12ee73-9807-4a8a-bc91-8e81ca3c47ce"
}
}
}
}TOKENIZE
Tokenize a Card
In order to store your customers payment details, you need to pass some additional parameter when making the first payment request using the payments/tokenize endpoint, the Cvv field and pin are optional(this could be null). After the first payment is made, the payment details is collected and a token is generated for it which is then stored for future use.
POST
/
payments
/
tokenize
Tokenize a Card
curl --request POST \
--url https://seerbitapi.com/api/v2/payments/tokenize \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"publicKey": "SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT",
"amount": "0.00",
"fullName": "john doe",
"mobileNumber": 8033456599,
"currency": "NGN",
"country": "NG",
"paymentReference": "KES0092992991",
"email": "johndoe@gmail.com",
"productId": "Foods",
"productDescription": "RASPBERRY",
"cardNumber": "5123450000000008",
"cvv": "100",
"expiryMonth": "05",
"expiryYear": "21"
}
'import requests
url = "https://seerbitapi.com/api/v2/payments/tokenize"
payload = {
"publicKey": "SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT",
"amount": "0.00",
"fullName": "john doe",
"mobileNumber": 8033456599,
"currency": "NGN",
"country": "NG",
"paymentReference": "KES0092992991",
"email": "johndoe@gmail.com",
"productId": "Foods",
"productDescription": "RASPBERRY",
"cardNumber": "5123450000000008",
"cvv": "100",
"expiryMonth": "05",
"expiryYear": "21"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
publicKey: 'SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT',
amount: '0.00',
fullName: 'john doe',
mobileNumber: 8033456599,
currency: 'NGN',
country: 'NG',
paymentReference: 'KES0092992991',
email: 'johndoe@gmail.com',
productId: 'Foods',
productDescription: 'RASPBERRY',
cardNumber: '5123450000000008',
cvv: '100',
expiryMonth: '05',
expiryYear: '21'
})
};
fetch('https://seerbitapi.com/api/v2/payments/tokenize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://seerbitapi.com/api/v2/payments/tokenize",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'publicKey' => 'SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT',
'amount' => '0.00',
'fullName' => 'john doe',
'mobileNumber' => 8033456599,
'currency' => 'NGN',
'country' => 'NG',
'paymentReference' => 'KES0092992991',
'email' => 'johndoe@gmail.com',
'productId' => 'Foods',
'productDescription' => 'RASPBERRY',
'cardNumber' => '5123450000000008',
'cvv' => '100',
'expiryMonth' => '05',
'expiryYear' => '21'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://seerbitapi.com/api/v2/payments/tokenize"
payload := strings.NewReader("{\n \"publicKey\": \"SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT\",\n \"amount\": \"0.00\",\n \"fullName\": \"john doe\",\n \"mobileNumber\": 8033456599,\n \"currency\": \"NGN\",\n \"country\": \"NG\",\n \"paymentReference\": \"KES0092992991\",\n \"email\": \"johndoe@gmail.com\",\n \"productId\": \"Foods\",\n \"productDescription\": \"RASPBERRY\",\n \"cardNumber\": \"5123450000000008\",\n \"cvv\": \"100\",\n \"expiryMonth\": \"05\",\n \"expiryYear\": \"21\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://seerbitapi.com/api/v2/payments/tokenize")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"publicKey\": \"SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT\",\n \"amount\": \"0.00\",\n \"fullName\": \"john doe\",\n \"mobileNumber\": 8033456599,\n \"currency\": \"NGN\",\n \"country\": \"NG\",\n \"paymentReference\": \"KES0092992991\",\n \"email\": \"johndoe@gmail.com\",\n \"productId\": \"Foods\",\n \"productDescription\": \"RASPBERRY\",\n \"cardNumber\": \"5123450000000008\",\n \"cvv\": \"100\",\n \"expiryMonth\": \"05\",\n \"expiryYear\": \"21\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://seerbitapi.com/api/v2/payments/tokenize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"publicKey\": \"SBPUBK_OMX6ZNRZPLIHQ9Y0ZG6FCNR0EAYIGIAT\",\n \"amount\": \"0.00\",\n \"fullName\": \"john doe\",\n \"mobileNumber\": 8033456599,\n \"currency\": \"NGN\",\n \"country\": \"NG\",\n \"paymentReference\": \"KES0092992991\",\n \"email\": \"johndoe@gmail.com\",\n \"productId\": \"Foods\",\n \"productDescription\": \"RASPBERRY\",\n \"cardNumber\": \"5123450000000008\",\n \"cvv\": \"100\",\n \"expiryMonth\": \"05\",\n \"expiryYear\": \"21\"\n}"
response = http.request(request)
puts response.read_body{
"status": "SUCCESS",
"data": {
"code": "S20",
"payments": {
"paymentReference": "KES0092992991",
"linkingReference": "SEERBIT428813491603106540088",
"status": "TOKENIZED",
"card": {
"bin": "512345",
"last4": "0008",
"token": "tk_fa12ee73-9807-4a8a-bc91-8e81ca3c47ce"
}
}
}
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
application/json
The body is of type object.
Response
The response is of type CheckStatusResponse · object.