#phonicuk - Payment Links

1 messages ยท Page 1 of 1 (latest)

livid pollen
#

Hi ๐Ÿ‘‹

short prism
#

Hi, I think I found it as it happens - it's just the payment_link field? Seems to match up with the ID of the link as seen in the dashboard URL?

livid pollen
#

I think so but looking for the docs example for webhook events related to payment links.

short prism
#

checkout.session.completed gets fired just fine and that seems to include that field matching the URL from the dashboard but I've not seen anything explicitly saying it's OK to do this

livid pollen
short prism
#

Righto, thanks ๐Ÿ™‚ As some feedback it'd be nice for these hooks to include the product ID to simplify a little, but this is also fine

#

cheers ๐Ÿ™‚

livid pollen
short prism
#

checkout.session.completed didn't contain that field

#

nor charge.succeeded

livid pollen
#

The event shoudl return a Checkout session object

#

Can you share an event ID?

short prism
#

evt_3KlyjaHd51xGsopZ1MaqDzw2

#

or rather evt_1KlykgHd51xGsopZPqCKtCwT for checkout session completed

#

Doesn't appear to be any data in those events for a clicked link that tells me what the product was, if I've found a bug I'm very amused xD

livid pollen
#

Hmmm...right. You'd need to fetch the full Checkout Session and expand the line_items.price attribute.

short prism
#

aaaah that's far more convenient

#

I didn't see that, I can use my internal ID instead then

#

thanks ๐Ÿ˜„

#

assuming the metadata makes its way through to the webhook that is, otherwise I might as well just use the link ID to keep it fast

livid pollen
#

Metadata associated with this Payment Link will automatically be copied to checkout sessions created by this payment link.
But I would definitely test this to be sure

short prism
#

๐Ÿ‘

short prism
#

What's the ID for that? I've tried looking it up from the ID of CheckoutSessionCompleted but it reports no checkout with such an ID

#

aah never mind - the API actually says to retrieve the line items from the payment link

#

there is no checkout to retrieve for links

#

Something weird is going on, if I try to look up anything from the test request it says it doesn't exist:

livid pollen
#

I'm not sure what tools you are using and what that error represents.

#

Do you have a request ID?

short prism
#

Sorry, that's from visual studio - I'm using the C# SDK

#

sorry having a hard time navigating the site to find the request ID, one moment

#

req_hAZEmAbTwqx7wW - apparently it returns a 200 and provides the appropriate information, but the SDK is throwing an exception saying there's no such paymentlink

#
case Stripe.Events.CheckoutSessionCompleted:
    var checkoutData = stripeEvent.Data.Object as Session;

    var options = new PaymentLinkListLineItemsOptions
    {
        Limit = 3,
    };
    var service = new PaymentLinkService();
    StripeList<LineItem> lineItems = service.ListLineItems(checkoutData.PaymentLinkId, options); // <---- Exception here
#

wait that's not the right request ID, there's no requests in the log for anything coming from the SDK to request information

#

req_vQi2NsKypuMCW7 - there we go, from the exception

#

ah never mind - figured it out

livid pollen
#

๐Ÿ™Œ

#

So what was the problem? because I definitely found that payment link (altough it might have gone to archive do to your expiry setting)