Skip to content

Instantly share code, notes, and snippets.

//goes great with my DB structure. like cake
//custom items not from the charge json
$invoiceid = '';//create a unique invoice id for your transaction
$transactiontoken = '';//the token passed through from stripe.js
$itemname = 'green apples';//sent through with token and double checked
$itemdesc = 'delicious green apples';//sent through with token and double checked
$itemamount = '';//sent through with token and double checked
$applicationfee = '';//the fee that you sent through the charge
$buyeremail = '[email protected]';//sent through with token from stripe.js
CREATE TABLE IF NOT EXISTS `transactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`transactiontoken` varchar(200) NOT NULL,
`chargeid` varchar(100) NOT NULL,
`invoiceid` varchar(20) NOT NULL,
`type` varchar(10) NOT NULL,
`itemname` varchar(100) NOT NULL,
`itemdesc` varchar(100) NOT NULL,
`itemamount` int(10) NOT NULL,
`applicationfee` varchar(11) NOT NULL,
var objvalues = {};//needed so you can store all items for later use
var handler = StripeCheckout.configure({
key: "pk_test_Public key",
image: "productimage.jpg",
token: function(token) {
objvalues["stripeToken"] = token.id;
objvalues["stripeEmail"] = token.email;
$.get(
"/handler.php", /* your route here */
objvalues,