Skip to content

Instantly share code, notes, and snippets.

View matthewarkin's full-sized avatar

Matthew Arkin matthewarkin

View GitHub Profile
<form class="new_ticket" id="new_ticket" action="/tickets" accept-charset="UTF-8" method="post">
<input name="utf8" type="hidden" value="&#x2713;" />
<fieldset class="form-group">
<label for="ticket_name">Name</label>
<input placeholder="What&#39;s your name" class="form-control input-short" required="required" type="text" name="ticket[name]" id="ticket_name" />
</fieldset>
<fieldset class="form-group">
<label for="ticket_email">Email</label>
<input placeholder="Where can we email you?" class="form-control input-short" required="required" type="email" name="ticket[email]" id="ticket_email" />
@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);
}
<?
include('library/init.php');
\Stripe\Stripe::setApiKey("sk_test_xxxxxxx");
$dp = \Stripe\Dispute::retrieve("dp_xxxxxxxxx");
$dp->evidence["customer_name"]="email@example.com";
$dp->evidence["shipping_date"] = "2016-03-06";
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(
#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 \
//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');
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",
<!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 -->
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};
## 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" : {