binx / beluga

🎷🐋 Build your own ecommerce site! https://belugajs.com
GNU General Public License v3.0
305 stars 44 forks source link

Checkouts Don't Work #71

Open bufferOverflowsOP opened 10 months ago

bufferOverflowsOP commented 10 months ago

When trying to checkout an order, the console logs a CheckoutFlow.js:54 POST http://localhost:3000/order/create 500 error

In addition, a red message appears on the screen, saying Sorry, an error has occurred. Please refresh the page and try again.

Lastly, when using the site, I would sometimes get CORS Missing Allow Origin errors

binx commented 10 months ago

Yes — Stripe changed their API at some point and the orders object is no longer supported. It would be a major overhaul of the data model to get this project working again. There would need to be a local database set up to track orders, vs. using Stripe to keep track.

Apologies! If you feel like getting this repo working again I would be very supportive!

bufferOverflowsOP commented 10 months ago

OK, sure! Do you have any suggestions for how I would go about doing that?

bufferOverflowsOP commented 10 months ago

In addition, do you plan on ever updating Beluga? It's rather sad that this project is deprecated now.

binx commented 10 months ago

To do that you'll need to switch from using the Stripe API to define products and a set of them as orders, you'll instead need to build your own database that associates each (beluga) product with some sort of product table, and a separate table for an order object. You'll still need to go through the Stripe flow to create a "charge" object for the actual credit card payment. You'd also need to rewrite the beluga product creation flow to point to your new database, update the admin view to point to that database, and update the email API to pull in status updates from there.

I spent a few days on this recently and realized it requires rewriting most of the repo. So.... no, no plans at the moment to update this repo. I agree that it's rather sad.

bufferOverflowsOP commented 10 months ago

Oh. I built something (more rudimentary) like that using Flask. I'll see if I can recreate it in React.

bufferOverflowsOP commented 10 months ago

To do that you'll need to switch from using the Stripe API to define products and a set of them as orders, you'll instead need to build your own database that associates each (beluga) product with some sort of product table, and a separate table for an order object. You'll still need to go through the Stripe flow to create a "charge" object for the actual credit card payment. You'd also need to rewrite the beluga product creation flow to point to your new database, update the admin view to point to that database, and update the email API to pull in status updates from there.

Hm. Actually, what I remember doing (when creating the Flask ecommerce project) was storing all of the products and info in a line-items array, and then sending that to the Stripe API in some way. I wonder if that could be accomplished using React or if the Stripe API changed.

In fact, I didn't need to use a database. I just hard-coded the products in csv, stored the products, encrypted, as a session/cookie, and then just sent everything to Stripe.