(self, coupon, idempotency_key=None)
return self.__class__.sync_from_stripe_data(stripe_customer)
Add a coupon to a Customer.

        The coupon can be a Coupon object, or a valid Stripe Coupon ID.
Add a coupon to a Customer.
Add a coupon to a Customer .
def add_coupon(self, coupon, idempotency_key=None):
        """
        Add a coupon to a Customer.

        The coupon can be a Coupon object, or a valid Stripe Coupon ID.
        """
        if isinstance(coupon, StripeModel):
            coupon = coupon.id

        stripe_customer = self.api_retrieve()
        stripe_customer["coupon"] = coupon
        stripe_customer.save(idempotency_key=idempotency_key)
        return self.__class__.sync_from_stripe_data(stripe_customer)
def add_coupon ( self , coupon , idempotency_key = None ) : if isinstance ( coupon , StripeModel ) : coupon = coupon . id stripe_customer = self . api_retrieve ( ) stripe_customer [ "coupon" ] = coupon stripe_customer . save ( idempotency_key = idempotency_key ) return self . __class__ . sync_from_stripe_data ( stripe_customer )