#darkon7446
1 messages · Page 1 of 1 (latest)
whit this api $stripe->coupons->all(['limit' => 3]); there is a field reedem_by
but it's null
reedem_by is this, which has nothing to do with customer: https://stripe.com/docs/api/coupons/object?lang=node#coupon_object-redeem_by
If you have a Discount object, you can find which customer consumed it: https://stripe.com/docs/api/discounts/object?lang=node
But there's no way to list all Discount objects.
so there is not solution?
Give me a few minutes to look into this.
ok thanks
I guess the best you can do is list all the customers and filter out on your side the ones that have the specified discount: https://stripe.com/docs/api/customers/object#customer_object-discount
I don't know how many Customers you have, so it might not be feasible if there's too many
ok, in this moment they are not so much so i can use this. Hope in the future they will create an api that has a promocode as input and return all customers. Thank you.
there is a problem, i listed all customers that have a promo active, but discount field is empty :/
What do you mean by "customers that have a promo active" exactly? Is it on the Customer object or on Subscription?
sorry, i listed all my customers and the ones with a promo actived has discount field empty
they have a subscription
Could you please share one example ID? I think the Coupon might be applied to the Subscription object and not to the Customer.
In short, if the discount/coupon is applied when you create a Subscription, you will find it on the Subscription object and not on the Customer object.
You could expand the customer field on the Subscriptions. But that would result in more latency as you would need to get the Customers even for the Subscriptions that don't have the required Coupon. So yeah, your latest solution is the best in this case.