Created
March 4, 2015 16:39
-
-
Save billforward-alex/0cee8034839cc4295eab to your computer and use it in GitHub Desktop.
Get Default Payment Method
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
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, {'defaultPaymentMethod': true}); | |
if (paymentMethod === undefined) throw new Error("No default payment method found for this account. Of course it is still possible that this account can pay via credit or 'offline payments'."); | |
// the SDK seems to have an unserialization problem; we need to manually tell JavaScript that this JSON is a BillForward.PaymentMethod: | |
var _paymentMethod = new BillForward.PaymentMethod(paymentMethod); | |
}) | |
.done(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment