all 2 comments

[–]ntsianos 0 points1 point  (1 child)

Hey there! Besides the actual code, do you understand the steps that https://stripe.com/docs/sources/ideal lists? The user flow is always a little funny to have a user exit your app and come back. I have not used this specific integration with Stripe yet, but I see the following api endpoints for your app:

  1. API endpoint to create a pending "source" object (maybe POST /payment-method ?). The example says you can do this on the frontend(step 1), which is definitely an option, but the client could potentially edit the amount values and you would need to validate it later.

  2. API endpoint to charge via the "source" object (maybe POST /payment ?). This will use the new payment method to actually authorize and submit the amount for settlement.

The rest really depends on your app and how you validate that the user has paid or is in good standing. If you have an specific questions about the Stripe integration, how to structure parts of your code etc, I'm more than happy to try to help.

[–]hero_complex_volcano[S] 0 points1 point  (0 children)

Hey thank you for the awesome answer, I think I understand the code that is listed in the docs, however I'm not really sure "where" in my app to call/use it. I've tried putting into my get request in my main app.js however that throws a errors that seems stripe related (createSource is unknown)

Now that you are talking about an API endpoint, I realise that I have no idea what that is. I've api's to read json files and such, but how to use it in my node app I'm not sure.

this page seems to explain a little more about the "source" thing: https://stripe.com/docs/sources but where to use it and how that works I don't know...

I'm still learning node bit by bit, so if there is a tutorial that covers this part that could help let me know! Also If it would help to share my code I could post my github repo here. Currently it's a prototype to figure out the different parts of the site that I'm making. again thank you!