Donations via Stripe not working
Closed this issue · 11 comments
We tried making a donation today, and there are a few issues:
- The checkbox for
Please agree to the [terms](https://donatemask.ca/terms) and [privacy policy](https://donatemask.ca/privacy) before proceeding.
never changes state. There is likely an event handler that's toggling whether or not the Donate button works (it changes colour), but it's not obvious. Having this checkbox actually change to show the confirmation would be better - If I click the checkbox, then Donate, without entering any form information, it initiates a POST to the server. It should block on the form fields being complete, valid.
- The POST to
/create-checkout-session
never returns. The browser starts it, and it is markedpending
forever. No error. No redirect.
After fixing 1. and 2. locally (PR coming soon), it looks like 3. is due to a Stripe configuration issue:
StripeInvalidRequestError: Price
price_1KEOMhCOL3X1doeXxRmWdA1U
is not available to be purchased because its product is not active.
This comes from https://github.com/mekkim/donatemask/blob/main/server/routes/stripeapi.js#L14
I'm not familiar with Stripe, but I assume this means you need to have something (a "product") pre-configured on their side. Can whoever owns the Stripe setup look into this?
I have reopened the "product" on Stripe and adjusted its "price" from $2.50 "per mask" to $1.25 per masks. It then created a new price code (cannot change prices without changing price code): price_1KzoQkCOL3X1doeXOy2OfORX
- The product is now listed as "active", so should respond appropriately. The trick is submitting an appropriate multiplier of "number of units".
I've updated the new price API UID in stripeapi.js
and pushed it live and rebooted the server.
My hasty tests APPEAR to be working. Could someone review/confirm, please?
In my test, the payment succeeded (and shows up correctly in the Stripe dashboard), but just returns to the main donatemask.ca page without any confirmation page. So it worked, but it's not obvious to the user. I'm not sure how to capture the "success" response from Stripe and then show a "thank you for donating page". Help please?
I can also confirm that the donation did show up in the MongoDB correctly and is appearing in the stats correctly.
In my test, the payment succeeded (and shows up correctly in the Stripe dashboard), but just returns to the main donatemask.ca page without any confirmation page. So it worked, but it's not obvious to the user. I'm not sure how to capture the "success" response from Stripe and then show a "thank you for donating page". Help please?
https://github.com/mekkim/donatemask/blob/38b48ec1710a3d123afe9b0b36e515f91386e539/server/routes/stripeapi.js#L46
We'll have to add a page/component for this route when params.success == true
or something similar
We'll have to add a page/component for this route when
params.success == true
or something similar
Kool!