Skip to content

Instantly share code, notes, and snippets.

> curl https://api.stripe.com/v1/customers \
-u [apikey]: \
-d "card[number]=4000000000000002" \
-d "card[exp_month]=12" \
-d "card[exp_year]=2015" \
-d "card[cvc]=123" \
> -d validate=false
{
"object": "customer",
"created": 1388967139,
var key = 'pk_test_czwzkTp2tactuLOEOqbMTRzG';
var params = {
'card[number]': '4242 4242 4242 4242',
'card[exp_month]': '01',
'card[exp_year]': '2050'
};
$.ajax({
url: 'https://api.stripe.com/v1/tokens',
method: 'POST',
API_KEY = 'SECRET_API_KEY'
CSV_FILE = 'refunds.csv'
require 'stripe'
require 'CSV'
Stripe.api_key = API_KEY
# Retrieves all refund events from Stripe, handling pagination
def all_refund_events(count=50, offset=0)
<?php
require __DIR__ . '/lib/Stripe.php';
if ($_POST) {
Stripe::setApiKey("sk_test_OXXXXXXXXXXXXXXXXXXX9");
try {
// Use Stripe's bindings...
} catch(Stripe_CardError $e) {
// Since it's a decline, Stripe_CardError will be caught
$body = $e->getJsonBody();
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Payment Form</title>
<link rel="stylesheet" type="text/css" href="https://fxsupport.org/consolidated_common.css" />
<link rel="stylesheet" type="text/css" href="https://fxsupport.org/css/reset-fonts-grids.css" />
<link href='https://fonts.googleapis.com/css?family=Fjalla+One' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
@michaelschade
michaelschade / gist:2847749
Created June 1, 2012 01:04 — forked from boucher/gist:1750375
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");
@michaelschade
michaelschade / gist:2630185
Created May 7, 2012 20:27 — forked from boucher/gist:1750375
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");
import Control.Monad ( liftM )
import Web.JonathansCard ( latest )
main :: IO ()
main = putStrLn . show =<< latest
{- Outputs:
Right (Balance {balAmount = 28.08, balBalanceId = 25573, balCreated = Just
2011-08-08 00:56:03 UTC, balMessage = "My balance is $28.08 as of Aug 7th at
@michaelschade
michaelschade / Skeleton.hs
Created May 20, 2011 21:15
Skeleton in use: skeletonBase
skeletonBase :: String -> String -> Html -> AttributeValue -> AttributeValue
-> Html -> Html
skeletonBase cssDir iconDir title desc author content = do
docType
htmlTag
htmlBody $ do
-- ...
@michaelschade
michaelschade / Skeleton.hs
Created May 20, 2011 21:14
Skeleton htmlTag function
-- | Special set of conditionals for the HTML tag to make Skeleton compatible
-- with all browsers.
htmlTag :: Html
htmlTag = do
comment "lt IE 7" $ htmlEn ! class_ "ie ie6"
comment "IE 7" $ htmlEn ! class_ "ie ie7"
comment "IE 8" $ htmlEn ! class_ "ie ie8"
comment "(gte IE 9)|!(IE)" $ htmlEn
where htmlEn = html' ! lang "en" $ ""