#dragonlord_api

1 messages · Page 1 of 1 (latest)

tardy larkBOT
#

👋 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/1354847352141254786

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

civic wigeon
#

Hi 👋

What do you mean by "customer discount"? Stripe models discounts through Coupons and Promo Codes.

short quarry
#

Sorry for the delay in my response back

#

I mean you can add a global discount for a customer, we would not want this global coupon to be applied to one of the subscriptions the user has

#

We have a subscription in which we want no coupons to be applied to it even global coupons

civic wigeon
#

That is something you would need to manage in your integration

#

That isn't something you can configure Stripe to handle

#

You can apply a promotion_code to a Customer object

short quarry
#

we have a customer who has 30 percent off, we do not want that coupon to be applied to a subscription

#

but we can't remove it since it was applied on the customer level

civic wigeon
#

Promotion codes are built from Coupons

#

And you can specify which products a Coupon applies to using the parameter

#

so you could exclude the Product/Price in that Subscription

#

but you would need to specify all other products

short quarry
#

but the coupon was already created

#

Can I modify a certain coupon?

civic wigeon
#

What happens if you update the Subscription and specify empty strings for the coupon, discount, and promotion_code properties in the discounts parameter

short quarry
#

I will test one second

#

You passed an empty string for 'discounts[0][discount]'. We assume empty values are an attempt to unset a parameter; however 'discounts[0][discount]' cannot be unset. You should remove 'discounts[0][discount]' from your request or supply a non-empty value.

#

I get this error

civic wigeon
short quarry
#

even if I pass an empty array 'discounts' => [],

it still applies the coupon

#

req_4K2tCCczd3NNeT

here is the request id

civic wigeon
#

Yeah that matches what our docs say here:

If not specified or empty, inherits the discount from the subscription’s customer.

I just wanted to see if you could unset specific properties

#

Wait no

short quarry
#

But specify it as empty

civic wigeon
#

I meant as an update, after you create the Subscription

short quarry
#

which is why I am confused why it paplies

civic wigeon
#

Can you test that IN TEST MODE

#

which is why I am confused why it paplies

This is what our docs say, which I shared above

short quarry
#

Intresting I can test in production it's my account so issue playing around with that

civic wigeon
#

Testing in Live mode violates Stripe's terms of service

short quarry
#

oh intresting okay will test in test mode

#

did not know that sorry

tardy larkBOT
short quarry
#

It still applies the coupon after updating the subscription with an empty array

$stripe->subscriptions->update(
'my_sub_id',
['discounts' => [],]
);

#

reauest_id: req_P6aGlWgkhF2Ahm

quick harness
#

Hi hi! I’m going to be taking over for my colleague here. Give me a minute to read back and understand things.

short quarry
#

i only passed a blank discounts array

quick harness
#

Sweet.

short quarry
#

but it is not working as expected it still applies the customer coupon to the subscription

quick harness
#

Do you mean it doesn't remove the discount from the subscription?

short quarry
#

yes

#

it does not remove the discount from the subscription

tardy larkBOT
grave gorge
#

Hey @short quarry apologies for the delay, are you still looking into this? I think the way to unset this may be to set the discounts array t an empty string. Will try to test to confirm in a minute

short quarry
#

I tried that it still did not work

grave gorge
#

Can you send me the request ID for that? req_1234

tardy larkBOT
grave gorge
#

Checking with my colleagues on this as well. Having trouble testing myself

short quarry
#

req_uBy4H9yI5vsfnn

grave gorge
#

Ah, sorry I read through the thread too fast. So as far as I can see, this is expected behavior at the moment for the customer's discount to apply to the subscription and I'm not seeing a way to prevent that in the API. I can put in a feature request but can't promise if/when it will be added. In the meantime, I think the workaround would be to unset the Customer's discounts, create the subscription, and re-apply the coupon to the customer. I understand that that is cumbersome, but I don't think there is a better way with our API's current abilities.