Skip to content

Instantly share code, notes, and snippets.

<?php
error_reporting(0);
ini_set('display_errors',0);
ini_set('max_execution_time', 1800);
require_once(ROOTPATH . '/lib/Stripe.php');
Stripe::setApiKey("your_test_secret_key_here");
$customer_ids = array('cus_4Gyfqsj4bqxFXl', 'cus_4EkyGLHNkZhTNS', 'cus_4Ejjhhw2HwNUhS');
foreach($customer_ids as $id) {
// The following would create a customer, subscribe them to your penny plan, and cost $1.00/month.
$customer = Stripe_Customer::create(array(
"card" => $token,
"email" => $email_to,
"description" => $planId.": ".$somiiPlan." plan.",
"plan" => "penny_plan",
"quantity" => 100)
);
Captain.TicketsShowRoute = Ember.Route.extend
model: (params) ->
@store.find('ticket', params['ticket_id'])
setupController: (controller, model) ->
controller.set('model', model)
controller.set('queues', @store.all('queue'))
renderTemplate: ->
@render 'tickets/show'
Captain.Ticket = DS.Model.extend
@andrewpthorp
andrewpthorp / shared_customer.rb
Created January 30, 2014 04:12
Shared Customer Example
# Setup your api key
Stripe.api_key = "sk_your_secret_key"
# assuming token is the result of creating a credit card token
# and plan_id is something you have set elsewhere
# create the customer on the application owners account,
# notice, no ACCESS_TOKEN
customer = Stripe::Customer.create({
card: token.id,
private static String className(Class<?> clazz) {
String className = clazz.getSimpleName().toLowerCase().replace("$", " ");
// TODO: Delurk this, with invoiceitem being a valid url, we can't get too
// fancy yet.
if (className.equals("applicationfee")) {
return "application_fee";
} else {
return className;
}
@andrewpthorp
andrewpthorp / billing_address_custom_checkout.js
Created January 16, 2014 17:44
Billing Address in Custom Checkout
function token(token, args){
// You have access to the following:
// args.billing_address_line1
// args.billing_address_city
// args.billing_address_state
// args.billing_address_zip
// args.billing_address_country
}
@andrewpthorp
andrewpthorp / babette.html
Created January 16, 2014 16:31
Babette Sample
<html>
<body>
<form action="/paypal/purchase_stripe.php" method="post">
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_YhIozHG3kvG8j0BOkMpvaqtF"
data-amount="99"
data-name="BakeSpace Cookbook"
data-currency="USD"
@andrewpthorp
andrewpthorp / stripe_subscription_cancellations.js
Created January 10, 2014 19:13
Stripe Node Subscription Cancellation
stripe.customers.cancelSubscription(
"customer_id", { at_period_end: true }, function(err, response){
// handle the err/response here
}
)
@andrewpthorp
andrewpthorp / stripe_callbacks.js
Created January 10, 2014 18:04
Stripe Node Callback
stripe.charges.create(obj, function(err, data){
if (err) {
// an error occurred
} else {
// access data here, because it was a successful response
}
});