Stripe Checkout Tutorial

I’m getting this error when sending test webhook to my website. I have used url of my index page

It needs to be set to your endpoint (webhook) url/server action file instead of your index page.

1 Like

Have tried that too but not resolved

I’m using dataAPI in my bubble app and willing to insert data in bubble app database from wappler app. I have made a simple table with 2 attributes name and age. Now when I try to insert data it gives me this error.
When I use url: myappurl?name=anyname&age=anyage, it inserts the data correctly. But if I put name and age in “input data” it throughs this error. Any suggestion ?

image

I haven’t checked this box in bubble settings>API section that’s why getting that error

I managed to work myself through this tutorial and through I had it all figured out but then I realized that when I put two items in my datastore cart and went through to checkout only the first line item was showing in the Stripe Checkout page. I checked the database and the table I was using contained two entries for the two items I had entered into the cart so I am not getting the array that contains all the items back into the API from my database. I am using the price feature on stripe so here is the value from the api name : value fields: Name–> line_items[0][price] Value–> {{record_repeat[0].priceID}}

Here is the log file from Stipe that shows what is being passed:

Any suggestions or readings would be appreciated. I have been working on this for a week with no progress.

thank you

Does anyone have a suggestion regarding this issue or where[quote=“dmbe11, post:47, topic:21518, full:true”]
I managed to work myself through this tutorial and through I had it all figured out but then I realized that when I put two items in my datastore cart and went through to checkout only the first line item was showing in the Stripe Checkout page. I checked the database and the table I was using contained two entries for the two items I had entered into the cart so I am not getting the array that contains all the items back into the API from my database. I am using the price feature on stripe so here is the value from the api name : value fields: Name–> line_items[0][price] Value–> {{record_repeat[0].priceID}}

Here is the log file from Stipe that shows what is being passed:

Any suggestions or readings would be appreciated. I have been working on this for a week with no progress.

thank you
[/quote]

to go to find an answer?

The tutorial shows how to send a single line item. You’d need to send Stripe your line items as an array which would look something like line_items[0], line_items[1], line_items[2] etc…

I thought that I needed to send an array but my question is how do I send the items back as an array? My database has a line for each entry and I need to select the entries associated with a specific order and place it into the array as pointed out by Max:

line_items[0], line_items[1], line_items[2] etc…

There must be a tutorial or something that can help me? That is what I am looking for. Thanks in advance.

Hello everyone, I am struggling trying to figure this out. If anyone could help I would be grateful. I would consider paying for some tutoring. If you are interested please send me a pm. Thx

@max_gb - is your project PHP? I’m having issues with getting my NodeJS to run the JS script (undefined) (reported it as a bug) so wondered if yours is PHP or if it is Node, did you experience the same?

The tutorial was PHP and I was able to complete Stripe integration following it on PHP no problem. Not sure what the difference would be for Node.js.

1 Like

Thanks @brad. the FLOW simply won’t run a JS script - so looks like a bug in Node.

@max_gb

This webhook endpoint looks like a security problem? Usually I have the “Security Provider” and “Security Restrict” set in my server action before all database queries and updates are made. If these are set, the webhook endpoint will not execute. It fails with an “Unauthorized” response.

How would you secure this endpoint?

The security hole here would be an attacker guessing the Payment Intent, which is highly unlikely. There is no need in my eyes to add the security provider to this endpoint server action. If you wish to secure it further, you can follow Stripe’s official documentation for verifying webhooks -https://stripe.com/docs/webhooks/signatures#verify-manually

Hi Max, just a quick question, are these names you have provided important to the payment working in Stripe at all, I used my own names and made minor adjustments so it all tied up correctly, but for some strange reason after I click the submit button it does all the background stuff but never redirects the browser to https://checkout.stripe.com.

A little unsure why, but I assume the names of your folders or action files have anything to do with the scripts working in stripe, but never harms to ask.

Edit: I have a suspicion this is to do with CORS or something in Node.js, has anyone done this in a Node.js project?

Edit2: Can anyone confirm if after successful redirection the chrome network tab has some additional entries, such as…
Screenshot 2021-01-06 at 08.33.44
The capture-booking is my main action that runs when i click pay, and after all its API and database procedures run, then these other entries show up, although my browser window never redirects to https://checkout.stripe.com.

This has been solved by Teo.

I had to alter the dmx.parse because I was accessing it from another place, in other words my form is inside a partial in Node.js, so I needed to adjust mine to sessionId: dmx.parse('content.cartForm.data.stripe.data.id') just adding the word content. in front and then all worked as expected.

Hope this helps someone.

2 Likes

@max_gb
Hello.
I have a different need for the project I am creating.
I don’t need a shopping cart, I have a “payment” page where the user
manually enters the data required for payment.
Upon submitting the form, a new record is created in the “payments” table of the database.
So in addition to saving the record in the database, I should link your tutorial checkout and view it in Stripe
But in the checkout action of your tutorial if I insert the data coming from a Query the API schema gives an error
Maybe something wrong?