#captainfinfin_best-practices
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/1351628289566834861
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
ok
is there an API to unlink customers from a specific coupon?
or do customer automatically get unlinked from coupon once they switch products?
Coupons aren't directly associated with Customers. So I'm not sure what you mean by unlinking.. Can you elaborate?
currently we use this to pull the list of customers who have coupon A
stripe customers list --coupon "coupon_A"
Ah
Have you manually applied coupons to customers by using the coupon param in create/update Customers API? https://docs.stripe.com/api/customers/update#update_customer-coupon
If so, you can call the Update Customers API again and set coupon: ''
to unset the parameter
i see. and if i want to keep other coupons, i should set coupon: 'other_coupons'?
I don't believe coupon field allows multiple coupons
i know some customers have multiple coupons and we only want to remove coupon A
I'm surprised that the list API works with coupon param given it's not a supported parameter - https://docs.stripe.com/api/customers/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Can you share an example request and response that you receive from the list API?
here is what i received from test
if this is not the suggested way, is there another way to get customers with coupon A?
I think the API is just returning all of your customers
hmm then how does stripe build this dashaboard? https://dashboard.stripe.com/customers?coupon=Advanced_Analytics
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
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
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 thediscountparam - I'd expect to see the coupon there
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?
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
this coupon only applies to product A, so it should be subscription level?
Yeah
If you replace it with the new one then the customer won't be linked to the old coupon
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?
Not really. There's not a filter for subscriptions by coupon
You'd have to manually list them and look at each individual one: https://docs.stripe.com/api/subscriptions/list
that would be super slow in performance since we have a lot of customers
because we want to migrate all the customers who have coupon A and product A subscription to product B
we are currently using the stripe dashboard to download the customer csv...
Going forward I recommend you store more in your database
But you can list subscriptions by price A: https://docs.stripe.com/api/subscriptions/list#list_subscriptions-price
Then check each of those to see if they have the coupon attached
product A has a lot of prices, more than 20. so does product B
but i guess the product concept in stripe is different?
There's not a better way really
i see
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
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?
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
but we need to change products
ok so switch the price to one on the other product
Recommend just trying this out in test mode
It'll make more sense