#manatee_api

1 messages · Page 1 of 1 (latest)

carmine hedgeBOT
#

👋 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.

proven vault
carmine hedgeBOT
sharp escarp
#

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

fiery dome
#

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?

sharp escarp
#

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

fiery dome
#

Yes, that sounds right. Is it not working as expected?

fiery dome
#

Are you with me?

sharp escarp
#

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

fiery dome
carmine hedgeBOT
sharp escarp
#

ye let me try to get log for this request

#

req_QeTM9IOTaTeQbx can You see that request ?

craggy crow
#

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?

sharp escarp
#

ok, let me use postman and copy the response for You give me a few mins please

craggy crow
#

yes sure

sharp escarp
craggy crow
#

the amount is 0 though

#

what's the issue then?

sharp escarp
#

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

craggy crow
#

the discount you applied is on the subscription level

#

and even if the discount is not applied

#

the discount_amount will be calculated regardless

sharp escarp
#

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)

craggy crow
#

since the discount amount is 0 this means that no discount will be applied after the subscription update

sharp escarp
#

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 ?

craggy crow
#

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?

sharp escarp
#

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.

craggy crow
#

it's not always the case

#

if the discount applies to the product it will be used to calculate the new price proration

sharp escarp
#

"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)

carmine hedgeBOT
gentle epoch
sharp escarp
#

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

gentle epoch
#

that's expected yes, proration is not discountable because it's already inclusive of discounts

sharp escarp
#

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

gentle epoch
gentle epoch
# sharp escarp

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.

sharp escarp
#

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

gentle epoch
#

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_xxxx from 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. If discount or discounts is 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.

sharp escarp
#

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

gentle epoch
sharp escarp
#

i will give me a few minutes to create request

sharp escarp
# gentle epoch > I've requested for upcoming invoice with the subscription_items.price to be ch...

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

gentle epoch
#

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.

sharp escarp
#

Yes indeed. So there is no way to get information if the coupon will apply for the future payment circle in this request ?

gentle epoch
#

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.

sharp escarp
#

You right, that can be helpfull but, it shows Discount_amounts still even with amount: 0 and also the property discountable is true

gentle epoch
#

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).

sharp escarp
#

no no, discountable to me means, for this invoice item discount was use / will be used (depends it is incoming invoice or old one)

gentle epoch
#

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-null discount field on the item

sharp escarp
gentle epoch
#

yes

#

by "will apply" it means, "if you apply a coupon to the Invoice, will they apply to this item".

sharp escarp
#

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)

gentle epoch
#

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.