#mtanzi-bulk-coupon-delete

1 messages · Page 1 of 1 (latest)

desert quail
#

Hi there 👋 no, there is not a way to take bulk actions on those types of objects.

glass lintel
#

oh thanks.. so the only way is to fetch the list and then iterate and call the delete API call?

desert quail
#

Exactly

glass lintel
#

thank you!

#

is there a way to retrieve the coupon passing the name?
Basically my problem is that I am writing a migration screipt to port the coupon from chargebee into stripe and I want to make sure they don't get duplicated if the script need to be run multiple time

#

my idea was :

  • iterate over all the coupon in chargebee
  • check if the coupon exist in stripe (checking the name)
  • if present delete it
  • create the new coupon
#

what's the best way you would recommend for point 2?

desert quail
#

Hm, that is a bit tricky since we don't have a name filter when listing coupons.

#

In your position I'd probably list/export the coupons from both systems, and then write a script to compare the lists looking for and noting the differences. Then I'd only take action on the differences.

glass lintel
#

that an intensive operation, would be an iteration over all the coupon for both Stripe and Chargebee... ok I see...
Let me think whether there is a workaround

#

thanks