Stripe subscription create
POST
https://app.sulus.ai/api/stripe/subscription
Create a paid subscription with a payment method
Authentication
Send a bearer token created on your dashboard's Developer page:
Authorization: Bearer <YOUR_API_KEY>
Request body
package_id
integer
Required
Package to subscribe to.
Validation:
required|exists:subscription_packages,idStored in
user_subscriptions.subscription_package_idpayment_method_id
string
Required
Payment method id from the client-side card collection step.
Validation:
required|stringbilling_interval
string
Optional
Nullable
Default: monthly
Monthly uses package.price; yearly uses package.yearly_price.
Validation:
nullable|string|in:monthly,yearlyStored in
user_subscriptions.billing_intervalErrors
| Status | Meaning | Body |
|---|---|---|
401 |
Missing or invalid bearer token | |
422 |
Validation failed | {"message":"The package id field is required.","errors":{"package_id":["The package id field is required."]}} |
403 |
Package belongs to another reseller | {"success":false,"message":"Package not available for your reseller"} |
400 |
Upstream payment provider rejected the create | {"success":false,"message":"<exception message from payment service>"} |
Notes
- Also creates a completed transactions row and may send an invoice notification (failures are logged, not returned).
- stripe_data is the array returned by StripeService::createSubscription — carbon-copy keys as shown.
- Do not omit stripe_subscription_id / stripe_customer_id / payment_method:stripe from examples — they are live wire values.
curl --request POST \
--url https://app.sulus.ai/api/stripe/subscription \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"package_id": 3,
"payment_method_id": "pm_1PxExamplePaymentMethod",
"billing_interval": "monthly"
}'
import requests
url = "https://app.sulus.ai/api/stripe/subscription"
headers = {"Authorization": "Bearer <YOUR_API_KEY>"}
payload = {
"package_id": 3,
"payment_method_id": "pm_1PxExamplePaymentMethod",
"billing_interval": "monthly"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://app.sulus.ai/api/stripe/subscription"
payload := strings.NewReader(`{
"package_id": 3,
"payment_method_id": "pm_1PxExamplePaymentMethod",
"billing_interval": "monthly"
}`)
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <YOUR_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))
}
Response
201
{
"success": true,
"data": {
"subscription": {
"id": 19,
"status": "active",
"stripe_subscription_id": "sub_1PxExampleSubscriptionId",
"stripe_customer_id": "cus_1PxExampleCustomerId",
"subscription_package_id": 3,
"package": {
"id": 3,
"name": "Growth",
"price": "99.00"
}
},
"transaction": {
"id": 88,
"amount": "99.00",
"currency": "USD",
"status": "completed",
"payment_method": "stripe",
"type": "subscription",
"external_transaction_id": "sub_1PxExampleSubscriptionId"
},
"stripe_data": {
"subscription_id": "sub_1PxExampleSubscriptionId",
"customer_id": "cus_1PxExampleCustomerId",
"status": "active",
"current_period_start": "2026-07-01T00:00:00.000000Z",
"current_period_end": "2026-08-01T00:00:00.000000Z",
"trial_end": null
}
},
"message": "Subscription created successfully"
}
Response — POST
/stripe/subscription
201
{
"success": true,
"data": {
"subscription": {
"id": 19,
"status": "active",
"stripe_subscription_id": "sub_1PxExampleSubscriptionId",
"stripe_customer_id": "cus_1PxExampleCustomerId",
"subscription_package_id": 3,
"package": {
"id": 3,
"name": "Growth",
"price": "99.00"
}
},
"transaction": {
"id": 88,
"amount": "99.00",
"currency": "USD",
"status": "completed",
"payment_method": "stripe",
"type": "subscription",
"external_transaction_id": "sub_1PxExampleSubscriptionId"
},
"stripe_data": {
"subscription_id": "sub_1PxExampleSubscriptionId",
"customer_id": "cus_1PxExampleCustomerId",
"status": "active",
"current_period_start": "2026-07-01T00:00:00.000000Z",
"current_period_end": "2026-08-01T00:00:00.000000Z",
"trial_end": null
}
},
"message": "Subscription created successfully"
}