- Cards can be charged without being associated to a customer
- Transactions are now created via the funding instrument, not via the customer. E.g.
card.debit(amount)
,bank_account.credit(amount)
is now favoured overcustomer.debit(card, amount)
- Failing to create a transaction will result in a transaction being created with a
FAILED
state. E.g. debiting a card with insufficient funds will result in a transaction with aFAILED
state. These are filtered out of the API by default but can be specifically retrieved with a state filter e.g./credits?state=failed
- A new resource called "Orders" has been created to allow grouping transactions. An Order can consist of 0:n buyers, 0:n debits and 0:n credits to a single seller. Each debit associated with an Order will result in the Order's escrow balance accruing the value of the debit rather than the marketplace's escrow balance. You cannot pay out more than the total amount escrowed for an Order.
- Accounts no longer exist, customers and orders are the
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
module Balanced | |
class Invoice | |
include Balanced::Resource | |
end | |
end |
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
require 'balanced' | |
# create an api key and marketplace for example purposes only. | |
# in real-life you only do this once by the dashboard. | |
api_key = Balanced::ApiKey.new.save | |
Balanced.configure(api_key.secret) | |
marketplace = Balanced::Marketplace.new.save | |
# create a bank account. this is normally done with balanced.js |
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
import newrelic.agent | |
import time | |
import logging | |
logging.basicConfig() | |
logger = logging.getLogger('newrelic') | |
logger.setLevel(logging.DEBUG) | |
newrelic.agent.initialize('newrelic.ini', environment='staging') | |
newrelic.agent.register_application(timeout=10.0) |
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
rabbitmqadmin list queues | cut -d '|' -f 3 | grep -v \+ | xargs -n1 -I@ rabbitmqadmin purge queue name=@ |
curl https://api.balancedpayments.com/debits -XPOST -u ak-test-2yK59ihwoOOk0S6wsg77iMGzLGnGxiohB: -d "source[number]=4444444444444448" -d "source[expiration_month]=12" -d "source[expiration_year]=2016" -d amount=100
{
"errors": [
{
"status": "Payment Required",
"category_code": "card-declined",
"additional": "Account Frozen",
"status_code": 402,
curl http://api.balancedpayments.com/debits -XPOST -u ak-test-2DBryLFR3BBam1CipbWEGSO6gqVOBKghP: -d "source[number]=4111111111111111" -d "source[expiration_month]=12" -d "source[expiration_year]=2016" -d amount=100
{
"debits": [
{
"status": "succeeded",
"description": null,
"links": {
"customer": "CU6wJUpqcVWf2JwgyfIsRy1z",
curl 'http://127.0.0.1:8000/images' -H 'Origin: http://127.0.0.1:8000' -H 'Accept-Encoding: gzip,deflate,sdch' -H 'Host: 127.0.0.1:8000' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.69 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: http://127.0.0.1:8000/' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data-binary '{"name":"Balanced","src":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAAAQCAMAAADDNnYVAAAAmVBMVEVXWFpfYGJpaWtycnR7e32EhIaNjY+Wlpefn6CipA+mqB2oqKmxsbKztUS6uru8vV/AwW3Dw8TExXvFxnvJyojMzMzR0qPV1dXW1rHa2r7e3t7e38zj49nmpRLmqR/mrSzmrS3msTnnyonnzpfn1rLn27/n38zn49rn5+fox8Xo0tDqk43qnZjqqKTriIHrk43tU0ntXlTuPzMyENYEAAACeklEQVR42q2VC5PTIBDHIUCghquiRhQ9H3enx/k4td//w7nLApvUpDPO+J+W7oNkfyQLFQ+/T4+56d3Tw9UbMq0mmSn29BH8UO0Z
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
import balanced | |
class Invoice(balanced.Resource): | |
__metaclass__ = balanced.resources.resource_base(collection='invoices') | |
class Settlement(balanced.Resource): | |
__metaclass__ = balanced.resources.resource_base( | |
collection='settlements') |
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
import SimpleHTTPServer | |
import SocketServer | |
PORT = 8000 | |
class Server(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
headers = self.headers.dict | |
# curl http://127.0.0.1:8000 -u username:password |