curl --request POST \
--url https://api.recoupable.dev/api/accounts/{id}/portal \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"returnUrl": "https://chat.recoupable.com/settings/billing"
}
'import requests
url = "https://api.recoupable.dev/api/accounts/{id}/portal"
payload = { "returnUrl": "https://chat.recoupable.com/settings/billing" }
headers = {
"x-api-key": "<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>', 'Content-Type': 'application/json'},
body: JSON.stringify({returnUrl: 'https://chat.recoupable.com/settings/billing'})
};
fetch('https://api.recoupable.dev/api/accounts/{id}/portal', 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.recoupable.dev/api/accounts/{id}/portal",
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([
'returnUrl' => 'https://chat.recoupable.com/settings/billing'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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.recoupable.dev/api/accounts/{id}/portal"
payload := strings.NewReader("{\n \"returnUrl\": \"https://chat.recoupable.com/settings/billing\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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.recoupable.dev/api/accounts/{id}/portal")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"returnUrl\": \"https://chat.recoupable.com/settings/billing\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.recoupable.dev/api/accounts/{id}/portal")
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["Content-Type"] = 'application/json'
request.body = "{\n \"returnUrl\": \"https://chat.recoupable.com/settings/billing\"\n}"
response = http.request(request)
puts response.read_body{
"id": "portal_sess_a1b2c3d4",
"url": "https://billing.example.com/manage/portal_sess_a1b2c3d4"
}{
"error": "No active subscription found"
}{
"error": "Unauthorized"
}{
"error": "returnUrl is required"
}Create Billing Portal Session
Create a Stripe Customer Portal session for an account. Returns a hosted URL where the customer can update the card on file, view invoices, or cancel a Starter or Pro subscription; the client should redirect the user to that URL. The portal opens on the Stripe customer that owns the account’s active subscription, so accounts without an active subscription get a 400 even when a tagged customer with a card exists. id may be the authenticated account or an organization the caller belongs to. Enterprise (invoiced) plans are managed with your Recoup contact and the app does not offer this portal for them, but the endpoint works for any account with an active subscription.
curl --request POST \
--url https://api.recoupable.dev/api/accounts/{id}/portal \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"returnUrl": "https://chat.recoupable.com/settings/billing"
}
'import requests
url = "https://api.recoupable.dev/api/accounts/{id}/portal"
payload = { "returnUrl": "https://chat.recoupable.com/settings/billing" }
headers = {
"x-api-key": "<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>', 'Content-Type': 'application/json'},
body: JSON.stringify({returnUrl: 'https://chat.recoupable.com/settings/billing'})
};
fetch('https://api.recoupable.dev/api/accounts/{id}/portal', 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.recoupable.dev/api/accounts/{id}/portal",
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([
'returnUrl' => 'https://chat.recoupable.com/settings/billing'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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.recoupable.dev/api/accounts/{id}/portal"
payload := strings.NewReader("{\n \"returnUrl\": \"https://chat.recoupable.com/settings/billing\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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.recoupable.dev/api/accounts/{id}/portal")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"returnUrl\": \"https://chat.recoupable.com/settings/billing\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.recoupable.dev/api/accounts/{id}/portal")
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["Content-Type"] = 'application/json'
request.body = "{\n \"returnUrl\": \"https://chat.recoupable.com/settings/billing\"\n}"
response = http.request(request)
puts response.read_body{
"id": "portal_sess_a1b2c3d4",
"url": "https://billing.example.com/manage/portal_sess_a1b2c3d4"
}{
"error": "No active subscription found"
}{
"error": "Unauthorized"
}{
"error": "returnUrl is required"
}Authorizations
Your Recoup API key. Learn more.
Path Parameters
The unique identifier (UUID) of the account. Must be the authenticated account or another accessible via organization membership.
Body
Portal session parameters
Request body for creating a billing portal session. The account is taken from the id path parameter and must be accessible to the authenticated caller.
The URL to redirect to when the customer leaves the portal.
"https://chat.recoupable.com/settings/billing"
Was this page helpful?
