Get My Subscription
curl --request GET \
--url https://api.devkit4ai.com/api/v1/payments/stripe/my-subscription \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.devkit4ai.com/api/v1/payments/stripe/my-subscription"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.devkit4ai.com/api/v1/payments/stripe/my-subscription', 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.devkit4ai.com/api/v1/payments/stripe/my-subscription",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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://api.devkit4ai.com/api/v1/payments/stripe/my-subscription"
req, _ := http.NewRequest("GET", 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.get("https://api.devkit4ai.com/api/v1/payments/stripe/my-subscription")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devkit4ai.com/api/v1/payments/stripe/my-subscription")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_test_mode": true,
"subscription_id": "<string>",
"status": "<string>",
"quantity": 123,
"created_at": "2023-11-07T05:31:56Z",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "<string>",
"plan_name": "<string>",
"current_period_start": "2023-11-07T05:31:56Z",
"current_period_end": "2023-11-07T05:31:56Z",
"cancel_at": "2023-11-07T05:31:56Z",
"cancelled_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Stripe Subscriptions
Get My Subscription
Get the current user’s active Stripe subscription for the project
GET
/
api
/
v1
/
payments
/
stripe
/
my-subscription
Get My Subscription
curl --request GET \
--url https://api.devkit4ai.com/api/v1/payments/stripe/my-subscription \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.devkit4ai.com/api/v1/payments/stripe/my-subscription"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.devkit4ai.com/api/v1/payments/stripe/my-subscription', 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.devkit4ai.com/api/v1/payments/stripe/my-subscription",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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://api.devkit4ai.com/api/v1/payments/stripe/my-subscription"
req, _ := http.NewRequest("GET", 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.get("https://api.devkit4ai.com/api/v1/payments/stripe/my-subscription")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.devkit4ai.com/api/v1/payments/stripe/my-subscription")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"is_test_mode": true,
"subscription_id": "<string>",
"status": "<string>",
"quantity": 123,
"created_at": "2023-11-07T05:31:56Z",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer_id": "<string>",
"plan_name": "<string>",
"current_period_start": "2023-11-07T05:31:56Z",
"current_period_end": "2023-11-07T05:31:56Z",
"cancel_at": "2023-11-07T05:31:56Z",
"cancelled_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Retrieve the current authenticated user’s active subscription for the project. Use this to display subscription status in your application.
Authentication
This endpoint requires end user authentication via HTTP Bearer Token with project scope.
Query Parameters
boolean
default:"true"
Use test mode data. Set to
false for production subscriptions.Response
Returns the subscription object if active, ornull if no subscription exists.
string (UUID)
Internal subscription record ID
string (UUID)
Project the subscription belongs to
string (UUID)
User who owns the subscription
boolean
Whether this is a test mode subscription
string
Stripe subscription ID (e.g.,
sub_ABC123)string
Stripe customer ID
string
Subscription status:
active, trialing, past_due, canceled, incompletestring
Name of the subscribed plan
integer
Number of subscription seats/units
datetime
Start of current billing period
datetime
End of current billing period (renewal date)
datetime
Scheduled cancellation date (if set)
datetime
When cancellation was requested
datetime
When subscription was created
Example Request
curl -X GET "https://api.devkit4ai.com/api/v1/payments/stripe/my-subscription?test_mode=true" \
-H "Authorization: Bearer {end_user_jwt}"
Example Response
Active Subscription
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"project_id": "660e8400-e29b-41d4-a716-446655440000",
"user_id": "770e8400-e29b-41d4-a716-446655440000",
"is_test_mode": true,
"subscription_id": "sub_1ABC123def456",
"customer_id": "cus_XYZ789",
"status": "active",
"plan_name": "Pro Plan",
"quantity": 1,
"current_period_start": "2026-01-01T00:00:00Z",
"current_period_end": "2026-02-01T00:00:00Z",
"cancel_at": null,
"cancelled_at": null,
"created_at": "2025-12-15T10:30:00Z"
}
No Subscription
null
Subscription Status Flow
Integration Example
// React hook for subscription status
import { useQuery } from '@tanstack/react-query';
export function useSubscription() {
return useQuery({
queryKey: ['subscription'],
queryFn: async () => {
const response = await fetch('/api/subscription');
if (!response.ok) throw new Error('Failed to fetch subscription');
return response.json();
}
});
}
// Usage in component
function SubscriptionBadge() {
const { data: subscription, isLoading } = useSubscription();
if (isLoading) return <Spinner />;
if (!subscription) return <Badge>Free</Badge>;
return <Badge variant={subscription.status}>{subscription.plan_name}</Badge>;
}
Common Use Cases
| Use Case | Implementation |
|---|---|
| Show upgrade button | Check if subscription is null |
| Display plan name | Use subscription.plan_name |
| Show renewal date | Format current_period_end |
| Warn about cancellation | Check if cancel_at is set |
| Handle payment issues | Check for past_due status |
Error Responses
| Status | Description |
|---|---|
401 | Unauthorized - Invalid or missing authentication |
404 | Project not found or Stripe not configured |
Related Pages
Create Checkout
Start a new subscription
Cancel Subscription
Cancel user’s subscription
Update Subscription
Change subscription plan
Customer Portal
Let user manage billing
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Use test mode
Response
StripeSubscriptionResponse · object | null
Successful Response
Stripe subscription details.

