Skip to content

Instantly share code, notes, and snippets.

<?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");
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<!-- The required Stripe lib -->
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
Stripe.setPublishableKey('pk_test_Wfzrj4uDDPOcv7XxVJKXRERS');
var l = Ladda.create( document.querySelector( '#addservice-submit' ) );
var stripeResponseHandler = function(status, response) {
if (response.error) {
// show the errors on the form
$("#stripe-errors").html(response.error.message);
} else {
var token = response['id'];
var form$ = $("#addservice-form");
@briancollins
briancollins / gist:3098505
Created July 12, 2012 14:36 — 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");
@briancollins
briancollins / gist:1781729
Created February 9, 2012 18:15 — 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");
function probe() {
var count = 1;
function recurse() {
count++;
recurse();
}
try {
recurse();
} catch (e) {
}