#samip_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/1397003614563733564
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
hello! just want to acknowledge your question - i'm wrapping up another thread but will get to you asap
Thanks, sure!
Just trying to keep the thread active ๐
To clarify, the customer has some subscriptions before (but now cancelled), which was discounted. Now you only have the customers and want to find the discount applied, correct?
Yes
I can find the customers by applying a filter , but the export does not include coupon code.
There are over 220 customers so rather than doing it manually, I was wondering if there is a way to find customers with discounts and also enlist their coupon code?
well howdy
@high bane hi, I will continue in your thread. Please gimme some time
I been waiting an hour more than this guy and your taking more people
tf
im being ignored
No I don't, but we will talk with multiple users in parallel. I haven't get back to them in a while too. Please come back to your thread
@wet basalt If you try List Subscription with status = cancel, then filter the Customer Id, could you somehow get the discounted coupon? Maybe by looking at the Subscription' discounts
Hi , I did try this way : https://dashboard.stripe.com/customers?coupon= <coupon_code>
This gives me the customer list which is exactly what I need but the export does not list coupon / discounts ?
So, I am wondering if there is any other way that I can use a coupon code and see what customers have an Active redemptions ? Probably via the API ?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yeah let's try to figure it out via API
First let's try the List Customers, and look at each Customer object in the list returned by the response, and check if you see the coupon there
Sweet, give me ~15 minutes to build this one out, I might reply to the thread to just keep it active.
Sure!
Okay discount: null, is sent in the response but I can see a discount /
Maybe my test data setup is wrong, here's the request ID req_dAkp0hgsVZ7oHB
For "can see a discount" where do you see it?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Okie, and you saw discount: null on the Customer object?
Yes
I tried with some other test data as well, I still get a discount null
I am using NodeJS SDK 18.2.1 .
await sourceStripe.customers.retrieve('<customer_id>')
Okie now can you take the Customer Id, and try this?
Just that Customer, to see if you see the discount on the Subscriptions in response
discounts: [],
Discounts is empty for some reason ๐ค
customer.data[0].items.discount is an empty array
This is for the subscription ?
Call List Subscription, with that Id
await sourceStripe.subscriptions.list({
customer: '<customer_id>',
});
Yes, with status = cancelled
Hmm, this subscription isn't cancelled
The list I am looking for can have both cancelled and active accounts.
Okie okie
It is fine if I can just get the customers and their adjacent discount codes. I can create an export of my own
But, I am not finding anything in the API ?
Yes I am afraid the data is deep under the Subscription object of each Customer.
So likely you would need to loop over the Customers, and list Subscriptions on each of them. That requires some logic
So, enlist the customers then list their adjacent subscription ?
Yes
Sorry, where in the subscription object is it ?
I tried pulling an individual subscription
but I cannot see any discounts
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Hmm alright looking closer into this one
Can you call a Retrieve Subscription API (not Dashboard) and share with me the response JSON on this Sub Id?
Ah the promotion code was applied to the first Invoice of this Subscription, not the Subscription itself
Um sorry this is a bit too deep to use API. Basically you need to List the Invoice belongs to a Subscirption, then list Subscription belongs to a Customer, on a list of Customer
Going back to the Dashboard a bit, You can filter the customer has discounts here, then start finding out which discount, coupon from the Id with the chain above
Ah, that's going to be a lot of work unfortunately