问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/27662394/how-to-apply-a-coupon-to-a-stripe-customer