#anil8486

1 messages · Page 1 of 1 (latest)

calm quailBOT
barren wolf
#

Hi there!

#

How can I help?

frigid juniper
#

Hi ,
I am using stripe.checkout.sessions.create , i am getting cors error.
I am using node js

barren wolf
#

Where is the error? In the browser console? Does the Checkout Session page loads correctly?

frigid juniper
#

No

#

Yea in the browser console

#

I have created a api (/subscription) inside this i have checkout.sessions.create

barren wolf
#

So the Checkout Session page is not loading?

frigid juniper
#

Yes its not loading

barren wolf
#

Can you share the Checkout Session ID or URL here?

frigid juniper
#

Do i need to redirect from the front end?

barren wolf
#

There are two main ways to do the redirect:

  • Return the checkout.url from your backend, and then on the frontend update the window.location
  • Or do a <form action="xxx" method="POST"> on the frontend and the backend can do a redirect
frigid juniper
#

Okay

#

How can i get the subscription id in frontend?

barren wolf
#

We are talking about a Checkout Session redirect here. Wny are you asking about Subscription? Is this a new question?

frigid juniper
#

Yes , by checkout.sessions.create i am doing mode: "subscription" , so how can i get the subscription id

barren wolf
frigid juniper
#

But that object we are getting before subscription is created that's why its null

barren wolf
#

I don't understand.
First you create the Checkout Session and redirect the user to the Checkout page. Once the user submit the form, you will get a Subscription object in the Checkout Session.

frigid juniper
#

Yes i am redirecting to checkout form

#

But on submit the form which api to call?

barren wolf
#

Then you can listen to the checkout.session.completed webhook event to run any code you want.

frigid juniper
#

Okay thanks.

#

This will be for first month,,
Like its subscription do i need to use other web hooks

barren wolf