I have successfully setup Stripe whereby a user can subscribe to a stripe subscription (using server side not client).
How do I retrieve subscription information from stripe so I can update the user start and end dates in my database? Do I retrieve customer information in a seperate call and then update accordingly? I tried doing it this way but it’s not working.
was just doing this yesterday. I had to do manually though as .net isn’t supported with the stripe integration. Postman has a whole set of apis so you can test. Should be pretty straight forward. Maybe shoot us a pic of your action script so we can see what going on, and or what its returning in the web tools?
All the Stripe actions return an object, so when you execute the Create Subscription, it will respond with the subscription it created. You can follow up the Create Subscription action with a database update to store the data you need.
Thanks for everyone’s responses. I created the stripe subscription by following instructions on wappler docs https://docs.wappler.io/t/stripe-subscriptions/31491 - I.e by creating a checkout session in my server actions. I then ran a database update step after trying to bind data (like subscription start and end date) to my database records, however the results from the checkout session does not have subscription data to select from. It only has other customer data.
Should I be changing the checkout session to a subscription session?
The docs you reference should probably be updated. You don’t actually “setup” subscriptions; the instructions are for setting up a Product and one or more Prices (There’s nothing wrong with the steps outlined, I just wouldn’t call it “Subscription”.
A subscription is simply a way to charge on a recurring basis and consists (among other things) a customer and one or more prices.
So using Retrieve subscription does that, it gets a subscription object. There are other actions to retrieve products and prices.
Thank you for that! So starting from scratch in my server action steps should I not be using “create checkout session” but rather a subscription call? Or can I just call retrieve subscription after my initial steps and keep it all as is?
There are several ways to handle all this…I’d stick with the docs for now. I do all my Stripe processing server-side, but the step-by-step you are following is for client side.
Then yes, you can call the Retrieve subscription at any time once the subscription has been created.
The checkout session object will have a “subscription” – this is the subscription id of the subscription just created. You can use that to retrieve the entire subscription object since it is not expanded by default.
{
“status”: “500”,
“message”: “stripe.retrieveSubscription: subscription_exposed_id is required.”,
“stack”: “Error: stripe.retrieveSubscription: subscription_exposed_id is required.\n at App.parseRequired (/opt/node_app/lib/core/app.js:637:19)\n at exports.retrieveSubscription (/opt/node_app/lib/modules/stripe.js:4254:40)\n at App._exec (/opt/node_app/lib/core/app.js:599:57)\n at App._exec (/opt/node_app/lib/core/app.js:566:28)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async App.exec (/opt/node_app/lib/core/app.js:535:9)\n at async App.define (/opt/node_app/lib/core/app.js:517:9)”
}