#michael-harvey_payment-links-metadata

1 messages ยท Page 1 of 1 (latest)

whole mulchBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

vast horizon
#

Hi ๐Ÿ‘‹

How are you creating the Payment Link?

#

You can attach metadata directly to the Payment Link using the metadata parameter. However, if you are listening to the payment_intent.succeeded webhook event it might make more sense to set the metadata on the related Payment Intent.

#

In that case you can use the payment_intent_data.metadata parameter

quiet hearth
#

which event should i listen to to get the metadata?

vast horizon
#

That depends on where you put the metadata.

#

And that depends on what information you need in your integration. So, is it important for you to track when the payment intent succeeds?

quiet hearth
#

yes, because this is where i can see the stripe account id, and the payment amount.

#

when a payment link is created, which webhook event is this?

quiet hearth
#

how do i create a payment intent with a link?

vast horizon
#

Sorry but these questions don't make a lot of sense.

#

Payment Links automatically create Payment Intents when the customer completes their checkout process

#

How are you creating Payment Links?

quiet hearth
#

//Create price object for payment link
long stripeAmount = StripeAmountFormat(paymentLinkRequest.Amount);
Price price = await CreateProductPrice(accountDetails.AccountID, accountDetails.ProductID, stripeAmount);

//Get Payment Link from Stripe
var options = new PaymentLinkCreateOptions()
{
LineItems = new List<PaymentLinkLineItemOptions>()
{
new PaymentLinkLineItemOptions()
{
Price = price.Id,
Quantity = 1
}
},
Metadata = new Dictionary<string, string>()
{
{ "PatientId", paymentLinkRequest.PatientID.HasValue ? paymentLinkRequest.PatientID.Value.ToString() : "" },
{ "ProviderId", paymentLinkRequest.ProviderID.HasValue ? paymentLinkRequest.ProviderID.Value.ToString() : "" }
}
};

RequestOptions requestOptions = new RequestOptions();
requestOptions.StripeAccount = accountDetails.AccountID;

PaymentLinkService service = new PaymentLinkService();
PaymentLink result = await service.CreateAsync(options, requestOptions);

#

not seeing metadata in the webhook events

vast horizon
#

What webhook events? Do you have an event ID I could look at?

quiet hearth
#

how do i put metadata on payment intent, considering that there is no payment intent when the link is created?

vast horizon
#

You use the parameter I mentioned earlier.

#

payment_intent_data.metadata

#

This will add that metadata to the Payment Intent when it gets created

#

Set of key-value pairs that will declaratively set metadata on Payment Intents generated from this payment link.

The description of this parameter from our docs

quiet hearth
#

that worked!

vast horizon
#

Awesome ๐ŸŽ‰