#captainfinfin_best-practices

1 messages ยท Page 1 of 1 (latest)

celest pawnBOT
#

๐Ÿ‘‹ 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/1351628289566834861

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

random rampart
#

Hello
Yes you should be able to use Subscription Update endpoint for this.
I'd recommend trying this out in test mode and see what the expected response is. This would also help you see if there are any side effects.

formal sluice
#

ok

#

is there an API to unlink customers from a specific coupon?

#

or do customer automatically get unlinked from coupon once they switch products?

random rampart
#

Coupons aren't directly associated with Customers. So I'm not sure what you mean by unlinking.. Can you elaborate?

formal sluice
#

currently we use this to pull the list of customers who have coupon A
stripe customers list --coupon "coupon_A"

random rampart
#

If so, you can call the Update Customers API again and set coupon: ''

#

to unset the parameter

formal sluice
#

i see. and if i want to keep other coupons, i should set coupon: 'other_coupons'?

random rampart
#

I don't believe coupon field allows multiple coupons

formal sluice
#

i know some customers have multiple coupons and we only want to remove coupon A

random rampart
#

Can you share an example request and response that you receive from the list API?

formal sluice
#

if this is not the suggested way, is there another way to get customers with coupon A?

random rampart
#

I think the API is just returning all of your customers

formal sluice
#

is there a way to get customers with this coupon?

#

i don't think it's returning all our customers. we have over 1000 customers in test

#

what it returns matches the test dashboard

random rampart
#

I believe that uses an internal API (dashboard only feature)

i don't think it's returning all our customers. we have over 1000 customers in test
what it returns matches the test dashboard
Interesting. I don't see the coupons in the discount param - I'd expect to see the coupon there

formal sluice
#

anyways let's go back to the original question. what do you suggest if we only want to unlink coupon A from customers and keep other coupons?

ancient sky
#

Hi taking over

#

what do you suggest if we only want to unlink coupon A from customers and keep other coupons? how do you set coupon currently? If setting at subscription level, you should just need to replace it with the new one on the Subscription object

formal sluice
#

this coupon only applies to product A, so it should be subscription level?

ancient sky
#

Yeah

#

If you replace it with the new one then the customer won't be linked to the old coupon

formal sluice
#

got it. that makes sense

#

@random rampart mentioned that the way i get customer list with coupon A is not supported. is there a suggested way to get customers with coupon A?

ancient sky
#

Not really. There's not a filter for subscriptions by coupon

formal sluice
#

that would be super slow in performance since we have a lot of customers

ancient sky
#

Yeah there's not a good way to do this at all really

#

Why do you have to though?

formal sluice
#

because we want to migrate all the customers who have coupon A and product A subscription to product B

ancient sky
#

And you don't keep track of this in your database?

#

Who's on what plan?

formal sluice
#

we are currently using the stripe dashboard to download the customer csv...

ancient sky
#

Going forward I recommend you store more in your database

#

Then check each of those to see if they have the coupon attached

formal sluice
#

product A has a lot of prices, more than 20. so does product B

#

but i guess the product concept in stripe is different?

ancient sky
#

There's not a better way really

formal sluice
#

i see

ancient sky
#

You can write a script to do all this. Will not be great performance-wise, but it's what you'll have to do if you don't keep any db records on this on your end

formal sluice
#

right. i guess we have to do this

#

just want to confirm, in stripe, one product has one price. when we update subscription price for an item, we are changing products, right?

ancient sky
#

One product can have multiple prices

#

When you change price on a subscription you can change to a different price within the same product too

#

So it's not necessarily a product change

formal sluice
#

but we need to change products

ancient sky
#

ok so switch the price to one on the other product

#

Recommend just trying this out in test mode

#

It'll make more sense

formal sluice
#

kk will do that

#

thanks!

celest pawnBOT