#alex_connect
1 messages · Page 1 of 1 (latest)
you control what amount you charge since you call the API to do so and can pass a smaller amount or use our Coupons API, depends on how exactly you do the payment.
I'm going with destination charges for standard accounts.
I wonder if the coupons API is a good fit for sales
it can be if you're using a method of taking the payment which supports the use of Coupons(which would be one time invoices/Subscriptions/CheckoutSesssion and I think the Orders API)
if you're using raw PaymentIntents they just take an amount from your code and not any higher-level concepts like Coupon objects
I'm using checkout sessions, so I guess I would pass the discounts parameter, but I have to know which coupon can be applied on the product
I have to know which coupon can be applied on the product
Is there a way to get this information?
https://stripe.com/docs/payments/checkout/discounts
but I have to know which coupon can be applied on the product
I mean that's more a of a business logic thing, your code either passes the coupon or not and you know what line_items you're using and you'd have your own logic for whether it should be allowed to be discounted or not
That's what I was having doubts about. I was wondering if there was an endpoint to retrieve coupons that can be applied to a given product (since we can choose products for which a coupon applies) and then dynamically decide which one to apply before creating the checkout session
Well thanks for the clarification
retrieve coupons that can be applied to a given product (since we can choose products for which a coupon applies
https://stripe.com/docs/api/coupons/retrieve and then simply look atapplies_to?
Well, I would have to query all available coupons and then filter them. Doable but a bit cumbersome
But thanks for the idea!
or keep it in your database really, like I said this is mostly business logic
applies_to is mainly for when you're using PromotionCodes where the end-customer effectively can pick the coupon
if you're passing it directly yourself based on the seller's preference then you choose the discount in business logic and pass the right things to the API call
That's what I'll end up doing I think. I just wanted to make sure I was not missing something that Stripe had enabled for sales
I have a follow-up question. I am considering having checkout sessions with more than one product, from different sellers. To do so, I understood that I need to handle myself the charge and the transfers.
But in a case where there's a sale on the whole marketplace, end-customers might have a cart with a product discounted at -15% and another one at -30%.
Since I can only pass one discount to the checkout session, I wouldn't be able to create a checkout session for both products with the right discounts, would I?
we don't support per-line-item discounts on Checkout today unfortunately
Do you know if that's a feature coming up or is it low-priority?
not aware of what our plans are
if it's important to you you should write to https://support.stripe.com/?contact=true to raise the feedback so it can be associated with your business and merchant account, which helps with prioritisation of backlogs
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Thanks, I'll do it!
So, the way I would do it for discounted multiseller products checkout sessions is not use the coupons at all.
So, instead of doing such a call:
curl https://api.stripe.com/v1/checkout/sessions \
-u sk_test_4N...: \
-d "line_items[][price]"="price_1LVAQV46T03ISJOc099olWTV" \
-d "line_items[][quantity]"=1 \
-d "discounts[][coupon]"="gpyrFEJt" \
-d "payment_intent_data[application_fee_amount]"=700 \
-d "payment_intent_data[transfer_data][destination]"="acct_1LUY1aQTEyybitrV" \
-d "mode"="payment" \
-d "client_reference_id"="userId" \
-d "success_url"="https://example.com/success" \
-d "cancel_url"="https://example.com/cancel"
I would have to compute myself the price after discount and do this call:
curl https://api.stripe.com/v1/checkout/sessions \
-u sk_test_4N...: \
-d "line_items[][product]"="Paul Atreides" \
-d "line_items[][amount]"=1700 \
-d "line_items[][currency]"="eur" \
-d "line_items[][quantity]"=1 \
-d "discounts[][coupon]"="gpyrFEJt" \
-d "payment_intent_data[application_fee_amount]"=700 \
-d "payment_intent_data[transfer_data][destination]"="acct_1LUY1aQTEyybitrV" \
-d "mode"="payment" \
-d "client_reference_id"="userId" \
-d "success_url"="https://example.com/success" \
-d "cancel_url"="https://example.com/cancel"
But I'm just wondering if I lose features (in the dashboard or elsewhere) when creating an Checkout session for items that don't have a product id
yes, the reporting experience is less rich