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": "<string>",
"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": "<string>",
"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: '<string>',
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' => '<string>',
'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\": \"<string>\",\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\": \"<string>\",\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\": \"<string>\",\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": "<string>",
"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": "<string>",
"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: '<string>',
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' => '<string>',
'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\": \"<string>\",\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\": \"<string>\",\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\": \"<string>\",\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
Example:
100000
Show child attributes
Show child attributes
A reference code you'll generate to identify this transaction. This must be unique for every transaction. If you don't pass one, we will generate one for you.
Fully qualified URL to which the customer should be redirected after the payment is completed
Example:
"https://example.com/redirect/success"
Show child attributes
Show child attributes
Response
201 - application/json
Request Submitted Successfully
Show child attributes
Show child attributes
⌘I