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' | |
host = ENV.fetch('BALANCED_HOST') { nil } | |
options = {} | |
if host | |
options[:scheme] = 'http' | |
options[:host] = host | |
options[:port] = 5000 | |
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
def merchant | |
after_redirection = "#{root_url}balanced/success" | |
current_user = User.find(session[:user_id]) | |
begin | |
existing=Balanced::Account.find_by_email(current_user.email) | |
if existing.nil? | |
@market = marketplace_creation | |
marketplace = @market | |
bank_account = marketplace.create_bank_account( | |
:account_number => params[:account_number], |
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' | |
# PUT your old API key here | |
Balanced.configure('') | |
new_key = Balanced::ApiKey.new().save() | |
Balanced::ApiKey.find('/v1/api_keys/AK6f4Ue2NQDW0YhiBgBSQvLE').destroy() | |
# this is your new key. |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>My HTML File</title> | |
<link rel="stylesheet" | |
href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css"> | |
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | |
<script src="https://raw.github.com/wycats/handlebars.js/1.0.0-rc.3/dist/handlebars.js"></script> | |
<script src="https://raw.github.com/emberjs/ember.js/release-builds/ember-1.0.0-rc.1.js"></script> |
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
cwd = File.dirname(File.dirname(File.absolute_path(__FILE__))) | |
$:.unshift(cwd + "/lib") | |
require 'balanced' | |
api_key = Balanced::ApiKey.new.save | |
secret = api_key.secret | |
Balanced.configure(secret) | |
marketplace = Balanced::Marketplace.new.save |
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
# your meta field should include something like: | |
meta = { | |
on_behalf_of: { | |
'/v1/accounts/1': 50, # account 1's cut of the debit | |
'/v1/accounts/2': 100, # account 2's cut of the debit | |
} | |
} |
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
#!/usr/bin/env python | |
from __future__ import unicode_literals | |
import pymongo | |
import threading | |
DB_NAME = 'events' | |
COLLECTION_NAME = 'events' | |
class Subscriber(threading.Thread): |
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
curl -X POST https://api.balancedpayments.com/v1/marketplaces/TEST-MP6IEymJ6ynwnSoqJQnUTacN/accounts \ | |
-u 7b7a51ccb10c11e19c0a026ba7e239a9: | |
curl -X PUT https://api.balancedpayments.com/v1/marketplaces/TEST-MP6IEymJ6ynwnSoqJQnUTacN/accounts/AC2hJSp3FgpVlAe976Lc3txR \ | |
-u 7b7a51ccb10c11e19c0a026ba7e239a9: -d card[card_number]="5105105105105100" -d card[expiration_month]="12" -d card[expiration_year]=2020 | |
curl https://api.balancedpayments.com/v1/marketplaces/TEST-MP6IEymJ6ynwnSoqJQnUTacN/accounts/AC2hJSp3FgpVlAe976Lc3txR/cards \ | |
-u 7b7a51ccb10c11e19c0a026ba7e239a9: |
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
# create a bank account | |
curl -X POST https://api.balancedpayments.com/v1/marketplaces/TEST-MP6IEymJ6ynwnSoqJQnUTacN/bank_accounts \ | |
-u 7b7a51ccb10c11e19c0a026ba7e239a9: \ | |
-d name="WHC III Checking" \ | |
-d account_number="12341234" \ | |
-d routing_number="321174851" | |
# create an account | |
curl -X POST https://api.balancedpayments.com/v1/marketplaces/TEST-MP6IEymJ6ynwnSoqJQnUTacN/accounts \ | |
-u 7b7a51ccb10c11e19c0a026ba7e239a9: |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Tokenize Bank Account Form - Balanced</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<!-- Le styles --> | |
<link href="https://twitter.github.com/bootstrap/assets/css/bootstrap.css" | |
rel="stylesheet"> |