Skip to content

Commit 6adada9

Browse files
committed
added stripe-php
1 parent 2f91878 commit 6adada9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+6514
-0
lines changed

stripe-php/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Mac OS X dumps these all over the place.
2+
.DS_Store
3+
4+
# Ignore the SimpleTest library if it is installed to /test/.
5+
/test/simpletest/
6+
7+
# Ignore the /vendor/ directory for people using composer
8+
/vendor/
9+
10+
# If the vendor directory isn't being commited the composer.lock file should also be ignored
11+
composer.lock

stripe-php/.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: php
2+
3+
php:
4+
- 5.2
5+
- 5.3
6+
- 5.4
7+
- 5.5
8+
9+
before_script:
10+
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then wget http://iweb.dl.sourceforge.net/project/simpletest/simpletest/simpletest_1.1/simpletest_1.1.0.tar.gz; tar xf simpletest_1.1.0.tar.gz -C test; else composer install --dev --prefer-source; fi"
11+
12+
script: php test/Stripe.php

stripe-php/CHANGELOG

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
=== 1.10.1 2013-12-02
2+
3+
* Add new ApplicationFee
4+
5+
=== 1.9.1 2013-11-08
6+
7+
* Fix a bug where a null nestable object causes warnings to fire.
8+
9+
=== 1.9.0 2013-10-16
10+
11+
* Add support for metadata API.
12+
13+
=== 1.8.4 2013-09-18
14+
15+
* Add support for closing disputes.
16+
17+
=== 1.8.3 2013-08-13
18+
19+
* Add new Balance and BalanceTransaction
20+
21+
=== 1.8.2 2013-08-12
22+
23+
* Add support for unsetting attributes by updating to NULL.
24+
Setting properties to a blank string is now an error.
25+
26+
=== 1.8.1 2013-07-12
27+
28+
* Add support for multiple cards API (Stripe API version 2013-07-12: https://stripe.com/docs/upgrades#2013-07-05)
29+
30+
=== 1.8.0 2013-04-11
31+
32+
* Allow Transfers to be creatable
33+
* Add new Recipient resource
34+
35+
=== 1.7.15 2013-02-21
36+
37+
* Add 'id' to the list of permanent object attributes
38+
39+
=== 1.7.14 2013-02-20
40+
41+
* Don't re-encode strings that are already encoded in UTF-8. If you
42+
were previously using plan or coupon objects with UTF-8 IDs, they
43+
may have been treated as ISO-8859-1 (Latin-1) and encoded to UTF-8 a
44+
2nd time. You may now need to pass the IDs to utf8_encode before
45+
passing them to Stripe_Plan::retrieve or Stripe_Coupon::retrieve.
46+
* Ensure that all input is encoded in UTF-8 before submitting it to
47+
Stripe's servers. (github issue #27)
48+
49+
=== 1.7.13 2013-02-01
50+
51+
* Add support for passing options when retrieving Stripe objects
52+
e.g., Stripe_Charge::retrieve(array("id"=>"foo", "expand" => array("customer")))
53+
Stripe_Charge::retrieve("foo") will continue to work
54+
55+
=== 1.7.12 2013-01-15
56+
57+
* Add support for setting a Stripe API version override
58+
59+
=== 1.7.11 2012-12-30
60+
61+
* Version bump to cleanup constants and such (github issue #26)
62+
63+
=== 1.7.10 2012-11-08
64+
65+
* Add support for updating charge disputes.
66+
* Fix bug preventing retrieval of null attributes
67+
68+
=== 1.7.9 2012-11-08
69+
70+
* Fix usage under autoloaders such as the one generated by composer
71+
(github issue #22)
72+
73+
=== 1.7.8 2012-10-30
74+
* Add support for creating invoices.
75+
* Add support for new invoice lines return format
76+
* Add support for new list objects
77+
78+
=== 1.7.7 2012-09-14
79+
80+
* Get all of the various version numbers in the repo in sync (no other
81+
changes)
82+
83+
=== 1.7.6 2012-08-31
84+
85+
* Add update and pay methods to Invoice resource
86+
87+
=== 1.7.5 2012-08-23
88+
89+
* Change internal function names so that Stripe_SingletonApiRequst is
90+
E_STRICT-clean (github issue #16)
91+
92+
=== 1.7.4 2012-08-21
93+
94+
* Bugfix so that Stripe objects (e.g. Customer, Charge objects) used
95+
in API calls are transparently converted to their object IDs
96+
97+
=== 1.7.3 2012-08-15
98+
99+
* Add new Account resource
100+
101+
=== 1.7.2 2012-06-26
102+
103+
* Make clearer that you should be including lib/Stripe.php, not
104+
test/Stripe.php (github issue #14)
105+
106+
=== 1.7.1 2012-05-24
107+
108+
* Add missing argument to Stripe_InvalidRequestError constructor in
109+
Stripe_ApiResource::instanceUrl. Fixes a warning when
110+
Stripe_ApiResource::instanceUrl is called on a resouce with no ID
111+
(github issue #12)
112+
113+
=== 1.7.0 2012-05-17
114+
115+
* Support Composer and Packagist (github issue #9)
116+
117+
* Add new deleteDiscount method to Stripe_Customer
118+
119+
* Add new Transfer resource
120+
121+
* Switch from using HTTP Basic auth to Bearer auth. (Note: Stripe will
122+
support Basic auth for the indefinite future, but recommends Bearer
123+
auth when possible going forward)
124+
125+
* Numerous test suite improvements

stripe-php/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2010-2014 Stripe
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

stripe-php/README.rdoc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
= Installation
2+
3+
Obtain the latest version of the Stripe PHP bindings with:
4+
5+
git clone https://github.com/stripe/stripe-php
6+
7+
To get started, add the following to your PHP script:
8+
9+
require_once("/path/to/stripe-php/lib/Stripe.php");
10+
11+
Simple usage looks like:
12+
13+
Stripe::setApiKey('d8e8fca2dc0f896fd7cb4cb0031ba249');
14+
$myCard = array('number' => '4242424242424242', 'exp_month' => 5, 'exp_year' => 2015);
15+
$charge = Stripe_Charge::create(array('card' => $myCard, 'amount' => 2000, 'currency' => 'usd'));
16+
echo $charge;
17+
18+
= Documentation
19+
20+
Please see https://stripe.com/api for up-to-date documentation.
21+
22+
= Tests
23+
24+
In order to run tests you have to install SimpleTest (http://packagist.org/packages/vierbergenlars/simpletest) via Composer (http://getcomposer.org/) (recommended way):
25+
26+
composer.phar update --dev
27+
28+
Run test suite:
29+
30+
php ./test/Stripe.php

stripe-php/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.10.1

stripe-php/composer.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "stripe/stripe-php",
3+
"description": "Stripe PHP Library",
4+
"keywords": [
5+
"stripe",
6+
"payment processing",
7+
"api"
8+
],
9+
"homepage": "https://stripe.com/",
10+
"license": "MIT",
11+
"authors": [
12+
{
13+
"name": "Stripe and contributors",
14+
"homepage": "https://github.com/stripe/stripe-php/contributors"
15+
}
16+
],
17+
"require": {
18+
"php": ">=5.2",
19+
"ext-curl": "*",
20+
"ext-json": "*",
21+
"ext-mbstring": "*"
22+
},
23+
"require-dev": {
24+
"vierbergenlars/simpletest": "*"
25+
},
26+
"autoload": {
27+
"classmap": ["lib/Stripe/"]
28+
}
29+
}

stripe-php/lib/Stripe.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
// Tested on PHP 5.2, 5.3
4+
5+
// This snippet (and some of the curl code) due to the Facebook SDK.
6+
if (!function_exists('curl_init')) {
7+
throw new Exception('Stripe needs the CURL PHP extension.');
8+
}
9+
if (!function_exists('json_decode')) {
10+
throw new Exception('Stripe needs the JSON PHP extension.');
11+
}
12+
if (!function_exists('mb_detect_encoding')) {
13+
throw new Exception('Stripe needs the Multibyte String PHP extension.');
14+
}
15+
16+
// Stripe singleton
17+
require(dirname(__FILE__) . '/Stripe/Stripe.php');
18+
19+
// Utilities
20+
require(dirname(__FILE__) . '/Stripe/Util.php');
21+
require(dirname(__FILE__) . '/Stripe/Util/Set.php');
22+
23+
// Errors
24+
require(dirname(__FILE__) . '/Stripe/Error.php');
25+
require(dirname(__FILE__) . '/Stripe/ApiError.php');
26+
require(dirname(__FILE__) . '/Stripe/ApiConnectionError.php');
27+
require(dirname(__FILE__) . '/Stripe/AuthenticationError.php');
28+
require(dirname(__FILE__) . '/Stripe/CardError.php');
29+
require(dirname(__FILE__) . '/Stripe/InvalidRequestError.php');
30+
31+
// Plumbing
32+
require(dirname(__FILE__) . '/Stripe/Object.php');
33+
require(dirname(__FILE__) . '/Stripe/ApiRequestor.php');
34+
require(dirname(__FILE__) . '/Stripe/ApiResource.php');
35+
require(dirname(__FILE__) . '/Stripe/SingletonApiResource.php');
36+
require(dirname(__FILE__) . '/Stripe/AttachedObject.php');
37+
require(dirname(__FILE__) . '/Stripe/List.php');
38+
39+
// Stripe API Resources
40+
require(dirname(__FILE__) . '/Stripe/Account.php');
41+
require(dirname(__FILE__) . '/Stripe/Card.php');
42+
require(dirname(__FILE__) . '/Stripe/Balance.php');
43+
require(dirname(__FILE__) . '/Stripe/BalanceTransaction.php');
44+
require(dirname(__FILE__) . '/Stripe/Charge.php');
45+
require(dirname(__FILE__) . '/Stripe/Customer.php');
46+
require(dirname(__FILE__) . '/Stripe/Invoice.php');
47+
require(dirname(__FILE__) . '/Stripe/InvoiceItem.php');
48+
require(dirname(__FILE__) . '/Stripe/Plan.php');
49+
require(dirname(__FILE__) . '/Stripe/Token.php');
50+
require(dirname(__FILE__) . '/Stripe/Coupon.php');
51+
require(dirname(__FILE__) . '/Stripe/Event.php');
52+
require(dirname(__FILE__) . '/Stripe/Transfer.php');
53+
require(dirname(__FILE__) . '/Stripe/Recipient.php');
54+
require(dirname(__FILE__) . '/Stripe/ApplicationFee.php');

stripe-php/lib/Stripe/Account.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
class Stripe_Account extends Stripe_SingletonApiResource
4+
{
5+
public static function constructFrom($values, $apiKey=null)
6+
{
7+
$class = get_class();
8+
return self::scopedConstructFrom($class, $values, $apiKey);
9+
}
10+
11+
public static function retrieve($apiKey=null)
12+
{
13+
$class = get_class();
14+
return self::_scopedSingletonRetrieve($class, $apiKey);
15+
}
16+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
class Stripe_ApiConnectionError extends Stripe_Error
4+
{
5+
}

0 commit comments

Comments
 (0)