There are a few configuration steps you must follow to ensure the process is automated correctly. Configuration settings in bold are required to contain a value.
|service.stripe.api_secret_key||Your Stripe API secret key, found here|
|service.stripe.webhook_secret||The signing secret to your webhook, found here|
|service.stripe.subscription.customer_id_field||The name of the text field in which to store the Stripe customer ID|
|service.stripe.subscription.id_field||The name of the text field to use for storing the Stripe subscription ID|
|service.stripe.subscription.active_subscription_field||The name of the checkbox field to display whether a subscription is currently active|
|service.stripe.subscription.user_id_field||The name of the text field to identify the user a subscription item belongs to. Providing a value is optional.|
The API secret key and webhook secret allow us to create customers, subscriptions, and invoices in your Stripe account on your behalf and respond to events such as payment success and failure.
Important note: the field specified by service.stripe.subscription.customer_id_field MUST be added to the user profile definition, which can be edited at /admin/dy_schemas/edit_user_profile.
The subscription ID field and the active subscription field may be added to any custom item type, including the user profile definition. For per-user subscriptions, including these fields in the user profile definition is the simplest choice.
Please do not add any of the required subscription fields to frontend forms - these fields are managed automatically and do not require any manual submission.
Create a webhook endpoint in your Stripe dashboard here that points to /admin/api/v2/stripe/webhook. Webvanta will now update the active subscription field automatically based on successful or failed payments for a given subscription, and respond appropriately to customer deletion and subscription deletion events.
If you would like to manage multiple subscriptions for each user using a custom item type, then include the subscription ID field, active subscription field, and the user ID field in the custom item type definition. The user ID field should contain the value given by <w:user key="id" />.
For example, I might want to store Stripe subscription information in a custom item type called 'membership'. The item definition for 'membership' must then contain fields to store the subscription ID, whether the subscription is active, and the user ID of the person the membership item belongs to. I might name these fields 'subscription', 'is_active', and 'user', respectively. The names of those fields are the values of their respective configuration options listed above. You can name the fields anything you like, as long as you list them correctly in the configuration.
|HTTP Method||Endpoint Path||Parameters|
|POST||/admin/api/v2/stripe/create_subscription||(customer), subscription, item_id|
Here are detailed descriptions of each parameter listed above:
Please note that some fields passed to the API will be ignored, so as to limit the client's effect on the payment process:
And here are descriptions of the response behavior of the above endpoints:
A user has access to the item referred to by 'item_id' if one of the following conditions are met: