#bereket

1 messages · Page 1 of 1 (latest)

warped basalt
fluid scarab
#

my bad if my question was confusing

warped basalt
#

Have you looked at the docs?

fluid scarab
#

I want to make a session for the portal through the API

fluid scarab
warped basalt
#

what is "a session for the portal through the API"

fluid scarab
#

stripe.sessions.create()

warped basalt
#

What we call the portal is the Customer Portal which is a completely different product

fluid scarab
#

by portal I mean like yeah the customer portal

warped basalt
#

If you create a Session yourself there's a url returned on that resource that you can redirect to

#

lol

#

I'm lost now sorry

#

The Customer Portal and Checkout are completely separate products, and incompatible, they do different things

fluid scarab
#

got it

#

thank you :)

fluid scarab
#
const session = await stripe.checkout.sessions.create({
                line_items: [
                  {
                    price: '25000',
                    quantity: 1,
                  },
                ],
                payment_method_types: [
                  'card',
                  'acss_debit',
                  'ideal',
                ],
                mode: 'payment',
                success_url: '/success',
                cancel_url: '/cancel',
              });
#

When I console.log "session"

#

it returns nothing

#

as well as session.url

#

am I doing something wrong?

warped basalt
#

Try console.log(JSON.stringify(session)); instead maybe?

fluid scarab
#

getting: No such price: '25000'

warped basalt
#

price is supposed to be an existing Price object in your Stripe account, like price_123456 that you need to create first

fluid scarab
#

ahh okay

#

super sorry 😅 - first time working with stripe

warped basalt
#

totally fine

#

just take the time to read through the docs for a few minutes as we show real end to end examples

fluid scarab
#

this is the docs for creating prices right?

#

or is it a manual thing?

#

not through the api

#

in the dashboard

warped basalt
#

you can do it in the Dashboard yes

fluid scarab
#

ah alright

#

I also had this:

export const createPrice = async (
    name: string,
    amount: number,
    tierId: string
) =>
    stripe.prices.create({
        unit_amount: amount,
        currency: 'cad',
        metadata: {
            tier_id: tierId,
        },
        recurring: {interval: 'month'},
        product_data: {name},
    });
warped basalt
#

sure

fluid scarab
#

just curious

warped basalt
#

@fluid scarab what have you tried?

#

A Price is associated with a Product

fluid scarab
#

so in this case price would be "ID"?

warped basalt
#

no, that's a Product you need a Price

#

One Product represents what you sell, for example a Netflix basic subscription and it can have N prices, for example one per currency

warped basalt
#

yep that's the one!

fluid scarab
#

when I redirect to the session url with session.url I receive "Not a valid URL" and when I console log session I still get nothing

#

but there are logs

#

that it's posting to the route

#

but what I receive is nothing

warped basalt
#

I'm sorry, I'm happy to help but I need more details and you likely want to debug things for a few seconds first

#

right now you seem to have copy-pasted a Price id and then an error and said "doesn't work"