Stripe Checkout Shipping Address

Hey!

Im using the Stripe integration and the Checkout workflow action.
I want to add shipping address to the checkout session and I dont see how to add parameters into the action.

Is there any way to solve it?

Thanks!

Hi @nicolasgaler :wave:

The Stripe plugin is meant for basic transactions only. It’s only meant to receive credit card info and realize straightforward transactions. For any other advanced features: subscriptions, recurring payments, etc, we recommend you do this in your backend, as it is industry standard. I would personally handle everything in the backend, passing the data to an endpoint like https://your-backend.com/create-checkout

Thanks @danlopes ! I implemented the specified backend and it works fine. I wanted to take out the Stripe Plugin from my project, since Im not using it anymore and implemented a function that redirects to stripe:

const stripe = Stripe(“pk_live_51Q9niDEQ4MIgFMw3IQ3AS7ZVOj7Nq19vmoUw2h5TylCF7SeuCQ6oXtbokjQALtF8zacCuLONY3cPAhtwveaWtSRf00YR5LpUq5”);

async function createCheckoutSession() {
const response = await fetch(‘https://stripe-checkout-63512301944.us-central1.run.app/create-checkout-session’, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’
},
});

const data = await response.json();
variables[/* oderId */‘c72a449d-7819-4271-b8dd-b3f53d65721f’] = data.user_order_id
const session = data.sessionId;

// Redirect to the Stripe Checkout page
const { error } = await stripe.redirectToCheckout({
sessionId: session
});

createCheckoutSession();

But Im getting an error as if Stripe wasnt installed. Although I added this to the header of my page: → so ensuring stripe is installed.

name: “ReferenceError”
message: “Stripe is not defined”

Do you know how can i fix it?

Sorry, @nicolasgaler, what I meant is creating payment links in the Stripe Dashboard, enabling shipping address and then, in the backend, set up webhook endpoints if necessary to handle other info you might need, such as order creation/updates - no code needed here. The client SDK you’re using will only run in the published version of the app if all embeds are correct.

Originally, for the checkout, I was thinking:

  1. Create checkout session and return session ID in the response + webhook endpoints. (backend)
  2. In WeWeb, just redirect the user to checkout using the returned session ID, nothing else.

I guess payment links are simpler in your case.