Create a Subscription
curl --request POST \
--url https://api-sandbox.pavewaygroup.com/v1/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "<string>",
"plan_id": "<string>",
"payment_method": "<string>",
"mobile_money.phone": "<string>",
"mobile_money.network": "<string>",
"card.token": "<string>",
"fee_bearer": "<string>",
"is_internal": true
}
'import requests
url = "https://api-sandbox.pavewaygroup.com/v1/subscriptions"
payload = {
"customer_id": "<string>",
"plan_id": "<string>",
"payment_method": "<string>",
"mobile_money.phone": "<string>",
"mobile_money.network": "<string>",
"card.token": "<string>",
"fee_bearer": "<string>",
"is_internal": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '<string>',
plan_id: '<string>',
payment_method: '<string>',
'mobile_money.phone': '<string>',
'mobile_money.network': '<string>',
'card.token': '<string>',
fee_bearer: '<string>',
is_internal: true
})
};
fetch('https://api-sandbox.pavewaygroup.com/v1/subscriptions', 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://api-sandbox.pavewaygroup.com/v1/subscriptions",
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([
'customer_id' => '<string>',
'plan_id' => '<string>',
'payment_method' => '<string>',
'mobile_money.phone' => '<string>',
'mobile_money.network' => '<string>',
'card.token' => '<string>',
'fee_bearer' => '<string>',
'is_internal' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api-sandbox.pavewaygroup.com/v1/subscriptions"
payload := strings.NewReader("{\n \"customer_id\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"mobile_money.phone\": \"<string>\",\n \"mobile_money.network\": \"<string>\",\n \"card.token\": \"<string>\",\n \"fee_bearer\": \"<string>\",\n \"is_internal\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api-sandbox.pavewaygroup.com/v1/subscriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"mobile_money.phone\": \"<string>\",\n \"mobile_money.network\": \"<string>\",\n \"card.token\": \"<string>\",\n \"fee_bearer\": \"<string>\",\n \"is_internal\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.pavewaygroup.com/v1/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"mobile_money.phone\": \"<string>\",\n \"mobile_money.network\": \"<string>\",\n \"card.token\": \"<string>\",\n \"fee_bearer\": \"<string>\",\n \"is_internal\": true\n}"
response = http.request(request)
puts response.read_body{
"status_code": 200,
"data": {
"id": "sub_123...",
"status": "active",
"amount": 5000,
"current_period_end": "2024-02-01T12:00:00Z",
"current_invoice": {
"status": "paid",
"amount": 5000
}
}
}
Subscriptions API
Create a Subscription
Start a recurring billing relationship with a customer.
POST
/
subscriptions
Create a Subscription
curl --request POST \
--url https://api-sandbox.pavewaygroup.com/v1/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "<string>",
"plan_id": "<string>",
"payment_method": "<string>",
"mobile_money.phone": "<string>",
"mobile_money.network": "<string>",
"card.token": "<string>",
"fee_bearer": "<string>",
"is_internal": true
}
'import requests
url = "https://api-sandbox.pavewaygroup.com/v1/subscriptions"
payload = {
"customer_id": "<string>",
"plan_id": "<string>",
"payment_method": "<string>",
"mobile_money.phone": "<string>",
"mobile_money.network": "<string>",
"card.token": "<string>",
"fee_bearer": "<string>",
"is_internal": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '<string>',
plan_id: '<string>',
payment_method: '<string>',
'mobile_money.phone': '<string>',
'mobile_money.network': '<string>',
'card.token': '<string>',
fee_bearer: '<string>',
is_internal: true
})
};
fetch('https://api-sandbox.pavewaygroup.com/v1/subscriptions', 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://api-sandbox.pavewaygroup.com/v1/subscriptions",
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([
'customer_id' => '<string>',
'plan_id' => '<string>',
'payment_method' => '<string>',
'mobile_money.phone' => '<string>',
'mobile_money.network' => '<string>',
'card.token' => '<string>',
'fee_bearer' => '<string>',
'is_internal' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api-sandbox.pavewaygroup.com/v1/subscriptions"
payload := strings.NewReader("{\n \"customer_id\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"mobile_money.phone\": \"<string>\",\n \"mobile_money.network\": \"<string>\",\n \"card.token\": \"<string>\",\n \"fee_bearer\": \"<string>\",\n \"is_internal\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api-sandbox.pavewaygroup.com/v1/subscriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"mobile_money.phone\": \"<string>\",\n \"mobile_money.network\": \"<string>\",\n \"card.token\": \"<string>\",\n \"fee_bearer\": \"<string>\",\n \"is_internal\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.pavewaygroup.com/v1/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"<string>\",\n \"plan_id\": \"<string>\",\n \"payment_method\": \"<string>\",\n \"mobile_money.phone\": \"<string>\",\n \"mobile_money.network\": \"<string>\",\n \"card.token\": \"<string>\",\n \"fee_bearer\": \"<string>\",\n \"is_internal\": true\n}"
response = http.request(request)
puts response.read_body{
"status_code": 200,
"data": {
"id": "sub_123...",
"status": "active",
"amount": 5000,
"current_period_end": "2024-02-01T12:00:00Z",
"current_invoice": {
"status": "paid",
"amount": 5000
}
}
}
Request Body
The PaveWay ID of the customer (
cus_...).The ID of the plan to subscribe to.
card or mobile_money.Mobile Money Options
Phone number for USSD prompts.
MTN, ORANGE, AIRTEL, etc.Card Options
The card token (
tok_...) obtained from a previous one-time payment.Specifies who bears the transaction fees.
merchant: Fees are deducted from the payout.customer: Fees are added to the transaction amount.
Flag to indicate if the business is an internal PaveWay application. If true, the platform fee is reduced to 0.5%.
Response
{
"status_code": 200,
"data": {
"id": "sub_123...",
"status": "active",
"amount": 5000,
"current_period_end": "2024-02-01T12:00:00Z",
"current_invoice": {
"status": "paid",
"amount": 5000
}
}
}
⌘I

