Skip to content

Stripe - Create Subscription

This module allows you to create recurring subscriptions for customers, linking them to a price/product and configuring options such as trial period, coupons, and collection method.

  • Secret Key: Stripe secret key
ParameterTypeRequiredDescription
credentials_idcredentialYesStripe credentials
customer_idstringYesCustomer ID (cus_xxx)
price_idstringYesPrice ID (price_xxx)
quantitynumberNoQuantity (default: 1)
default_payment_methodstringNoDefault payment method
trial_period_daysnumberNoTrial period days
collection_methodselectNoCollection method
days_until_duenumberNoDays to pay invoice
couponstringNoCoupon code
cancel_at_period_endbooleanNoCancel at end of period
metadatastringNoCustom metadata (JSON)
{
"success": true,
"subscription": {...},
"subscription_id": "sub_1MowQVLkdIwHu7ixeRlqHVzs",
"status": "active",
"current_period_start": 1679609767,
"current_period_end": 1682288167,
"message": "Suscripción sub_1MowQV... creada (active)"
}
{
"customer_id": "cus_NffrFeUfNV2Hib",
"price_id": "price_1MoC3cLkdIwHu7ixFd9J0pzG"
}
{
"customer_id": "cus_NffrFeUfNV2Hib",
"price_id": "price_1MoC3cLkdIwHu7ixFd9J0pzG",
"trial_period_days": 14,
"default_payment_method": "pm_1234567890"
}
{
"customer_id": "cus_NffrFeUfNV2Hib",
"price_id": "price_1MoC3cLkdIwHu7ixFd9J0pzG",
"coupon": "DESCUENTO20",
"metadata": "{\"plan_name\": \"Premium\"}"
}
{
"customer_id": "cus_NffrFeUfNV2Hib",
"price_id": "price_1MoC3cLkdIwHu7ixFd9J0pzG",
"collection_method": "send_invoice",
"days_until_due": 30
}
  • The customer must have a valid payment method
  • Prices must be previously configured in Stripe
  • The trial period does not charge the customer
  • collection_method: send_invoice sends an invoice by email
  • StripeGetSubscriptions - Get and search existing subscriptions
  • StripeCancelSubscription - Cancel active subscriptions
  • StripeGetCustomers - Get customer data
  • StripeCreateCustomer - Create the customer before subscribing
  • StripeGetInvoices - Get invoices generated by the subscription