-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read properties of undefined (reading 'total') #7
Comments
Did you ever solve this problem? |
Unfortunately not yet. Are you having the same issue? |
Both the Medusa backend and the Stripe API have been updated since this starter was last updated. It will need to be tweaked to get it working again. I no longer use Medusa. I use Vendure. |
@fobtac yes Im having the same issue and Ill start figuring out how to make it work again. Ill let ya know when I do. |
@techydad05 that would be awesome! i'm fairly new to coding so you would definitely be better at solving this than i. i'll still keep digging though and keep you posted. |
@fobtac @techydad05 did you manage to find a solution? I am encountering the same error when integrating stripe. The returned cart variable is undefined because the post request failed. The error occurs\when creating a payment session with Medusa, with the 404 response error message being: 'Could not find a payment provider with id: stripe' I have already set up stripe on the Medusa backend and admin. Unfortunately, documentation doesn't divulge anything else useful beyond setting up the stripe plugin. |
This worked our of the box for me on a fresh install. I just add to enable stripe (with local CLI) on the server and turnstile on the (local) client. |
@clemsos Do you mean to generate the Client Secret for the payment intent with Stripe instead of Medusa? I keep on trying to make |
@dianaow I had the same error as @fobtac initially but it turned out that looking at the logs of the backend server stripe wasn't enable correctly. I used the stripe shell cli to start a localhost test session, which provided me with a webhook secret that I added in the |
@clemsos Oh ok, yes I read about the stripe webhooks from the medusa docs (https://docs.medusajs.com/plugins/payment/stripe) but assumed it wasn't needed now because i'm not in production mode. i only want to test the plugin |
If you are new to Medusa and just testing it out, I strongly recommend you look at Vendure instead. https://github.com/pevey/sveltekit-vendure-starter |
@clemsos unfortunately, setting up the webhooks, starting up 'localhost:4242/webhooks ', and specifying the webhook signing secret in .env file didn't resolve the issue. How did you identify that stripe wasn't setup properly through looking at the backend logs? I could generate a payment intent from Stripe instead of through the Medusa API call (to select a payment session) and trigger a test payment successfully upon form submission. However, I still want to tie both Medusa and Stripe together, so that the Medusa admin knows about the order. Also, without a payment session selected, I get the same 'Could not find a payment provider with id: stripe' when an address/shipping option update is submitted through the Stripe form. My last resort is to just reinstall the medusa backend and admin. Are you using live or test Stripe API keys? |
If you are using Medusa's stripe plugin, http://localhost:4242 is not the correct webhooks url. Please consult the documentation. |
@pevey Oh right, thank you! It should be |
@pevey Can I asked why you moved from medusa to vendure? |
After setting up my medusajs backend and configuring environment variables, I am able to implement products from the backend and add them to the cart. However, when I click "checkout" from the cart, and the checkout page loads, I get the message "your cart is empty" even after adding items to the cart. My terminal throws a TypeError:
{
id: 'u8IbOL8OTM6n96FJ5d9sX',
type: 'response',
timestamp: '2023-12-24T07:39:55.142Z',
url: 'http://localhost:9000/store/carts/cart_01HJDBBVCN2GBPS5ZW5XRWS6PE/payment-session',
status: 400,
statusText: 'Bad Request'
}
TypeError: Cannot read properties of undefined (reading 'total')
at POST (M:\storefront\src\routes\checkout\turnstile+server.ts:18:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Module.render_endpoint (M:\storefront\node_modules@sveltejs\kit\src\runtime\server\endpoint.js:43:18)
at async resolve (M:\storefront\node_modules@sveltejs\kit\src\runtime\server\respond.js:404:17)
at async Object.handle (M:\storefront\src\hooks.server.ts:10:21)
at async Module.respond (M:\storefront\node_modules@sveltejs\kit\src\runtime\server\respond.js:274:20)
at async file:///M:/storefront/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:510:22
I get these same results both before and after adding Stripe to my app.
Any Ideas? Thank you!
The text was updated successfully, but these errors were encountered: