curl --location --request POST 'https://api.stateset.com/v1/subscriptions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"customer_id": "cust_abc123",
"plan_id": "plan_monthly_pro",
"start_date": "2024-02-01",
"payment_method_id": "pm_card_visa",
"trial_end": "2024-02-14",
"items": [
{
"product_id": "prod_addon_storage",
"quantity": 2
}
],
"shipping_address": {
"line1": "123 Main St",
"city": "Los Angeles",
"state": "CA",
"postal_code": "90001",
"country": "US"
}
}'
{
"id": "sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "subscription",
"customer_id": "cust_abc123",
"status": "trialing",
"created_at": "2024-01-19T17:00:00Z",
"start_date": "2024-02-01",
"current_period_start": "2024-02-01",
"current_period_end": "2024-03-01",
"trial_start": "2024-02-01",
"trial_end": "2024-02-14",
"plan": {
"id": "plan_monthly_pro",
"name": "Professional Monthly",
"amount": 9900,
"currency": "USD",
"interval": "month",
"interval_count": 1
},
"items": [
{
"id": "si_123456",
"product_id": "prod_addon_storage",
"product_name": "Additional Storage (10GB)",
"quantity": 2,
"unit_price": 500,
"amount": 1000
}
],
"quantity": 1,
"subtotal": 10900,
"tax_amount": 872,
"total_amount": 11772,
"payment_method_id": "pm_card_visa",
"default_payment_method": {
"id": "pm_card_visa",
"type": "card",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2025
}
},
"shipping_address": {
"line1": "123 Main St",
"city": "Los Angeles",
"state": "CA",
"postal_code": "90001",
"country": "US"
},
"next_invoice_date": "2024-03-01",
"cancel_at_period_end": false
}
Create a recurring subscription for a customer
curl --location --request POST 'https://api.stateset.com/v1/subscriptions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"customer_id": "cust_abc123",
"plan_id": "plan_monthly_pro",
"start_date": "2024-02-01",
"payment_method_id": "pm_card_visa",
"trial_end": "2024-02-14",
"items": [
{
"product_id": "prod_addon_storage",
"quantity": 2
}
],
"shipping_address": {
"line1": "123 Main St",
"city": "Los Angeles",
"state": "CA",
"postal_code": "90001",
"country": "US"
}
}'
{
"id": "sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "subscription",
"customer_id": "cust_abc123",
"status": "trialing",
"created_at": "2024-01-19T17:00:00Z",
"start_date": "2024-02-01",
"current_period_start": "2024-02-01",
"current_period_end": "2024-03-01",
"trial_start": "2024-02-01",
"trial_end": "2024-02-14",
"plan": {
"id": "plan_monthly_pro",
"name": "Professional Monthly",
"amount": 9900,
"currency": "USD",
"interval": "month",
"interval_count": 1
},
"items": [
{
"id": "si_123456",
"product_id": "prod_addon_storage",
"product_name": "Additional Storage (10GB)",
"quantity": 2,
"unit_price": 500,
"amount": 1000
}
],
"quantity": 1,
"subtotal": 10900,
"tax_amount": 872,
"total_amount": 11772,
"payment_method_id": "pm_card_visa",
"default_payment_method": {
"id": "pm_card_visa",
"type": "card",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2025
}
},
"shipping_address": {
"line1": "123 Main St",
"city": "Los Angeles",
"state": "CA",
"postal_code": "90001",
"country": "US"
},
"next_invoice_date": "2024-03-01",
"cancel_at_period_end": false
}
subscriptions:write
permissions.
Authorization: Bearer YOUR_API_KEY
curl --location --request POST 'https://api.stateset.com/v1/subscriptions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"customer_id": "cust_abc123",
"plan_id": "plan_monthly_pro",
"start_date": "2024-02-01",
"payment_method_id": "pm_card_visa",
"trial_end": "2024-02-14",
"items": [
{
"product_id": "prod_addon_storage",
"quantity": 2
}
],
"shipping_address": {
"line1": "123 Main St",
"city": "Los Angeles",
"state": "CA",
"postal_code": "90001",
"country": "US"
}
}'
{
"id": "sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "subscription",
"customer_id": "cust_abc123",
"status": "trialing",
"created_at": "2024-01-19T17:00:00Z",
"start_date": "2024-02-01",
"current_period_start": "2024-02-01",
"current_period_end": "2024-03-01",
"trial_start": "2024-02-01",
"trial_end": "2024-02-14",
"plan": {
"id": "plan_monthly_pro",
"name": "Professional Monthly",
"amount": 9900,
"currency": "USD",
"interval": "month",
"interval_count": 1
},
"items": [
{
"id": "si_123456",
"product_id": "prod_addon_storage",
"product_name": "Additional Storage (10GB)",
"quantity": 2,
"unit_price": 500,
"amount": 1000
}
],
"quantity": 1,
"subtotal": 10900,
"tax_amount": 872,
"total_amount": 11772,
"payment_method_id": "pm_card_visa",
"default_payment_method": {
"id": "pm_card_visa",
"type": "card",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2025
}
},
"shipping_address": {
"line1": "123 Main St",
"city": "Los Angeles",
"state": "CA",
"postal_code": "90001",
"country": "US"
},
"next_invoice_date": "2024-03-01",
"cancel_at_period_end": false
}