#bhavyacodes

1 messages ยท Page 1 of 1 (latest)

sour yewBOT
void sentinel
#

if you don't want to use a beta, then integrate with Elements instead.

vast roost
#

yes, I wanna know which api to call exactly? earlier I was using createPaymentIntent and passing the client_secret to PaymentElement component on react frontend

#

what data should and to what component can I pass for subscription

void sentinel
#

you use the PaymentIntent that comes from the Invoice of the Subscription

vast roost
#

Yes but its null for some reason

#
  const session = await stripe.checkout.sessions.create({
    line_items: [
      {
        // Provide the exact Price ID (for example, pr_1234) of the product you want to sell
        price: prods.basic.priceId,
        quantity: 1,
        // price_data
      },
    ],
    mode: "subscription",
    success_url: `${process.env.DOMAIN}?success=true&userId=${userId}`,
    cancel_url: `${process.env.DOMAIN}?canceled=true&userId=${userId}`,
  });

  console.log(session);

void sentinel
#

why are you creating a CheckoutSession?

vast roost
#

sorry I am too new to recurring subscriptions ๐Ÿ˜“

#

recurring payments*

void sentinel
#

that's not relevant here since you want to use Elements instead, so you'd use e.g await stripe.subscriptions.create(...) like the doc I linked, you wouldn't be using Checkout at all

vast roost
#

okay, thanks @void sentinel i'll go through the steps and let you know if I face any other problem ๐Ÿ™‚

void sentinel
#

FWIW I do recommend using Checkout instead, it's much easier

#

if you're concerned about the beta of the embedded Checkout(you seemed very adamant about that in your first message), I wouldn't be, it's planned to come out of beta quite soon

vast roost
#

My team leader is concerned, I can't do much about that

#

and user not leaving our website is a hard requirement

void sentinel
#

cool then sounds like embedded Checkout might be a good fit!