From 75ec6504f38ec4fef673bb11d51ac1743caa8c46 Mon Sep 17 00:00:00 2001 From: Carmelo Woodgett <1947759+carmelowoodgett@users.noreply.github.com> Date: Tue, 12 Dec 2023 19:53:22 -0500 Subject: [PATCH] Updating Stripe apiVersion to the latest (#745) Documentation was using apiVersion: "2023-08-16" which is old but was also stating that apiVersion "2022-11-15" was what was being used which is old and not accurate. --- _chapters/add-an-api-to-handle-billing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_chapters/add-an-api-to-handle-billing.md b/_chapters/add-an-api-to-handle-billing.md index 6c95aa7b6..3b461ce29 100644 --- a/_chapters/add-an-api-to-handle-billing.md +++ b/_chapters/add-an-api-to-handle-billing.md @@ -35,7 +35,7 @@ export const main = handler(async (event) => { // Load our secret key const stripe = new Stripe(Config.STRIPE_SECRET_KEY, { - apiVersion: "2023-08-16", + apiVersion: "2023-10-16", }); await stripe.charges.create({ @@ -55,7 +55,7 @@ Most of this is fairly straightforward but let's go over it quickly: - We are using a `calculateCost(storage)` function (that we are going to add soon) to figure out how much to charge a user based on the number of notes that are going to be stored. -- We create a new Stripe object using our Stripe Secret key. We are getting this from the environment variable that we configured in the [previous chapter]({% link _chapters/handling-secrets-in-sst.md %}). At the time of this guide's writing, we are using `apiVersion` `2022-11-15` but you can check the [Stripe documentation](https://stripe.com/docs/api/versioning){:target="_blank"} for the latest version. +- We create a new Stripe object using our Stripe Secret key. We are getting this from the environment variable that we configured in the [previous chapter]({% link _chapters/handling-secrets-in-sst.md %}). At the time of this guide's writing, we are using `apiVersion` `2023-10-16` but you can check the [Stripe documentation](https://stripe.com/docs/api/versioning){:target="_blank"} for the latest version. - Finally, we use the `stripe.charges.create` method to charge the user and respond to the request if everything went through successfully.