Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

stripe-archive/wilde-things

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wilde Things - A study in PHP

Wilde Things is a website on which you can buy quotes by Oscar Wilde. This is a PHP demo that demonstrates integrating Stripe, originally done for a General Assembly livestream tutorial on November 14, 2012.

The demo is 7 steps and goes from setting up a simple site for accepting one-time payments to a subscription-based service complete with webhook support.

Getting started

To begin, you'll need to take three steps (aside from cloning this repo):

  • Setup the web root directory
  • Install the Stripe PHP library
  • Create a Stripe account

Web root directory

For the purposes of this tutorial, the public folder--included in the git repo--is assumed to be the web root directory. You'll need to configure your web server accordingly, or clone the repo in the right directory to arrange that.

For each step in the tutorial, copy the script(s) to be executed to the public directory to test them.

Installing the Stripe library

To run any of the steps, you will first need to install the Stripe PHP library. As of version 2 of the Stripe PHP library, installation is accomplished via Composer.

Assuming you have installed Composer, add Stripe to your composer.json file (in the public folder):

{
  "require": {
    "stripe/stripe-php": "@stable"
  }
}

(The repo already includes this for you.)

Then run Composer's installation tool:

composer install

Creating a Stripe account

Next, sign up for a Stripe account at https://stripe.com and find your publishable and secret API keys in your account settings. As you go through the tutorial, you'll need to replace every instance of <YOUR PUBLISHABLE STRIPE API KEY> and <YOUR SECRET STRIPE API KEY> with your actual keys. You'll want to use your test API keys throughout.

Stripe PHP library versions and major changes

Version 2 of the Stripe PHP library, released in February 2015, makes use of namespaces, is installed via Composer, and requires PHP 5.3.3 or greater. All of the code in this tutorial has been updated for the 2.x Stripe PHP library.

If you're using an older version of the Stripe PHP library, see the changelog of this tutorial for the older code you'd use instead (in your PHP scripts). You can manually download older versions of the Stripe PHP library on GitHub.

About

A tutorial integrating Stripe in PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published