#Ese

1 messages · Page 1 of 1 (latest)

floral geyserBOT
slate silo
#

How are you making your request to your server that creates the checkout session? Are you doing a form submit or are you doing a fetch request?

cedar wolf
#

form submit

slate silo
#

Can you show me a small snippet of what your client-side code looks like?

cedar wolf
#

Ok, I have a page that currently only has a button so I know that stripe is working before moving forward. Here is the code:
<%= form_with url: checkout_path, method: :post, class:"" do |f| %>
<%= f.submit "Checkout", class:"btn btn-success" %>
<% end %>

slate silo
#

Or do you have data-remote enabled?

cedar wolf
#

No, I will take a look at the turbo plugin
I don't think I have data-remote enabled unless it is enabled by default

slate silo
cedar wolf
#

Changing the local: to true or false did not change anything

#

And I am using the turbo-rails plugin because it comes there by default with rails 7

slate silo
#

Ah, that's the issue then - you'll need to disable turbo for your form

cedar wolf
#

Disabling turbo did not change anything unless I am disabling it wrong

slate silo
#

How are you disabling it?

cedar wolf
#

This is my new code:
<%= form_with url: checkout_path, method: :post, class:"", turbo: false do |f| %>
<%= f.submit "Checkout", class:"btn btn-success" %>
<% end %>

slate silo
#

Try this:
<%= form_with url: checkout_path, method: :post, class:"", local: true, data: { turbo:false } do |f| %>

cedar wolf
#

That worked.
Thank you

slate silo
#

awesome! glad to hear it 🙂

cedar wolf
#

Ah, I got another issue, It does not stop stripe from working but in the Stripe CLI I am getting a 422 POST instead of a 202 or 200 ok POST

floral geyserBOT
slate silo
#

You need to be more specific - what request specifically are you getting the 422 post for?

cedar wolf
#

When I go through the form and proceed with the checkout. The payment gets processed and on the webhooks that is listening to the transactions I get this data:
--> charge.succeeded [evt_stuff1]
--> payment_intent.succeeded [evt_stuff2]
--> checkout.session.completed [evt_stuff3]
--> payment_intent.created [evt_stuff4]
<-- [422] POST http:// localhost:3000/checkout [evt_stuff1]
<-- [422] POST http:// localhost:3000/checkout [evt_stuff2]
<-- [422] POST http:// localhost:3000/checkout [evt_stuff3]
<-- [422] POST http:// localhost:3000/checkout [evt_stuff4]

solar peak
#

That's your localhost server returned 422 to our Webhook events. You have your server log, you can see where it stucked and which logic it ran through