POST
stripe_subscriptions_create.py
from charter.packs import stripe
result = await stripe.subscriptions_create.ainvoke({"items": ...})
Body
| Field | Type | Description |
|---|---|---|
description | string | An arbitrary string attached to the subscription. max length 500 |
metadata | map of string | Set of key-value pairs attached to the subscription. |
trialEnd | string | integer | When the trial ends: the string ‘now’ to end it immediately, or a Unix timestamp at most two years out. Overrides any trial the plan defines. A timestamp is seconds, not milliseconds: 1700000000, not 1700000000000. |
cancelAt | integer | CancelAtSentinel | When to cancel: a Unix timestamp, or one of ‘max_billed_until’, ‘max_period_end’, ‘min_period_end’. A timestamp before the current period ends prorates if prorations are enabled. A timestamp is seconds, not milliseconds: 1700000000, not 1700000000000. |
collectionMethod | CollectionMethod | How to collect payment. Absent, Stripe charges automatically. |
daysUntilDue | integer | Days until an invoice is due. Valid only when collection_method is ‘send_invoice’. ≥ 0 |
defaultPaymentMethod | string | The payment method to charge. It must already belong to this subscription’s customer. |
customer | string | The ID of the customer to subscribe. |
items * | SubscriptionItemCreate[] | The prices the customer is subscribing to, up to 20. max 20 items |
currency | string | Three-letter lowercase ISO currency code. |
trialPeriodDays | integer | Length of the trial in days. Overrides any trial the plan defines. ≥ 0 |
cancelAtPeriodEnd | boolean | Whether to cancel at the end of the current period. Absent, Stripe does not schedule a cancellation. |
prorationBehavior | ProrationBehaviorOnCreate | How to handle prorations. Absent, Stripe creates them. ‘always_invoice’ is not accepted on creation. |
paymentBehavior | PaymentBehaviorOnCreate | What to do if the first payment fails. Absent, Stripe allows the subscription to be created incomplete. ‘pending_if_incomplete’ is not accepted on creation. |
discounts | SubscriptionDiscount[] | Coupons and promotion codes to apply. Absent, the subscription inherits the customer’s discount. |