#forbiele_paymentlink-metadata

1 messages ยท Page 1 of 1 (latest)

nova narwhalBOT
#

๐Ÿ‘‹ 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.

velvet bolt
#

@narrow talon

narrow talon
#

but on cancel it doesnt pass this value
Can you explain more what you're trying to achieve?

velvet bolt
narrow talon
#

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

nova narwhalBOT
narrow talon
#

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)

velvet bolt
#

client_reference_id is not available at customer.subscription.deleted
so how am i supposed to put isPremium false

narrow talon
#

client_reference_id is only on the checkout session

velvet bolt
#

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

narrow talon
#

Are you creating the checkout sessions via the API?

velvet bolt
#

im using stripe payment link

#

and webhook

twin burrow
#

Hi there ๐Ÿ‘‹ taking over, as my colleague needs to step away

Give me a few minutes to get caught up.

twin burrow
#

Are you creating the Payment Link in the Dashboard? Or via the API?

velvet bolt
#

to it

#

like this

twin burrow
#

And you're setting that URL as your return_url, yes?

velvet bolt
#

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

twin burrow
#

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

velvet bolt
twin burrow
#

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

velvet bolt
#

i was saying earlier

#

problem is on cancel

#

customer.subscription.deleted

twin burrow
#

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.

velvet bolt
twin burrow
#

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.

velvet bolt
#

thats it

twin burrow
velvet bolt
#

but i do

#

here

#

and it still gives me blank

#

sesion completed gives tho

twin burrow
#

Did you look at the doc I sent you? That's a completely different metadata attribute

twin burrow
#

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.

velvet bolt
twin burrow
#

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;

velvet bolt
#

ok i understood i get this metadata for
customer.subscription.created
and
customer.subscription.deleted

twin burrow
#

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

mild roverBOT