#forbiele_paymentlink-metadata
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1240766939177943172
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
@narrow talon
but on cancel it doesnt pass this value
Can you explain more what you're trying to achieve?
im making a discord bot and i pass guild id.
When subscribed in database add isPremium to true
When unsubscribed put isPremium to false
Sure but what do you mean the value is not passed? You're setting this on the session, so you can retrieve it afterward if needed
what?
for example, you could set cancel_url=https://example.com/cancel/path?session={CHECKOUT_SESSION_ID} then retrieve that session and inspect the client_reference_id if you need that (or use metadata)
client_reference_id is not available at customer.subscription.deleted
so how am i supposed to put isPremium false
client_reference_id is only on the checkout session
in lemon squeezy u could just put &checkout[custom][guild_id]=<%= guild.id %> and then on every event related to this subcription it would return guild id so i knew for who to remove
^ how do i do same in stripe
Are you creating the checkout sessions via the API?
wdym
im using stripe payment link
and webhook
Hi there ๐ taking over, as my colleague needs to step away
Give me a few minutes to get caught up.
Hey any info?
Are you creating the Payment Link in the Dashboard? Or via the API?
i just copied the payment link and added ?client_reference_id
to it
like this
And you're setting that URL as your return_url, yes?
?
im just doing <a href="">Subscribe</a>
bro hows it taking so long
this should be obv for yall
@narrow talon
W support team
const paymentLink = await stripe.paymentLinks.create({
line_items: [{
price: 'price_1PGVzJHWl7CuSi1wDU8SH1dz',
quantity: 1
}],
metadata: {
guild_id: guildID
}
});
return paymentLink.url;
i did this yet it still not giving me
Please be patient and don't ping folks. We have a busy server and we're making our way back through each thread as fast as we can
ur literally answering more complicated question that was asked AFTER mine
We prioritize based on how fast we can context switch and if there's an easy follow-up while we're in the thread.
For the Payment Link creation you mentioned above, you're adding metadata, which means the Payment Link itself will have that metadata. If you want to retrieve this after the Payment Link is created, you can either retrieve the Payment Link object (https://docs.stripe.com/api/checkout/sessions/retrieve), or you can get the metadata via webhook the checkout.session.completed Event after the payment is complete: https://docs.stripe.com/api/events/types#event_types-checkout.session.completed
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
i do get using chckout session completed
i was saying earlier
problem is on cancel
customer.subscription.deleted
Please don't jump into other people's threads. There's no reason to disrupt other people's conversations. It won't get you answers any faster and will result in us banning you from the server.
This was long time ago + instead of writing this u couldve helped me
Follow the guidance we give on etiquette and we won't need to spend time warning you.
To your question: the metadata doesn't populate on other objects. If you set metadata on the Payment Link object, it stays on the Payment Link object. You can programmatically set metadata on other objects if you want, but in order to retrieve that specific metadata on the Payment Link object, you will need to retrieve the Payment Link object explicitly or wait for the checkout.session.completed webhook.
Just tell me one thign how do i save guild_id in meta data for it to be sent on cancel webhook
thats it
Set subscription_data.metadata when you create the Payment Link: https://docs.stripe.com/api/payment_links/payment_links/create#create_payment_link-subscription_data-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
const paymentLink = await stripe.paymentLinks.create({
line_items: [{
price: 'price_1PGVzJHWl7CuSi1wDU8SH1dz',
quantity: 1
}],
metadata: {
guild_id: guildID
}
});
return paymentLink.url;
but i do
here
and it still gives me blank
sesion completed gives tho
Did you look at the doc I sent you? That's a completely different metadata attribute
thats what on ur doc
No it's not. What's in our doc is subscription_data.metadata. You're putting metadata on the Payment Link object itself. You need to set metadata via subscription_data so that it gets added to the Subscription once it's created.
can u just modify my code to have it the right way?
This chat is for developers to talk to developers and we would expect that you already know how nested object attributes work, so we don't usually write the code for you. That being said, if it gets you unblocked, here you go:
const paymentLink = await stripe.paymentLinks.create({ line_items: [{ price: 'price_1PGVzJHWl7CuSi1wDU8SH1dz', quantity: 1 }], subscription_data: { metadata: { guild_id: guildID } }, }); return paymentLink.url;
now theres nothing even on checkout.session.completed
ok i understood i get this metadata for
customer.subscription.created
and
customer.subscription.deleted
you can add the other metadata line back in too. I just took it out since it didn't seem like you needed it on the Payment Link object