Created
October 20, 2013 18:08
-
-
Save cdeutsch/7073149 to your computer and use it in GitHub Desktop.
Expand Stripe default_card
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
| var client = new StripeClient(SiteSettings.StripeApiKey); | |
| dynamic response = client.RetrieveCustomer(user.CustomerIdentifier); | |
| if (response.IsError) | |
| { | |
| this.FlashError((string)response.error.message); | |
| } | |
| else | |
| { | |
| // expand default_card | |
| var active_card = (from cc in (List<dynamic>)response.cards.data | |
| where cc.id == response.default_card | |
| select cc).Single(); | |
| model.ActiveCardNumber = active_card.last4; | |
| model.ActiveCardType = active_card.type; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment