Created
March 2, 2015 15:33
Star
You must be signed in to star a gist
Elect a payment method on account to be the 'default' payment method recruited by that account's subscriptions
This file contains 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
BillForward.Account.getByID('ACC-81674A80-3B2D-4327-8C24-994720BA') | |
.then(function(account) { | |
// you might want to take a peek at the account | |
// console.log(account.toString()); | |
// get relevant payment method: | |
var paymentMethod =_.findWhere(account.paymentMethods, {'gateway': 'stripe'}); | |
// the SDK seems to have an unserialization problem; we need to manually tell JavaScript that this JSON is a BillForward.PaymentMethod: | |
_paymentMethod = new BillForward.PaymentMethod(paymentMethod); | |
// set as default payment method | |
_paymentMethod.defaultPaymentMethod = true; | |
// PUT changes to API | |
return _paymentMethod.save(); | |
}) | |
.done(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment