2

I can't find any way to apply the coupon/discount to an existing customer who has a reoccurring payment. I'm using the stripe gem. I went ahead and created the coupon on the Stripe dashboard. I see no mention on how to add a coupon on their API page. I've tried this solution below but to no avail.

cu = Stripe::Customer.retrieve("cus_XXX")

cu.discount = "my_coupon_id"

cu.save

# returns Stripe::InvalidRequestError: (Status 400) Received unknown parameter: discount

There must be some sort of method I'm missing. What am I missing to fix this.

koopajah
  • 23,792
  • 9
  • 78
  • 104
thank_you
  • 11,001
  • 19
  • 101
  • 185

1 Answers1

3

You need to use the coupon parameter along with the Update Customer API so in Ruby that would be something like this:

cu = Stripe::Customer.retrieve("cus_XXX")
cu.coupon = "my_coupon_id"
cu.save
koopajah
  • 23,792
  • 9
  • 78
  • 104