Collection API - Direct
curl --request POST \
--url https://sandbox-api.payfonte.com/payments/v1/payments/direct-charge \
--header 'Content-Type: application/json' \
--header 'client-id: <api-key>' \
--header 'client-secret: <api-key>' \
--data '
{
"provider": "airtel-smartcash-ng",
"amount": 100000,
"customerInput": {
"phoneNumber": "2347012345678"
},
"reference": "<string>",
"redirectURL": "https://example.com/redirect/success",
"webhook": "https://example.com/webhook",
"metadata": {
"merchantName": "Karis Clothing",
"trafficType": "ECOMMERCE"
}
}
'import requests
url = "https://sandbox-api.payfonte.com/payments/v1/payments/direct-charge"
payload = {
"provider": "airtel-smartcash-ng",
"amount": 100000,
"customerInput": { "phoneNumber": "2347012345678" },
"reference": "<string>",
"redirectURL": "https://example.com/redirect/success",
"webhook": "https://example.com/webhook",
"metadata": {
"merchantName": "Karis Clothing",
"trafficType": "ECOMMERCE"
}
}
headers = {
"client-id": "<api-key>",
"client-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'client-id': '<api-key>',
'client-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
provider: 'airtel-smartcash-ng',
amount: 100000,
customerInput: {phoneNumber: '2347012345678'},
reference: '<string>',
redirectURL: 'https://example.com/redirect/success',
webhook: 'https://example.com/webhook',
metadata: {merchantName: 'Karis Clothing', trafficType: 'ECOMMERCE'}
})
};
fetch('https://sandbox-api.payfonte.com/payments/v1/payments/direct-charge', 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://sandbox-api.payfonte.com/payments/v1/payments/direct-charge",
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([
'provider' => 'airtel-smartcash-ng',
'amount' => 100000,
'customerInput' => [
'phoneNumber' => '2347012345678'
],
'reference' => '<string>',
'redirectURL' => 'https://example.com/redirect/success',
'webhook' => 'https://example.com/webhook',
'metadata' => [
'merchantName' => 'Karis Clothing',
'trafficType' => 'ECOMMERCE'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"client-id: <api-key>",
"client-secret: <api-key>"
],
]);
$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://sandbox-api.payfonte.com/payments/v1/payments/direct-charge"
payload := strings.NewReader("{\n \"provider\": \"airtel-smartcash-ng\",\n \"amount\": 100000,\n \"customerInput\": {\n \"phoneNumber\": \"2347012345678\"\n },\n \"reference\": \"<string>\",\n \"redirectURL\": \"https://example.com/redirect/success\",\n \"webhook\": \"https://example.com/webhook\",\n \"metadata\": {\n \"merchantName\": \"Karis Clothing\",\n \"trafficType\": \"ECOMMERCE\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client-id", "<api-key>")
req.Header.Add("client-secret", "<api-key>")
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://sandbox-api.payfonte.com/payments/v1/payments/direct-charge")
.header("client-id", "<api-key>")
.header("client-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"airtel-smartcash-ng\",\n \"amount\": 100000,\n \"customerInput\": {\n \"phoneNumber\": \"2347012345678\"\n },\n \"reference\": \"<string>\",\n \"redirectURL\": \"https://example.com/redirect/success\",\n \"webhook\": \"https://example.com/webhook\",\n \"metadata\": {\n \"merchantName\": \"Karis Clothing\",\n \"trafficType\": \"ECOMMERCE\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.payfonte.com/payments/v1/payments/direct-charge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client-id"] = '<api-key>'
request["client-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"airtel-smartcash-ng\",\n \"amount\": 100000,\n \"customerInput\": {\n \"phoneNumber\": \"2347012345678\"\n },\n \"reference\": \"<string>\",\n \"redirectURL\": \"https://example.com/redirect/success\",\n \"webhook\": \"https://example.com/webhook\",\n \"metadata\": {\n \"merchantName\": \"Karis Clothing\",\n \"trafficType\": \"ECOMMERCE\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"reference": "<string>",
"status": "<string>",
"sessionId": "<string>",
"amount": 100000
}
}Collections
Collection API - Direct
Charge the Customer via API
POST
/
payments
/
v1
/
payments
/
direct-charge
Collection API - Direct
curl --request POST \
--url https://sandbox-api.payfonte.com/payments/v1/payments/direct-charge \
--header 'Content-Type: application/json' \
--header 'client-id: <api-key>' \
--header 'client-secret: <api-key>' \
--data '
{
"provider": "airtel-smartcash-ng",
"amount": 100000,
"customerInput": {
"phoneNumber": "2347012345678"
},
"reference": "<string>",
"redirectURL": "https://example.com/redirect/success",
"webhook": "https://example.com/webhook",
"metadata": {
"merchantName": "Karis Clothing",
"trafficType": "ECOMMERCE"
}
}
'import requests
url = "https://sandbox-api.payfonte.com/payments/v1/payments/direct-charge"
payload = {
"provider": "airtel-smartcash-ng",
"amount": 100000,
"customerInput": { "phoneNumber": "2347012345678" },
"reference": "<string>",
"redirectURL": "https://example.com/redirect/success",
"webhook": "https://example.com/webhook",
"metadata": {
"merchantName": "Karis Clothing",
"trafficType": "ECOMMERCE"
}
}
headers = {
"client-id": "<api-key>",
"client-secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'client-id': '<api-key>',
'client-secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
provider: 'airtel-smartcash-ng',
amount: 100000,
customerInput: {phoneNumber: '2347012345678'},
reference: '<string>',
redirectURL: 'https://example.com/redirect/success',
webhook: 'https://example.com/webhook',
metadata: {merchantName: 'Karis Clothing', trafficType: 'ECOMMERCE'}
})
};
fetch('https://sandbox-api.payfonte.com/payments/v1/payments/direct-charge', 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://sandbox-api.payfonte.com/payments/v1/payments/direct-charge",
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([
'provider' => 'airtel-smartcash-ng',
'amount' => 100000,
'customerInput' => [
'phoneNumber' => '2347012345678'
],
'reference' => '<string>',
'redirectURL' => 'https://example.com/redirect/success',
'webhook' => 'https://example.com/webhook',
'metadata' => [
'merchantName' => 'Karis Clothing',
'trafficType' => 'ECOMMERCE'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"client-id: <api-key>",
"client-secret: <api-key>"
],
]);
$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://sandbox-api.payfonte.com/payments/v1/payments/direct-charge"
payload := strings.NewReader("{\n \"provider\": \"airtel-smartcash-ng\",\n \"amount\": 100000,\n \"customerInput\": {\n \"phoneNumber\": \"2347012345678\"\n },\n \"reference\": \"<string>\",\n \"redirectURL\": \"https://example.com/redirect/success\",\n \"webhook\": \"https://example.com/webhook\",\n \"metadata\": {\n \"merchantName\": \"Karis Clothing\",\n \"trafficType\": \"ECOMMERCE\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("client-id", "<api-key>")
req.Header.Add("client-secret", "<api-key>")
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://sandbox-api.payfonte.com/payments/v1/payments/direct-charge")
.header("client-id", "<api-key>")
.header("client-secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"provider\": \"airtel-smartcash-ng\",\n \"amount\": 100000,\n \"customerInput\": {\n \"phoneNumber\": \"2347012345678\"\n },\n \"reference\": \"<string>\",\n \"redirectURL\": \"https://example.com/redirect/success\",\n \"webhook\": \"https://example.com/webhook\",\n \"metadata\": {\n \"merchantName\": \"Karis Clothing\",\n \"trafficType\": \"ECOMMERCE\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.payfonte.com/payments/v1/payments/direct-charge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["client-id"] = '<api-key>'
request["client-secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"provider\": \"airtel-smartcash-ng\",\n \"amount\": 100000,\n \"customerInput\": {\n \"phoneNumber\": \"2347012345678\"\n },\n \"reference\": \"<string>\",\n \"redirectURL\": \"https://example.com/redirect/success\",\n \"webhook\": \"https://example.com/webhook\",\n \"metadata\": {\n \"merchantName\": \"Karis Clothing\",\n \"trafficType\": \"ECOMMERCE\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"reference": "<string>",
"status": "<string>",
"sessionId": "<string>",
"amount": 100000
}
}Body
application/json
This is the provider we are routing the request through. Find full list of providers here Supported Providers
Examples:
"airtel-smartcash-ng"
"mtn-momo-ivory-coast"
Amount should be sent in the lowest denomination e.g for 100 USD you should send 100 * 100 = 10000. See Amount Specification.
Example:
100000
This is a URL, if this is passed we will send the event webhook payload to this endpoint. Use this to override the webhook url provided on the dashboard for this transaction. Read more on Webhooks
Example:
"https://example.com/webhook"