I am using balanced payments to allow users to purchase services on my site. When users are ready to checkout, they login/create an account on my site, then enter their credit card information. The card is charged and they are on their way.
As I mentioned above, my site offers a service so I charge their card every month automatically via a cronjob. I simply use the following one liner to grab the buyer:
buyer = balanced.Account.query.filter(email_address = emailAddress)[0]
Simple enough. However, credit cards are lost, they expire, users want to use a different credit card, etc. How do I go about allowing a user to edit their credit card or provide a new one? Do I simply create a separate page that allows them to enter their new credit card information via:
buyer = balanced.Marketplace.my_marketplace.create_buyer(emailAddress, card_uri = cardURI)
Finally, how does balanced decide which chard to use? How do I let users manage which credit card they would like to use? Do I simply store the card_uri and let them select which card URI to use?
If you look at the source for the balanced-python library you can get hints about what parameters to use. I appreciate it may be a bit confusing for first-timers so thanks for asking a question.
Adding a card to an existing account:
Charging a specific card:
Displaying cards for a user
Here’s a complete example which may help: