Created
May 6, 2015 23:54
-
-
Save ckuwanoe/dc10c9f053205ba94fdc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update_card(subscription_params) | |
customer = Stripe::Customer.retrieve(self.stripe_customer_token) | |
card = customer.sources.create(source: subscription_params[:stripe_card_token]) | |
card.save | |
customer.default_source = card.id | |
customer.save | |
rescue Stripe::InvalidRequestError => e | |
logger.error "Stripe error while updating card info: #{e.message}" | |
errors.add :base, "#{e.message}" | |
false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment