Change Plan
curl --request POST \
--url https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"newPlanCode": "PLAN-XY99ZZ00",
"effective": "NEXT_CYCLE",
"prorate": true
}
'import requests
url = "https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan"
payload = {
"newPlanCode": "PLAN-XY99ZZ00",
"effective": "NEXT_CYCLE",
"prorate": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({newPlanCode: 'PLAN-XY99ZZ00', effective: 'NEXT_CYCLE', prorate: true})
};
fetch('https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan', 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.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan",
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([
'newPlanCode' => 'PLAN-XY99ZZ00',
'effective' => 'NEXT_CYCLE',
'prorate' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan"
payload := strings.NewReader("{\n \"newPlanCode\": \"PLAN-XY99ZZ00\",\n \"effective\": \"NEXT_CYCLE\",\n \"prorate\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"newPlanCode\": \"PLAN-XY99ZZ00\",\n \"effective\": \"NEXT_CYCLE\",\n \"prorate\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"newPlanCode\": \"PLAN-XY99ZZ00\",\n \"effective\": \"NEXT_CYCLE\",\n \"prorate\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Plan change scheduled",
"data": {
"id": 3,
"status": "ACTIVE",
"pendingPlanId": 8,
"nextChargeDate": "2026-07-30T10:00:00"
}
}Subscription Lifecycle
Change Plan
This changes the subscription to another pricing plan either immediately or at the next billing cycle.
Notes:
effectivedefaults to NEXT_CYCLE if not supplied.- When
effectiveis NEXT_CYCLE, the new plan is stored as the pending plan and becomes active at the next successful billing cycle. - When
effectiveis IMMEDIATELY, the subscription is switched to the new plan immediately. - Attempting to change to the current plan or modifying a terminal subscription returns a validation error.
POST
/
subscription
/
api
/
v1
/
subscriptions
/
{id}
/
change-plan
Change Plan
curl --request POST \
--url https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"newPlanCode": "PLAN-XY99ZZ00",
"effective": "NEXT_CYCLE",
"prorate": true
}
'import requests
url = "https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan"
payload = {
"newPlanCode": "PLAN-XY99ZZ00",
"effective": "NEXT_CYCLE",
"prorate": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({newPlanCode: 'PLAN-XY99ZZ00', effective: 'NEXT_CYCLE', prorate: true})
};
fetch('https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan', 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.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan",
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([
'newPlanCode' => 'PLAN-XY99ZZ00',
'effective' => 'NEXT_CYCLE',
'prorate' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan"
payload := strings.NewReader("{\n \"newPlanCode\": \"PLAN-XY99ZZ00\",\n \"effective\": \"NEXT_CYCLE\",\n \"prorate\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"newPlanCode\": \"PLAN-XY99ZZ00\",\n \"effective\": \"NEXT_CYCLE\",\n \"prorate\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/change-plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"newPlanCode\": \"PLAN-XY99ZZ00\",\n \"effective\": \"NEXT_CYCLE\",\n \"prorate\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Plan change scheduled",
"data": {
"id": 3,
"status": "ACTIVE",
"pendingPlanId": 8,
"nextChargeDate": "2026-07-30T10:00:00"
}
}Authorizations
Payaza {{Public API Key in Base 64}}
Path Parameters
The ID of the subscription.
Body
application/json
The plan code of the new subscription plan.
Example:
"PLAN-XY99ZZ00"
When the new plan should take effect. Supported values are IMMEDIATELY and NEXT_CYCLE.
Example:
"NEXT_CYCLE"
Indicates whether the current billing cycle should be prorated.
Example:
true
Response
Request Successful
⌘I