#phonicuk - Payment Links
1 messages ยท Page 1 of 1 (latest)
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?
I think so but looking for the docs example for webhook events related to payment links.
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
Based on the API reference doc: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-payment_link
I think using the payment_link attribute to match it back to the payment link you created is the correct approach.
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 ๐
You can find it in the line_items : https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items-data-price-product
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
Hmmm...right. You'd need to fetch the full Checkout Session and expand the line_items.price attribute.
Or you could add the product ID as metadata to the payment link when creating it: https://stripe.com/docs/api/payment_links/payment_links/create#create_payment_link-metadata
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
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
๐
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:
I'm not sure what tools you are using and what that error represents.
Do you have a request ID?
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
https://stripe.com/docs/api/checkout/sessions/line_items?lang=dotnet is what I'm following
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
req_vQi2NsKypuMCW7 - there we go, from the exception
ah never mind - figured it out