post__subscriptions_portal
POST /subscriptions/portal
Create Billing Portal Session
Create a Stripe billing portal session for the authenticated user's organization to manage their subscription, billing information, and payment methods.
Parameters
This endpoint does not accept query parameters or request body. Authentication is required.
TypeScript Client Library
public createBillingPortal = async (): Promise<CreateBillingPortalResponse> => {
return this.makeRequest<CreateBillingPortalResponse>('subscriptions/portal', 'POST', null);
};Code Samples
curl -X POST https://backend.flashback.tech/subscriptions/portal \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'POST https://backend.flashback.tech/subscriptions/portal HTTP/1.1
Host: localhost:3000
Accept: application/json
Authorization: Bearer {access-token}const headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://backend.flashback.tech/subscriptions/portal',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'https://backend.flashback.tech/subscriptions/portal',
nil, headers: headers
p JSON.parse(result)import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('https://backend.flashback.tech/subscriptions/portal', headers = headers)
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
try {
$response = $client->request('POST','https://backend.flashback.tech/subscriptions/portal', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...URL obj = new URL("https://backend.flashback.tech/subscriptions/portal");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{})
req, err := http.NewRequest("POST", "https://backend.flashback.tech/subscriptions/portal", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}Example responses
200 Response
{
"success": true,
"url": "https://billing.stripe.com/p/session_1234567890abcdef"
}400 Response
{
"success": false,
"error_code": "NO_ORGANIZATION",
"message": "User must belong to an organization"
}404 Response (User Not Found)
{
"success": false,
"error_code": "USER_NOT_FOUND",
"message": "User not found"
}404 Response (Organization Not Found)
{
"success": false,
"error_code": "ORG_NOT_FOUND",
"message": "Organization not found"
}500 Response
{
"success": false,
"error_code": "INTERNAL_ERROR",
"message": "Failed to create billing portal session"
}Responses
Response Schema
Status Code 200
» success
boolean
false
none
Indicates if the request was successful
» url
string
false
none
Stripe billing portal URL for customer access
Status Code 400
» success
boolean
false
none
Will be false for error responses
» error_code
string
false
none
Machine-readable error code
» message
string
false
none
Human-readable error message
Status Code 404
» success
boolean
false
none
Will be false for error responses
» error_code
string
false
none
Machine-readable error code
» message
string
false
none
Human-readable error message
Status Code 500
» success
boolean
false
none
Will be false for error responses
» error_code
string
false
none
Machine-readable error code
» message
string
false
none
Human-readable error message
Last updated
Was this helpful?