Skip to main content
POST
/
api
/
public
/
v1
/
subscriptions
/
create
curl --request POST \ --url https://app.localhost:3000/api/public/v1/subscriptions/create \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "customerId": "cust_123", "priceId": "price_456", "storeId": "store_789", "quantity": 1, "currency": "USD", "initiatePayment": false } '
{
  "subscription": {
    "id": "sub_789",
    "customerId": "cust_123",
    "priceId": "price_456",
    "storeId": "store_789",
    "status": "active",
    "quantity": 1,
    "currency": "USD",
    "createdAt": "2024-03-20T10:30:00Z",
    "currentPeriodStart": "2024-03-20T10:30:00Z",
    "currentPeriodEnd": "2024-04-20T10:30:00Z",
    "nextBillingDate": "2024-04-20T10:30:00Z",
    "cancelAtPeriodEnd": false,
    "metadata": {
      "source": "api"
    }
  }
}

Authorizations

Authorization
string
header
required

Enter your API key as: Bearer your-api-key

Body

application/json
customerId
string
required
priceId
string
required
storeId
string
required
currency
string
required
quantity
integer
default:1
Required range: x > 0
metadata
object
initiatePayment
boolean
default:false
billingCycleAnchor
string<date-time>
trialSettings
object
defaultPaymentInstrumentId
string
paymentId
string

Response

Successful response