Search code examples
paymentbalanced-payments

Balanced - Set card as default funding source


I have a buyer account with several, valid cards associated with it. According to Balanced's documentation the most recently added card is the default funding source. How do I set another, existing card as the default funding source without asking the user to resubmit their card details to create a new card?


Solution

  • You cannot currently set an alternate funding source, the most recently added card is always the default. To debit or credit a specific funding instrument such as a card or bank account you must pass through the URI of the object as the parameter funding_source or funding_destination respectively:

    buyer = balanced.Account.find(uri_of_account)
    card = buyer.cards[x]
    debit = buyer.debit(amount_in_cents, source_uri=card.uri)
    
    merchant = balanced.Account.find(uri_of_account)
    bank_account = merchant.bank_accounts[0]
    credit = merchant.credit(amount_in_cents, destination_uri=bank_account.uri)