curl --request POST \
--url https://api.sandbox.cheqpay.mx/pos/v1/plans \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-merchant-id: <api-key>' \
--data '
{
"name": "Monthly Premium Plan",
"amount": 9900,
"currency": "MXN",
"interval": "MONTH",
"externalId": "PLAN-MONTHLY-001",
"description": "Premium subscription with all features included",
"intervalCount": 1,
"trialDays": 14,
"metadata": {
"tier": "premium",
"features": [
"feature1",
"feature2"
]
}
}
'import requests
url = "https://api.sandbox.cheqpay.mx/pos/v1/plans"
payload = {
"name": "Monthly Premium Plan",
"amount": 9900,
"currency": "MXN",
"interval": "MONTH",
"externalId": "PLAN-MONTHLY-001",
"description": "Premium subscription with all features included",
"intervalCount": 1,
"trialDays": 14,
"metadata": {
"tier": "premium",
"features": ["feature1", "feature2"]
}
}
headers = {
"x-api-key": "<api-key>",
"x-merchant-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
'x-merchant-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Monthly Premium Plan',
amount: 9900,
currency: 'MXN',
interval: 'MONTH',
externalId: 'PLAN-MONTHLY-001',
description: 'Premium subscription with all features included',
intervalCount: 1,
trialDays: 14,
metadata: {tier: 'premium', features: ['feature1', 'feature2']}
})
};
fetch('https://api.sandbox.cheqpay.mx/pos/v1/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.sandbox.cheqpay.mx/pos/v1/plans",
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([
'name' => 'Monthly Premium Plan',
'amount' => 9900,
'currency' => 'MXN',
'interval' => 'MONTH',
'externalId' => 'PLAN-MONTHLY-001',
'description' => 'Premium subscription with all features included',
'intervalCount' => 1,
'trialDays' => 14,
'metadata' => [
'tier' => 'premium',
'features' => [
'feature1',
'feature2'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-merchant-id: <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://api.sandbox.cheqpay.mx/pos/v1/plans"
payload := strings.NewReader("{\n \"name\": \"Monthly Premium Plan\",\n \"amount\": 9900,\n \"currency\": \"MXN\",\n \"interval\": \"MONTH\",\n \"externalId\": \"PLAN-MONTHLY-001\",\n \"description\": \"Premium subscription with all features included\",\n \"intervalCount\": 1,\n \"trialDays\": 14,\n \"metadata\": {\n \"tier\": \"premium\",\n \"features\": [\n \"feature1\",\n \"feature2\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-merchant-id", "<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.sandbox.cheqpay.mx/pos/v1/plans")
.header("x-api-key", "<api-key>")
.header("x-merchant-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Monthly Premium Plan\",\n \"amount\": 9900,\n \"currency\": \"MXN\",\n \"interval\": \"MONTH\",\n \"externalId\": \"PLAN-MONTHLY-001\",\n \"description\": \"Premium subscription with all features included\",\n \"intervalCount\": 1,\n \"trialDays\": 14,\n \"metadata\": {\n \"tier\": \"premium\",\n \"features\": [\n \"feature1\",\n \"feature2\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.cheqpay.mx/pos/v1/plans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-merchant-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Monthly Premium Plan\",\n \"amount\": 9900,\n \"currency\": \"MXN\",\n \"interval\": \"MONTH\",\n \"externalId\": \"PLAN-MONTHLY-001\",\n \"description\": \"Premium subscription with all features included\",\n \"intervalCount\": 1,\n \"trialDays\": 14,\n \"metadata\": {\n \"tier\": \"premium\",\n \"features\": [\n \"feature1\",\n \"feature2\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"merchantId": "merchant_123",
"name": "Monthly Premium Plan",
"amount": "9900",
"currency": "MXN",
"interval": "MONTH",
"intervalCount": 1,
"active": true,
"createdAt": "2025-01-15T10:00:00.000Z",
"updatedAt": "2025-01-15T10:00:00.000Z",
"externalId": "PLAN-MONTHLY-001",
"description": "Premium subscription with all features included",
"trialDays": 14,
"metadata": {}
}{
"message": "Validation failed",
"errors": [
{
"field": "name",
"message": "Required"
}
]
}{
"message": "Invalid api key"
}{
"message": "Error message"
}Create a subscription plan
Creates a new subscription plan for recurring billing. Plans define the pricing, billing interval, and optional trial period for subscriptions.
curl --request POST \
--url https://api.sandbox.cheqpay.mx/pos/v1/plans \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-merchant-id: <api-key>' \
--data '
{
"name": "Monthly Premium Plan",
"amount": 9900,
"currency": "MXN",
"interval": "MONTH",
"externalId": "PLAN-MONTHLY-001",
"description": "Premium subscription with all features included",
"intervalCount": 1,
"trialDays": 14,
"metadata": {
"tier": "premium",
"features": [
"feature1",
"feature2"
]
}
}
'import requests
url = "https://api.sandbox.cheqpay.mx/pos/v1/plans"
payload = {
"name": "Monthly Premium Plan",
"amount": 9900,
"currency": "MXN",
"interval": "MONTH",
"externalId": "PLAN-MONTHLY-001",
"description": "Premium subscription with all features included",
"intervalCount": 1,
"trialDays": 14,
"metadata": {
"tier": "premium",
"features": ["feature1", "feature2"]
}
}
headers = {
"x-api-key": "<api-key>",
"x-merchant-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
'x-merchant-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Monthly Premium Plan',
amount: 9900,
currency: 'MXN',
interval: 'MONTH',
externalId: 'PLAN-MONTHLY-001',
description: 'Premium subscription with all features included',
intervalCount: 1,
trialDays: 14,
metadata: {tier: 'premium', features: ['feature1', 'feature2']}
})
};
fetch('https://api.sandbox.cheqpay.mx/pos/v1/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.sandbox.cheqpay.mx/pos/v1/plans",
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([
'name' => 'Monthly Premium Plan',
'amount' => 9900,
'currency' => 'MXN',
'interval' => 'MONTH',
'externalId' => 'PLAN-MONTHLY-001',
'description' => 'Premium subscription with all features included',
'intervalCount' => 1,
'trialDays' => 14,
'metadata' => [
'tier' => 'premium',
'features' => [
'feature1',
'feature2'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-merchant-id: <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://api.sandbox.cheqpay.mx/pos/v1/plans"
payload := strings.NewReader("{\n \"name\": \"Monthly Premium Plan\",\n \"amount\": 9900,\n \"currency\": \"MXN\",\n \"interval\": \"MONTH\",\n \"externalId\": \"PLAN-MONTHLY-001\",\n \"description\": \"Premium subscription with all features included\",\n \"intervalCount\": 1,\n \"trialDays\": 14,\n \"metadata\": {\n \"tier\": \"premium\",\n \"features\": [\n \"feature1\",\n \"feature2\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-merchant-id", "<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.sandbox.cheqpay.mx/pos/v1/plans")
.header("x-api-key", "<api-key>")
.header("x-merchant-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Monthly Premium Plan\",\n \"amount\": 9900,\n \"currency\": \"MXN\",\n \"interval\": \"MONTH\",\n \"externalId\": \"PLAN-MONTHLY-001\",\n \"description\": \"Premium subscription with all features included\",\n \"intervalCount\": 1,\n \"trialDays\": 14,\n \"metadata\": {\n \"tier\": \"premium\",\n \"features\": [\n \"feature1\",\n \"feature2\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.cheqpay.mx/pos/v1/plans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-merchant-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Monthly Premium Plan\",\n \"amount\": 9900,\n \"currency\": \"MXN\",\n \"interval\": \"MONTH\",\n \"externalId\": \"PLAN-MONTHLY-001\",\n \"description\": \"Premium subscription with all features included\",\n \"intervalCount\": 1,\n \"trialDays\": 14,\n \"metadata\": {\n \"tier\": \"premium\",\n \"features\": [\n \"feature1\",\n \"feature2\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"merchantId": "merchant_123",
"name": "Monthly Premium Plan",
"amount": "9900",
"currency": "MXN",
"interval": "MONTH",
"intervalCount": 1,
"active": true,
"createdAt": "2025-01-15T10:00:00.000Z",
"updatedAt": "2025-01-15T10:00:00.000Z",
"externalId": "PLAN-MONTHLY-001",
"description": "Premium subscription with all features included",
"trialDays": 14,
"metadata": {}
}{
"message": "Validation failed",
"errors": [
{
"field": "name",
"message": "Required"
}
]
}{
"message": "Invalid api key"
}{
"message": "Error message"
}Authorizations
API key for authentication (required)
Merchant ID for identifying the merchant (required)
Body
Plan name
1 - 255"Monthly Premium Plan"
Amount in smallest currency unit (e.g., cents)
x >= 19900
Currency code (ISO 4217)
MXN, USD "MXN"
Billing interval
DAY, WEEK, MONTH, YEAR "MONTH"
External plan ID from merchant system
255"PLAN-MONTHLY-001"
Plan description
1000"Premium subscription with all features included"
Number of intervals between billings
1 <= x <= 121
Number of trial days before first billing
1 <= x <= 36514
Additional metadata for the plan
{
"tier": "premium",
"features": ["feature1", "feature2"]
}
Response
Subscription plan created successfully
Unique plan identifier
"123e4567-e89b-12d3-a456-426614174000"
Merchant identifier
"merchant_123"
Plan name
"Monthly Premium Plan"
Amount in smallest currency unit (string representation of BigInt)
"9900"
Currency code
"MXN"
Billing interval
DAY, WEEK, MONTH, YEAR "MONTH"
Number of intervals between billings
1
Whether the plan is active
true
Creation timestamp
"2025-01-15T10:00:00.000Z"
Last update timestamp
"2025-01-15T10:00:00.000Z"
External plan ID from merchant system
"PLAN-MONTHLY-001"
Plan description
"Premium subscription with all features included"
Number of trial days
14
Additional metadata