#alex_connect

1 messages · Page 1 of 1 (latest)

fast mist
#

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.

outer frigate
#

I'm going with destination charges for standard accounts.

#

I wonder if the coupons API is a good fit for sales

fast mist
#

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

outer frigate
#

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?

fast mist
outer frigate
#

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

fast mist
outer frigate
#

Well, I would have to query all available coupons and then filter them. Doable but a bit cumbersome

#

But thanks for the idea!

fast mist
#

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

outer frigate
#

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

outer frigate
#

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?

fast mist
#

we don't support per-line-item discounts on Checkout today unfortunately

outer frigate
#

Do you know if that's a feature coming up or is it low-priority?

fast mist
#

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

outer frigate
#

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

fast mist
#

yes, the reporting experience is less rich