Skip to main content
POST
/
subscription
/
api
/
v1
/
subscriptions
Create Subscription
curl --request POST \
  --url https://api.payaza.africa/live/subscription/api/v1/subscriptions \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "customerId": "test-trial",
  "customerEmail": "johndoe@gmail.com",
  "planCode": "PLN_906FE4B",
  "cardDetails": {
    "cardNumber": "554656xxxxxx742",
    "expiryMonth": "01",
    "expiryYear": "02",
    "securityCode": "123",
    "cardHolderName": "John Doe",
    "present": true
  }
}
'
import requests

url = "https://api.payaza.africa/live/subscription/api/v1/subscriptions"

payload = {
"customerId": "test-trial",
"customerEmail": "johndoe@gmail.com",
"planCode": "PLN_906FE4B",
"cardDetails": {
"cardNumber": "554656xxxxxx742",
"expiryMonth": "01",
"expiryYear": "02",
"securityCode": "123",
"cardHolderName": "John Doe",
"present": 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({
customerId: 'test-trial',
customerEmail: 'johndoe@gmail.com',
planCode: 'PLN_906FE4B',
cardDetails: {
cardNumber: '554656xxxxxx742',
expiryMonth: '01',
expiryYear: '02',
securityCode: '123',
cardHolderName: 'John Doe',
present: true
}
})
};

fetch('https://api.payaza.africa/live/subscription/api/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.payaza.africa/live/subscription/api/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([
'customerId' => 'test-trial',
'customerEmail' => 'johndoe@gmail.com',
'planCode' => 'PLN_906FE4B',
'cardDetails' => [
'cardNumber' => '554656xxxxxx742',
'expiryMonth' => '01',
'expiryYear' => '02',
'securityCode' => '123',
'cardHolderName' => 'John Doe',
'present' => 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"

payload := strings.NewReader("{\n \"customerId\": \"test-trial\",\n \"customerEmail\": \"johndoe@gmail.com\",\n \"planCode\": \"PLN_906FE4B\",\n \"cardDetails\": {\n \"cardNumber\": \"554656xxxxxx742\",\n \"expiryMonth\": \"01\",\n \"expiryYear\": \"02\",\n \"securityCode\": \"123\",\n \"cardHolderName\": \"John Doe\",\n \"present\": true\n }\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")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customerId\": \"test-trial\",\n \"customerEmail\": \"johndoe@gmail.com\",\n \"planCode\": \"PLN_906FE4B\",\n \"cardDetails\": {\n \"cardNumber\": \"554656xxxxxx742\",\n \"expiryMonth\": \"01\",\n \"expiryYear\": \"02\",\n \"securityCode\": \"123\",\n \"cardHolderName\": \"John Doe\",\n \"present\": true\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.payaza.africa/live/subscription/api/v1/subscriptions")

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 \"customerId\": \"test-trial\",\n \"customerEmail\": \"johndoe@gmail.com\",\n \"planCode\": \"PLN_906FE4B\",\n \"cardDetails\": {\n \"cardNumber\": \"554656xxxxxx742\",\n \"expiryMonth\": \"01\",\n \"expiryYear\": \"02\",\n \"securityCode\": \"123\",\n \"cardHolderName\": \"John Doe\",\n \"present\": true\n }\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "message": "Subscription created",
  "data": {
    "subscription": {
      "id": 132,
      "businessFk": 16296,
      "planId": 86,
      "customerId": "a1a4bfc6-fff4-470b-672df-53db3327cc6er",
      "customerEmail": "danieleakinola@gmail.com",
      "subscriptionMode": null,
      "payazaTokenReference": null,
      "agreementId": null,
      "vaultReference": null,
      "mandateReference": null,
      "customerAuthorizedAt": "2026-06-30T04:07:02.338683",
      "pendingPlanId": null,
      "status": "ACTIVE",
      "currentPeriodStart": "2026-06-30T04:07:02.338683",
      "currentPeriodEnd": "2026-07-30T04:07:06.026488",
      "nextChargeDate": "2026-07-30T04:07:06.026488",
      "trialEndDate": null,
      "pauseResumesAt": null,
      "cancelAt": "2026-09-20T00:00:00",
      "cancelledAt": null,
      "cancellationReason": null,
      "cardExpiryAlertSent": false,
      "connectionMode": "Live",
      "enrollmentReference": "SUBREF_72B4051E427E4BA49D",
      "enrollmentTxnReference": "SUB_ENROLL_132_1782788822736",
      "chargeMode": "DIRECT_CHARGE",
      "metadata": null,
      "createdAt": "2026-06-30T04:07:02.339296",
      "updatedAt": "2026-06-30T04:07:06.194315"
    },
    "chargeResult": {
      "status": "SUCCESS",
      "amount": 200,
      "currency": "NGN",
      "transactionReference": "SUB_ENROLL_132_1782788822736",
      "authCode": "",
      "chargeMode": "DIRECT_CHARGE",
      "message": "Your card has been saved successfully."
    }
  }
}

Authorizations

Authorization
string
header
required

Payaza {{Public API Key in Base 64}}

Body

application/json
customerId
string
required

The unique reference identifier assigned to the customer.

Example:

"test-trial"

customerEmail
string<email>
required

The email address of the customer used for transactional notifications.

Example:

"johndoe@gmail.com"

planCode
string
required

The unique plan code generated when the subscription plan was created. If omitted, a plan is automatically created from the request.

Example:

"PLN_906FE4B"

cardDetails
object
required

The card information used to enroll the customer for recurring billing.

Response

Subscription Created

success
boolean

Indicates if the request was successful.

Example:

true

message
string

Descriptive message regarding the subscription creation status.

Example:

"Subscription created"

data
object

The payload containing the combined results of the subscription enrollment and initialization charge.