Skip to content

Instantly share code, notes, and snippets.

View adamjstevenson's full-sized avatar
🏄‍♂️

Adam Stevenson adamjstevenson

🏄‍♂️
View GitHub Profile
@adamjstevenson
adamjstevenson / Vagrantfile
Last active December 15, 2017 13:06
Vagrant File
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
@adamjstevenson
adamjstevenson / bootstrap.sh
Created December 27, 2015 21:01
A simple PHP/MySQL/phpMyAdmin Vagrant provisioner
#!/usr/bin/env bash
# Use single quotes instead of double quotes to make it work with special-character passwords
PASSWORD='my_password'
# update / upgrade
sudo apt-get update
sudo apt-get -y upgrade
# install apache 2.5 and php 5.5
require 'stripe'
Stripe.api_key = "sk_your_API_key"
customers = Stripe::Customer.all(:limit => 100)
customers.each do |customer|
# do a thing with the customer
end
@adamjstevenson
adamjstevenson / stripe_js_bootstrap.html
Last active April 15, 2020 07:56
Stripe.js bootstrap example -- simple
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Stripe.js example form</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h1>A simple Bootstrap Stripe.js payment form</h1>
@adamjstevenson
adamjstevenson / bootstrap_stripejs_better.html
Created May 26, 2016 20:40
Better Bootstrap Stripe.js form
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Stripe.js example form</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h1>A better Bootstrap Stripe.js payment form</h1>
@adamjstevenson
adamjstevenson / bootstrap_stripejs_bank.html
Created June 2, 2016 16:44
Stripe.js Bootstrap bank account form
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Stripe.js example bank account form</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h1>A Bootstrap Stripe.js bank account form</h1>
@adamjstevenson
adamjstevenson / managed_account_identity_verification_webhook.rb
Last active December 15, 2017 13:04
Handling Identity Verification Notifications
require 'sinatra'
require 'stripe'
require 'mailgun'
set :secret_key, ENV['STRIPE_KEY']
Stripe.api_key = settings.secret_key
set :mailgun_key, ENV['MAILGUN_KEY']
mg_client = Mailgun::Client.new settings.mailgun_key
@adamjstevenson
adamjstevenson / paginate.js
Created July 14, 2016 15:00
[Node] Paginate charges
var stripe = require('stripe')('YOUR_TEST_KEY');
stripe.charges.list(
{ limit: 100, include: ["total_count"] },
function(err, charges) {
for (i = 0; i < charges.data.length; i++){
console.log(charges.data[i].id);
}
if (charges.has_more) {
paginate(charges["data"][charges["data"].length - 1].id);
@adamjstevenson
adamjstevenson / cancel_sub_test_simple.php
Last active August 5, 2016 22:13
Simple Stripe subscription cancel test
<?php
// Require the Stripe library and set your API key
// Newer versions can use https://stripe.com/docs/api/php#cancel_subscription
try {
$token = \Stripe\Token::create(array(
"card" => array(
"number" => "4242424242424242",
"exp_month" => "12",
"exp_year" => "2020"
@adamjstevenson
adamjstevenson / create_account.php
Last active August 27, 2016 20:46
Basic Stripe managed account creation with PHP
<?php
// Not using composer
require_once('stripe-php/init.php');
\Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
try {
$account = \Stripe\Account::create(array(
"managed" => true,
"country" => "US",
"email" => "[email protected]",