Skip to content

Instantly share code, notes, and snippets.

boucher ~/Stripe/sinatra (master) $ rake test
no such file to load -- coffee-script: skipping coffee tests
no such file to load -- creole: skipping creole tests
no such file to load -- haml: skipping haml tests
no such file to load -- liquid: skipping liquid tests
no such file to load -- markaby: skipping markaby tests
no such file to load -- redcarpet: skipping markdown tests with Tilt::RedcarpetTemplate
no such file to load -- bluecloth: skipping markdown tests with Tilt::BlueClothTemplate
no such file to load -- kramdown: skipping markdown tests with Tilt::KramdownTemplate
no such file to load -- maruku: skipping markdown tests with Tilt::MarukuTemplate
@boucher
boucher / gist:1750375
Created February 6, 2012 07:09 — forked from siddarth/gist:1379745
Stripe PHP simple example
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@boucher
boucher / gist:1750368
Created February 6, 2012 07:07 — forked from saikat/gist:1084146
Stripe sample checkout form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">
@boucher
boucher / StripeTutorialPage.html
Created February 6, 2012 07:05
Stripe Tutorial Payment Form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
// this identifies your website in the createToken call below
@boucher
boucher / webhook-mailer.php
Created January 31, 2012 01:45
Stripe Webhook PHP Example
<?php
// SETUP:
// 1. Customize all the settings (stripe api key, email settings, email text)
// 2. Put this code somewhere where it's accessible by a URL on your server.
// 3. Add the URL of that location to the settings at https://manage.stripe.com/#account/webhooks
// 4. Have fun!
// set your secret key: remember to change this to your live secret key in production
// see your keys here https://manage.stripe.com/account
@boucher
boucher / StripeTutorialPage.html
Created November 23, 2011 15:31
Stripe Tutorial Payment Form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
<?php
require 'lib/Stripe.php';
if ($_POST) {
Stripe::setApiKey("kLh5gUyytoTLN8YtyBI7dLovXhZmDkcb");
$customer = Stripe_Customer::create(array("email" => $_POST['email'],
"description" => $_POST['description'],
"card" => $_POST['stripeToken']));
Stripe_Charge::create(array("amount" => 1199,
def pay(make_request=true)
return if @invoice.paid
@invoice.frozen_at ||= Time.stamp
roll_in_old_invoices
unless too_small? || @invoice.is_rollover?
log_ann("Invoice payer about to attempt payment for invoice: #{@invoice.token}")
@invoice.attempted_at = Time.stamp
if make_request
ch, paid = try_charge_request
else
@boucher
boucher / gist:1090506
Created July 18, 2011 20:02 — forked from saikat/gist:1084146
Stripe sample checkout form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="/jquery.min.js"></script>
<script type="text/javascript" src="/jquery.validate.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">
# ps1
if true; then
OFF="\[\033[0m\]"
BLACK="\[\033[0;30m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[0;32m\]"
YELLOW="\[\033[0;33m\]"
BLUE="\[\033[0;34m\]"
MAGENTA="\[\033[0;35m\]"
CYAN="\[\033[0;36m\]"