#manatee_api
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/1265211957661667341
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there, I'm not very clear about what you mean by " if promotion code will still be used". If you want to know if a promo code is still active, check https://docs.stripe.com/api/promotion_codes/object#promotion_code_object-active
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hello, what i mean is, promotion code can be assign to a product let's say Promo code "promo" is assign to the ProductA.
User want to change subscription from ProductA to ProductB. For a preview information about price changes i'm using endpoint v1/invoices/preview with params: subscription, customer, subscription_items.id -> current subscription product (ProductA), subscription_item.price -> ProductB.
From this i would also know if his promotion code which was used, will still be used for the new ProductB
It depends on the configuration of the Coupon - is it one-time, is it aplicable for both products A and B etc.
Are you asking what parameters you could use to check if the Discount is applied?
Yes, let's say my coupon is forever. I though that parameter lines.data.discount_amounts is not null will mean that promotion code will be used in the next payment cycle
Yes, that sounds right. Is it not working as expected?
Are you with me?
it is not, i've made test with promotion code which shouldn't be applied for the new product, and i still get the parameter discount_amounts
i'm sorry
I can't see the successful responses of GET requests, could you please paste it here?
ye let me try to get log for this request
req_QeTM9IOTaTeQbx can You see that request ?
taking a look
ok so this is a GET request, and we don't store the responses for that
would you mind pasting the JSON response you got?
ok, let me use postman and copy the response for You give me a few mins please
yes sure
Shouldn't it be null since the promotion code is not for the new product ?
It is 0 probably, because it is subscription modification, and for this the promotion code won't be applied.
If i make that subscription modification, then in the next payment circle i'm not getting the discount because, promotion code is not applicable for the new product.
So during subscription modification i still don't know if promotion code will be applicable in the next payment circle
the discount you applied is on the subscription level
and even if the discount is not applied
the discount_amount will be calculated regardless
Ok it is, that's why i get property discount. I understand that it is a reason why discount_amount is calculated.
Is there a way to know if this promotion code will be applicable in the next payment circle after subscription modification ?
The case is i want to notify the user that after subscription modification his promotion code will be still in use / or won't be in use anymore (and i need to know it before he changes the subscription)
since the discount amount is 0 this means that no discount will be applied after the subscription update
with all the respect i don't think it is right. Discount_amount means that during the subscription modification it doesn't apply the promotion code. But in the next payment circle it will apply.
If i paste You subscription id can You check what has been done for it ?
But in the next payment circle it will apply.
how so? if the discount is not valid for the price change, how would the discount be applied?
I think that when You change the subscription and by change the subscription i mean You change the price from A to price B, the promotion code will never be used, which is good actually.
it's not always the case
if the discount applies to the product it will be used to calculate the new price proration
"if the discount applies to the product" as a example above, the request response i've sent to You.
You can see that discount coupon i used is 100basic, i don't know if You can verify it, or You have to belive me, but this promotion code is applicable only for the product DGN Basic. But You can see that also in this response, i'm getting discount_amounts for the diffrent product.
AND TRUE the amount is 0 which i could understand as the promotion code is not valid for the new product.
BUT i've also tested the case where my promotion code should be valid, and i also getting the amount 0
oh also in the response as u can see there is property lines.data.discountable and i wanted to use it as a information if the promotion code will be used in the future, but this is always false for proration 😦 (but this is the information that i need)
sorry, I'm a bit lost. Could you open a support ticket at https://support.stripe.com/?contact=true with all the IDs, exact JSON responses , and context, so we can dig in in more detail?
Ok i will. But in tl;dr my question is I want a property lines.data.discountable information during proration for the future use.
Customer has subscription with promotion code A -> he wants to do subscirption modification, as a preview what will change i'm making v1/invoice/upcoming request with parameter subscirption_item.price. And i wanted to use lines.data.discountable property to return information to the user that his promotion code will still be used, but i cannot use that property because it is always false in proration
that's expected yes, proration is not discountable because it's already inclusive of discounts
https://docs.stripe.com/billing/subscriptions/coupons?dashboard-or-api=api#set-eligible-products
When you make changes to a subscription, any existing discounts are applied when proration is calculated. You can’t discount proration line items further on the invoice that’s generated.
also https://docs.stripe.com/api/invoices/line_item#invoice_line_item_object-discountable
Always false for prorations.
Yea and i wanted to ask if there is any other way i can verify that in the next payment circle the promotion code will be applied to subscription, other than making my own logic to validate promotion code
doesn't it appear in https://docs.stripe.com/api/invoices/object#invoice_object-discounts on the upcoming invoice?
like, it seems like it does? that is what di_1PWCx5IxUJgNoy3n3l4NgK4H is indicating in the response.
it's telling you this upcoming invoice has a discount applied and what coupon and promotion code generated that discount.
as i understand property discount it means that this subscription has applied coupon. But because i'm GOING TO (didn't change that yet) change the price for the subscription (which means new product, which means the promotion code can no longer be valid) this can lead to false information. What i mean it is true that on the current state this discount is corrent, but after change the price, this is no longer gonna be valid if the coupon is not for the new product.
Take that respone i've sent above as example discount coupon is set only for ProductA.
I've requested for upcoming invoice with the subscription_items.price to be changed (i call it subscription modification). In this case i expected the property lines.data.Id["il_tmp_1facbeIxUJgNoy3na5e745e2"].discount_amounts to be null, because coupon doesn't apply to the price: price_1OJMDxIxUJgNoy3n0l44MikK
and tarzan explain to me if there is coupon set to the subscription the property discount_amounts will be always calculated. And because of taht amount is 0 because this coupon doesn't work for the new product.
So i cannot use this property because discount_amounts: amount 0 can mean both, coupon won't be applied in future, or will be applied in the future
I've requested for upcoming invoice with the subscription_items.price to be changed (i call it subscription modification)
show me
- the code you use to make that API call
- the request ID
req_xxxxfrom that call - the exact JSON response
So i cannot use this property because discount_amounts: amount 0 can mean both, coupon won't be applied in future, or will be applied in the future
I really don't know what you're trying to say here. It seems really simple to me. Ifdiscountordiscountsis set on the Invoice, that invoice has a discount(a coupon applied to it). It it's not, there wasn't. Easy. Applies to the preview upcoming invoice too.
I will, which case do You want ?
Case A promotion code shouldn't be applicable for the new price
Case B promotion code should be applicable for the new price
whichever one you think is wrong/hard/the one you're having difficulty with.
i will give me a few minutes to create request
curl --location --globoff
'https://api.stripe.com/v1/invoices/upcoming?customer=cus_QMwo2mPUnPK4BB&subscription=sub_1PWCx5IxUJgNoy3nEDd2AXxW&subscription_proration_behavior=always_invoice&subscription_items[0][id]=si_QMwqgzZEcsFN8G&subscription_items[0][price]=price_1OJMDxIxUJgNoy3n0l44MikK'
--header 'Authorization: Basic
c2tfdGVzdF81MU8wVEU3SXhVSmdOb3kzbnpwcnZYSlBGYmFMUlBUQ3owM2pjR0hOQ1czRkpyeThxT0kyZkJ0RklYamdQV2g3OEZVeWl2eVU2cUpZYmxscFVQaVJDRzJ2dTAwVVhqNTZBc3Y6'
req: req_QeTM9IOTaTeQbx
Response: in the file message.txt
and according to what u said, i have the field discount != null so i should expect that promotion code will be applied in the next payment circle for the subscription with the price: price_1OJMDxIxUJgNoy3n0l44MikK but for me it is not true, because promotion code is not valid for this price
got it. The reason there is discounts here is because they're proration items, which are inclusive of the discount already applied. If there was an item for the next cycle(where the subscription is now on this new price), that item would not have a discount.
Yes indeed. So there is no way to get information if the coupon will apply for the future payment circle in this request ?
if you do the request without proration_behavior:always_invoice you should see an invoice with three items, two proration items and one item for the next cycle.
You right, that can be helpfull but, it shows Discount_amounts still even with amount: 0 and also the property discountable is true
it's zero because the proration is already inclusive of previous discounts, as I understand it. And yes, discountable is true is normal. discountable does not mean "this item had a discount" which is what you seem to think(that is actually, is there a non-null discount field on the item).
no no, discountable to me means, for this invoice item discount was use / will be used (depends it is incoming invoice or old one)
then your understanding is wrong I think
discountable just means, is it possible to reduce this item by applying a coupon.
for this invoice item discount was use / will be used (depends it is incoming invoice or old one)
that is actually, is there a non-nulldiscountfield on the item
we talking about this property https://docs.stripe.com/api/invoices/line_item#invoice_line_item_object-discountable right ?
yes
by "will apply" it means, "if you apply a coupon to the Invoice, will they apply to this item".
oh i think i got it. So if the invoice property discount is not nul then property discountable will never be false (except proration invoice items)
I'm not sure they're connected that way but basically if you want to know "is a discount currently applied", you look at discount (or discounts), not discountable.