This guide describes how to sell a fixed-price monthly subscription offering using Flex.
New API Key
button and give your API Key a name. With this key we can now interact with
the Flex API.product_id
that was returned to in the previous payload we’ll define a pricing model where we’ll charge
$49.99 every monthsuccess_url: https://withflex.com/thank-you?success=true
cancel_url: https://withflex.com/thank-you?canceled=true
success_url
specified, which initiates a checkout.session.completed
event.
When you receive a checkout.session.completed
event, you can provision the subscription. Continue to provision for each billinging cycle as you receive
invoice.paid
events. If you receive an invoice.payment_failed
event, notify your customer and perform the appropriate action your team
has decided at this moment.To determine the next step for your system’s logic, check the event type and parse the payload of each event, such as invoice.paid.
Store the subscription_id and customer_id event objects in your database for verification.4242424242424242
Payment is decline: 4000000000009995
If you have setup your webhooks, you should see the checkout.session.completed
upon a successful payment.