Skip to content

Instantly share code, notes, and snippets.

<?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");