#sethu_best-practices
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/1506215868265136138
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Please help us about how we can send the dicounts amount lineItems for the strpePayment link.
Sure
so the reason you're getting the error is because you're trying to pass a discounts property to the Create Payment Link API, which doesn't support this
you can see that discounts isn't mentioned as a supported property here: https://docs.stripe.com/api/payment-link/create
it's important to understand the distinction between creating a Payment Link vs creating a Checkout Session
because, the Create Checkout Session API does support setting a discounts array directly:
https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-discounts
the Payment Links API is used to create reusable links to share with multiple customers, while the Checkout Session API is used to create a single-use session, which is why they're different here
if you want to share a Payment Link with a customer, and pre-fill a coupon/discount, you can use a prefilled_promo_code URL parameter when sharing the URL with the customer: https://docs.stripe.com/payment-links/customize#customize-checkout-with-url-parameters
otherwise, if you want to create a single-use payment page, then the Checkout Sessions API might be more suitable
ok