#bereket
1 messages · Page 1 of 1 (latest)
@fluid scarab you might want to look at Payment Links if you literally just want a URL to a pre-configured Checkout Session: https://stripe.com/docs/payments/payment-links
how am I able to make a payment link?
my bad if my question was confusing
Have you looked at the docs?
I want to make a session for the portal through the API
I have but it's a bit confusing
what is "a session for the portal through the API"
stripe.sessions.create()
What we call the portal is the Customer Portal which is a completely different product
by portal I mean like yeah the customer portal
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
this yeah
got it
thank you :)
oh and another thing (if you know)
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?
Try console.log(JSON.stringify(session)); instead maybe?
oh actually
getting: No such price: '25000'
ah so you forgot to handle errors really https://stripe.com/docs/api/errors and also didn't really read the docs :p
price is supposed to be an existing Price object in your Stripe account, like price_123456 that you need to create first
totally fine
just take the time to read through the docs for a few minutes as we show real end to end examples
this is the docs for creating prices right?
or is it a manual thing?
not through the api
in the dashboard
you can do it in the Dashboard yes
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},
});
sure
@fluid scarab what have you tried?
A Price is associated with a Product
https://dashboard.stripe.com/test/products is where you'd do this
so in this case price would be "ID"?
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
Ohh
I see yeah
got it alright
yep that's the one!