Créer un plan
curl --request POST \
--url https://api.example.com/v1/billing/plansimport requests
url = "https://api.example.com/v1/billing/plans"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/billing/plans', 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.example.com/v1/billing/plans",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/billing/plans"
req, _ := http.NewRequest("POST", url, nil)
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.example.com/v1/billing/plans")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/billing/plans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyPlans
Créer un plan
Créer un plan d’abonnement pour vos clients
POST
/
v1
/
billing
/
plans
Créer un plan
curl --request POST \
--url https://api.example.com/v1/billing/plansimport requests
url = "https://api.example.com/v1/billing/plans"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/billing/plans', 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.example.com/v1/billing/plans",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/billing/plans"
req, _ := http.NewRequest("POST", url, nil)
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.example.com/v1/billing/plans")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/billing/plans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyCréer un plan
Endpoint
POST /v1/billing/plans
Les helpers
plans.create() des SDKs appellent encore POST /v1/plans, qui n’existe pas. Utilisez l’appel HTTP.Body
| Paramètre | Type | Requis | Description |
|---|---|---|---|
name | string | ✅ | Nom du plan |
amount | integer | ✅ | Montant par période (FCFA) |
interval | string | ✅ | WEEKLY ou MONTHLY |
description | string | Description |
Exemple
curl -X POST https://api.sahelpay.ml/v1/billing/plans \
-H "Authorization: Bearer sk_test_xxx" \
-H "Content-Type: application/json" \
-d '{ "name": "Premium Mensuel", "amount": 10000, "interval": "MONTHLY" }'
Réponse
201 Created
{
"success": true,
"data": {
"id": "...",
"name": "Premium Mensuel",
"description": null,
"amount": 10000,
"currency": "XOF",
"interval": "MONTHLY",
"is_active": true,
"created_at": "2026-10-03T10:00:00.000Z"
}
}
Modifier ou supprimer
PATCH /v1/billing/plans/{id}:name,description,amount,is_active.DELETE /v1/billing/plans/{id}: supprime le plan, ou le désactive s’il a déjà des abonnements (data.deleted: false).