Skip to content

Instantly share code, notes, and snippets.

@andyfleming
andyfleming / stripe_subscribe_custom_amount.parsley.html
Created November 28, 2016 01:24
Stripe Checkout Subscribe Dynamic Amount and Interval with Zesty
<form action="/-api/stripe/subscribe-custom" method="POST" id="subscribe">
<!-- used only on front-end as user input; gets converted and stored as hidden input "amount" -->
<input type="text" name="subscription_amount" value="5">
<!-- Hidden configuration: subscription interval. Can be "day", "week", "month", "year" -->
<input type="hidden" name="interval" value="month">
<!-- Hidden, automatically set amount (by jQuery below): -->
<input type="hidden" name="amount" value="500">
@andyfleming
andyfleming / stripe_checkout_subscription.parsley.html
Created November 27, 2016 04:32
Stripe Checkout Subscription with Zesty
<form action="/-api/stripe/subscribe" method="POST">
<!-- Plan to subscribe to -->
<!-- "value" must match plan ID in Stripe -->
<select name="plan_id">
<option value="plan1">Plan 1</option>
<option value="plan2">Plan 2</option>
<option value="plan3">Plan 3</option>
</select>
@andyfleming
andyfleming / stripe_checkout_donation.parsley.html
Last active November 27, 2016 02:49
Stripe Variable Donation with Stripe Checkout on Zesty
<form action="/-api/stripe/checkout" method="POST" id="donation-form">
<!-- Input field for user -->
<input type="number" name="donation_amount" value="5">
<!-- Values for Zesty -->
<input type="hidden" name="amount" value="500">
<input type="hidden" name="success_redirect" value="/thank-you-for-your-donation/">
<input type="hidden" name="failure_redirect" value="/an-error-occurred-with-your-donation/">
<input type="hidden" name="charge_description" value="Donation on example.com">
@andyfleming
andyfleming / stripe_checkout.parsley.html
Created November 27, 2016 02:00
Stripe Checkout with Zesty.io
<form action="/-api/stripe/checkout" method="POST">
<!-- Values for Zesty -->
<input type="hidden" name="amount" value="1199"><!-- should match data-amount below (in cents) -->
<input type="hidden" name="success_redirect" value="/thank-you/">
<input type="hidden" name="failure_redirect" value="/payment-error/">
<input type="hidden" name="charge_description" value="Purchase on example.com">
<!-- Stripe Checkout button settings -->
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
@andyfleming
andyfleming / example_user_api_call.js
Created November 17, 2016 12:58
Example front-end User API Call
jQuery.ajax({
url: '/-api/user/profile',
xhrFields: {
withCredentials: true
},
success: function(data, textStatus, jqXHR) {
console.log(data.data.first_name)
},
error: function(jqXHR, textStatus, errorThrown) {
if (jqXHR.status === 401) {
@andyfleming
andyfleming / keybase.md
Created September 15, 2015 23:48
keybase.md

Keybase proof

I hereby claim:

  • I am andyfleming on github.
  • I am andyfleming (https://keybase.io/andyfleming) on keybase.
  • I have a public key whose fingerprint is D8F4 24C2 9204 1997 FA2B CA0B ADBB 0505 BCD9 4FD6

To claim this, I am signing this object:

@andyfleming
andyfleming / DatabaseTestController.php
Created July 16, 2015 21:56
Facade-less Database Access in Lumen using dependency injection
<?php
namespace App\Http\Controllers;
use Illuminate\Database\DatabaseManager as DB;
class DatabaseTestController extends Controller
{
/**
@andyfleming
andyfleming / database.php
Created July 16, 2015 09:42
Database config for laravel/lumen
<?php
return [
'default' => 'accounts',
'connections' => [
'accounts' => [
'driver' => 'mysql',
<?php
namespace App\Http\Controllers;
use Illuminate\Database\DatabaseManager;
class StatsController extends Controller
{
/**
@andyfleming
andyfleming / DatabaseTestController.php
Created July 15, 2015 23:34
Facade-less Database Access in Lumen
<?php
namespace App\Http\Controllers;
use \Illuminate\Database\Connection;
class DatabaseTestController extends Controller
{
/**