Create Subscription

stripe.create_subscription
ActionBusiness appsconnection required

Calls the Stripe API with the connection's secret key.

Subscribe a Stripe customer to one or more recurring prices.

Connection

Required
Yes — the node will not save without one
Auth type
API key
Providers
Stripe
Secret shape
the Stripe secret key (sk_...)
Resolved by
config.connection_id, else node.connection_id

Configuration

10 fields, 1 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.

FieldTypeRequiredDefaultConstraintsExample
customer
The customer to subscribe (cus_...).
stringYes——cus_NffrFeUfNV2Hib
price_id
A single recurring price to subscribe to (price_...). Use 'items' for more than one.
stringNo——price_1MoBy5LkdIwHu7ixZhnattbh
quantity
How many units of 'price_id' to bill for.
numberNo1≥ 1—
items
The subscribed items, as a JSON array of objects such as [{"price": "price_123", "quantity": 1}]. Use this instead of price_id for more than one line.
arrayNo—array of object—
trial_period_days
Free trial length in days before the first invoice.
numberNo—≥ 1—
collection_method
charge_automatically bills the customer's saved payment method; send_invoice emails an invoice with payment instructions.
stringNo—one of "charge_automatically", "send_invoice"—
days_until_due
Days a sent invoice has to be paid. Only used with send_invoice.
numberConditional—≥ 0; only with collection_method—
default_payment_method
The payment method this subscription charges (pm_...). It must belong to the same customer.
stringNo———
metadata
Key/value pairs stored on the subscription and returned on every read.
objectNo———
idempotency_key
Overrides the key this node derives from the step. Set it to a business identifier (an order id, say) when the same write must not repeat across runs; leave it blank and a retry of this step reuses the step's own key.
stringNo—≤ 255 characters—
  • At least one of price_id, items must be set.

Example configuration

Every value below is the contract’s own example or default — nothing invented.

{
  "customer": "cus_NffrFeUfNV2Hib",
  "price_id": "price_1MoBy5LkdIwHu7ixZhnattbh",
  "quantity": 1
}

Output

One shape.

result

FieldTypeExample
id
The subscription id (sub_...).
string—
status
One of incomplete, incomplete_expired, trialing, active, past_due, canceled, unpaid or paused.
string—
customer
The customer this subscription bills.
string—
currency
Three-letter lowercase ISO currency code.
string—
collection_method
charge_automatically or send_invoice.
string—
cancel_at_period_end
True when it stops at the end of the period.
boolean—
canceled_at
When it was cancelled, Unix seconds, or null.
number—
start_date
When the subscription started, Unix seconds.
number—
trial_end
When the trial ends, Unix seconds, or null.
number—
latest_invoice
The most recent invoice id, or null.
string—
default_payment_method
The payment method it charges, or null.
string—
created
Creation time, as a Unix timestamp in seconds.
number—
metadata
The key/value pairs stored on the subscription.
object—
{
  "cancel_at_period_end": false,
  "canceled_at": 0,
  "collection_method": "",
  "created": 0,
  "currency": "",
  "customer": "",
  "default_payment_method": "",
  "id": "",
  "latest_invoice": "",
  "metadata": {},
  "start_date": 0,
  "status": "",
  "trial_end": 0
}

Notes

  • A new subscription can land on 'incomplete' when the first payment needs the customer; check 'status' rather than assuming it is active.

See Create Subscription run in a workflow.

In a technical demo we add the Stripe connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.