Add New Subscription
POST/api/subscriptions/
Headers
| Field | Type | Description |
|---|---|---|
| authtoken | String | Authentication token, generated from admin area |
Parameters
| Field | Type | Description |
|---|---|---|
| name | String | New subscription name. |
| description | Text | Detailed description of the subscription. |
| description_in_item | TinyInt | Indicates if the description is included in the item (1 or 0). |
| clientid | Int | Client ID. |
| date | Date | Subscription start date (YYYY-MM-DD). |
| terms | Text | Subscription terms. |
| currency | Int | Currency ID. |
| tax_id | Int | Tax ID. |
| stripe_tax_id_2 | Varchar | Stripe tax ID. |
| stripe_plan_id | Text | Stripe plan ID. |
| stripe_subscription_id | Text | Stripe Subscription ID. |
| tax_id_2 | Int | Second tax ID. |
| next_billing_cycle | BigInt | Next billing cycle timestamp. |
| ends_at | BigInt | Subscription end timestamp. |
| status | Varchar | Subscription status (e.g., active). |
| quantity | Int | Subscription quantity. |
| project_id | Int | Associated project ID. |
| hash | Varchar | Unique hash identifier. |
| created | DateTime | Creation timestamp (YYYY-MM-DD HH:MM:SS). |
| created_from | Int | ID of the creator. |
| date_subscribed | DateTime | Subscription date (YYYY-MM-DD HH:MM:SS). |
| in_test_environment | Int | Indicates if the subscription is in a test environment (1 or 0). |
| last_sent_at | DateTime | Last sent timestamp (YYYY-MM-DD HH:MM:SS). |
curl -X POST "https://yoursite.com/api/subscriptions/" \
-H "authtoken: YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "name": "...", "description": "...", "description_in_item": "...", "clientid": "...", "date": "...", "terms": "...", "currency": "...", "tax_id": "...", "stripe_tax_id_2": "...", "stripe_plan_id": "...", "stripe_subscription_id": "...", "tax_id_2": "...", "next_billing_cycle": "...", "ends_at": "...", "status": "...", "quantity": "...", "project_id": "...", "hash": "...", "created": "...", "created_from": "...", "date_subscribed": "...", "in_test_environment": "...", "last_sent_at": "..." }' Success-Response:
HTTP/1.1 200 OK
{
"status": true,
"message": "Data Added Successfully"
} Error-Response:
HTTP/1.1 400 Bad Request
{
"status": false,
"error": "Data not Added"
}