Skip to content

Instantly share code, notes, and snippets.

View matthewarkin's full-sized avatar

Matthew Arkin matthewarkin

View GitHub Profile
@matthewarkin
matthewarkin / es.sh
Last active December 21, 2015 04:49
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.7.deb
sudo dpkg -i elasticsearch-0.90.7.deb
## CREATE THE INDEX WITH ANALYZERS AND MAPPINGS
curl -XPUT 'http://127.0.0.1:9200/eshtml/?pretty=1' -d '
{
"mappings" : {
"page" : {
"dynamic":false,
"properties" : {
"title" : {
"fields" : {
NSDictionary *achInfo = @{@"country":@"US", @"routing_number":rountingNumber, @"account_number":accountNumber};
NSDictionary *dataDictionary = @{@"bank_account[country]": @"US",
@"bank_account[routing_number]" : rountingNumber,
@"bank_account[account_number]" : accountNumber};
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<!-- The required Stripe lib -->
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
Stripe.api_key = 'Application's Owner Secret Key'
@token = Stripe::Token.create(
{:customer => CUSTOMER_ID, :card => CARD_ID},
ACCESS_TOKEN # user's access token from the Stripe Connect flow
)
@charge = Stripe::Charge.create(
{
:amount => 2000,
:currency => "usd",
//you see i console the all allParams in the create action. if i submit the form with empty value
//the comsole will be {username: '',email:'' .......}.i think if the value == '',this will directly return the badRequest to
//client. the problem is very strange.i did not write anything to stop the create.if the next() run, i should be run the User.create//(),right?because the form is empty, the User.create will throw the some error,like the username should not be empty.
//policy
module.exports = function(req, res, next) {
for(var value in req.allParams()){
if(value == ""){
console.log(value);
return res.badRequest('some input value is empty');
#Retrieve account details request - getting a "Invalid API Key provided: acct_************xxxx" error
curl https://api.stripe.com/v1/account \
-u [LIVE SECRET KEY]: \
-H Stripe-Account:[acct_xxxxxxxxxxxxxx] #the connected account ID
#Transfering $ to a connected account - getting a "Cannot transfer to an unconnected destination account." error
curl https://api.stripe.com/v1/transfers \
-u [LIVE SECRET KEY]: \
-d amount=xxxx \
Users.findOne({"id":user_id}).exec(function(err, user) {
stripe.customers.create({ //this saves the user to the platform account
source: tokenID,
email: user.email,
description: "Example customer"
}, function (err, customer) {
user.stripe_cust=customer.id;
//this attempts to create a token associated to the connected account id
stripe.tokens.create(
<?
include('library/init.php');
\Stripe\Stripe::setApiKey("sk_test_xxxxxxx");
$dp = \Stripe\Dispute::retrieve("dp_xxxxxxxxx");
$dp->evidence["customer_name"]="[email protected]";
$dp->evidence["shipping_date"] = "2016-03-06";
@matthewarkin
matthewarkin / .js
Last active July 4, 2016 06:23 — forked from farhan-syed/.js
stripe.charges.createRefund(
req.params.chargeId,
{refund_application_fee: true},
{stripe_account: req.params.stripeConnectedAccount},
function(err, refund) {
if (err) {
res.error(err);
console.log(err);
}