Skip to content

Instantly share code, notes, and snippets.

View mjallday's full-sized avatar
🏠
WFH

Marshall Jones mjallday

🏠
WFH
View GitHub Profile
@mjallday
mjallday / README.mkd
Created October 8, 2013 21:21
HANGMAN

Make a client

curl http://balanced-hangman.herokuapp.com

Hopefully you'll see something like

{
 "index": "/", 
 "me": "/me", 
@mjallday
mjallday / go.mkd
Created October 1, 2013 16:33
New API Example

Create an API key

curl https://api-pm.balancedpayments.com/api_keys -XPOST -H "Accept: application/vnd.api+json;version=1.1"

Will return a response with a secret param

{
  "links": {},
  "api_keys": [
{
"errors": [
{
"status": "Conflict",
"category_code": "account-insufficient-funds",
"additional": null,
"status_code": 409,
"category_type": "logical",
"extras": {},
"request_id": "OHM410b5c281cba11e3a9c510ddb1bbaf41",
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
@mjallday
mjallday / balanced.rb
Last active December 18, 2015 10:10
Trigger KYC redirect
require 'balanced'
Balanced.configure(nil)
api_key = Balanced::ApiKey.new.save
secret = api_key.secret
Balanced.configure(secret)
marketplace = Balanced::Marketplace.new.save
module Balanced
class Customer
include Balanced::Resource
end
end
@mjallday
mjallday / xx.js
Created May 15, 2013 21:10
handle both bank accounts and cards in callback
function responseCallbackHandler(response) {
switch (response.status) {
case 400:
// missing or invalid field - check response.error for details
console.log(response.error);
break;
case 404:
// your marketplace URI is incorrect
console.log(response.error);
@mjallday
mjallday / analytics.js
Created May 6, 2013 20:01
The API we used for analytics in the old Balanced dashboard.
Balanced.Analytics = (function () {
var myTracker;
var googleQueue;
var TRACK_EVENT = '_trackEvent';
var init = 0;
if (window['_gat'] !== undefined) {
myTracker = _gat._getTrackerByName();
} else {
myTracker = null;
}
@mjallday
mjallday / readme.mkd
Created March 22, 2013 17:40
Change API Key

first, get your old API key secret go to www.balancedpayments.com/dashboard and click on the Settings page

now, let's generate a new API key secret

curl -u API_KEY_SECRET: https://api.balancedpayments.com/v1/api_keys -X POST

you should get a response like this:

{

"secret": "10a7a762931711e28edb026ba7cac9da",

@mjallday
mjallday / meta.php
Created March 14, 2013 23:08
Balanced PHP client meta filtering example
<?php
require('vendor/autoload.php');
Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();
use Balanced\Debit;
use Balanced\Credit;