Subscriptions
Resume Subscription
Resume a paused subscription
POST
/
v1
/
subscriptions
/
{id}
/
resume
Resume a paused subscription
curl --request POST \
--url https://billing.example.com/v1/subscriptions/{id}/resume \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/subscriptions/{id}/resume"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://billing.example.com/v1/subscriptions/{id}/resume', 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://billing.example.com/v1/subscriptions/{id}/resume",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://billing.example.com/v1/subscriptions/{id}/resume"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://billing.example.com/v1/subscriptions/{id}/resume")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/subscriptions/{id}/resume")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "trialing",
"current_period_start": "2023-11-07T05:31:56Z",
"current_period_end": "2023-11-07T05:31:56Z",
"cancel_at_period_end": true,
"canceled_at": "2023-11-07T05:31:56Z",
"cancellation_reason": "<string>",
"cancellation_feedback": "<string>",
"billing_anchor": "2023-11-07T05:31:56Z",
"billing_anchor_type": "<string>",
"billing_anchor_day": 123,
"payment_terms": "<string>",
"coupon_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reference_id": "<string>",
"mandate_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"razorpay_subscription_id": "<string>",
"stripe_subscription_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The subscription ID |
Example Request
curl -X POST https://api.recurso.dev/v1/subscriptions/sub_xyz789/resume \
-H "Authorization: Bearer $API_KEY"
Response
{
"id": "sub_xyz789",
"object": "subscription",
"customer_id": "cust_abc123",
"plan_id": "plan_pro_01",
"status": "active",
"quantity": 1,
"current_period_start": "2024-05-01T00:00:00Z",
"current_period_end": "2024-06-01T00:00:00Z",
"paused_at": null,
"resume_at": null,
"cancel_at_period_end": false,
"metadata": {},
"created_at": "2024-03-01T10:30:00Z",
"updated_at": "2024-05-01T00:00:00Z"
}
Resuming a subscription starts a new billing period immediately. An invoice is generated for the upcoming period.
Errors
| Status | Code | When | Fix |
|---|---|---|---|
| 400 | validation_failed | id is not a valid UUID. | Pass the subscription’s UUID. |
| 404 | not_found | The subscription does not exist in your tenant. | Verify the ID with GET /v1/subscriptions/{id}. |
| 409 | conflict | The subscription is not paused. | Only resume subscriptions whose status is paused. |
| 400 | validation_failed | The subscription’s plan no longer exists, so the billing period cannot be rolled forward (plan unavailable for resume). | Restore or reassign the plan before resuming. |
| 401 | unauthorized | API key missing or invalid (invalid_api_key), or a live/test mode mismatch (key_mode_mismatch). | Send Authorization: Bearer <api_key> with a key for the right mode. |
⌘I
Resume a paused subscription
curl --request POST \
--url https://billing.example.com/v1/subscriptions/{id}/resume \
--header 'Authorization: Bearer <token>'import requests
url = "https://billing.example.com/v1/subscriptions/{id}/resume"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://billing.example.com/v1/subscriptions/{id}/resume', 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://billing.example.com/v1/subscriptions/{id}/resume",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://billing.example.com/v1/subscriptions/{id}/resume"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://billing.example.com/v1/subscriptions/{id}/resume")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://billing.example.com/v1/subscriptions/{id}/resume")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "trialing",
"current_period_start": "2023-11-07T05:31:56Z",
"current_period_end": "2023-11-07T05:31:56Z",
"cancel_at_period_end": true,
"canceled_at": "2023-11-07T05:31:56Z",
"cancellation_reason": "<string>",
"cancellation_feedback": "<string>",
"billing_anchor": "2023-11-07T05:31:56Z",
"billing_anchor_type": "<string>",
"billing_anchor_day": 123,
"payment_terms": "<string>",
"coupon_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reference_id": "<string>",
"mandate_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"razorpay_subscription_id": "<string>",
"stripe_subscription_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>"
}
}