stripe-api 0.2.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stripe-api-0.3.0/PKG-INFO +41 -0
- stripe-api-0.3.0/README.md +14 -0
- {stripe_api-0.2.0 → stripe-api-0.3.0}/setup.py +21 -32
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe/__init__.py +2 -11
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe/account.py +3 -11
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe/balance.py +3 -11
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe/base.py +13 -20
- stripe-api-0.3.0/src/stripe/charge.py +120 -0
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe/customer.py +10 -24
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe/intent.py +26 -21
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe/secure.py +10 -27
- stripe-api-0.3.0/src/stripe/source.py +101 -0
- stripe-api-0.3.0/src/stripe/token.py +76 -0
- stripe-api-0.3.0/src/stripe_api.egg-info/PKG-INFO +41 -0
- stripe_api-0.2.0/PKG-INFO +0 -26
- stripe_api-0.2.0/README.md +0 -14
- stripe_api-0.2.0/src/stripe/charge.py +0 -118
- stripe_api-0.2.0/src/stripe/source.py +0 -99
- stripe_api-0.2.0/src/stripe/token.py +0 -76
- stripe_api-0.2.0/src/stripe_api.egg-info/PKG-INFO +0 -26
- {stripe_api-0.2.0 → stripe-api-0.3.0}/setup.cfg +0 -0
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe_api.egg-info/SOURCES.txt +0 -0
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe_api.egg-info/dependency_links.txt +0 -0
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe_api.egg-info/not-zip-safe +0 -0
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe_api.egg-info/requires.txt +0 -0
- {stripe_api-0.2.0 → stripe-api-0.3.0}/src/stripe_api.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: stripe-api
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Stripe API Client
|
|
5
|
+
Home-page: http://stripe-api.hive.pt
|
|
6
|
+
Author: Hive Solutions Lda.
|
|
7
|
+
Author-email: development@hive.pt
|
|
8
|
+
License: Apache License, Version 2.0
|
|
9
|
+
Description: # [Stripe API](http://stripe-api.hive.pt)
|
|
10
|
+
|
|
11
|
+
Python API client for the [Stripe](https://stripe.com/) service.
|
|
12
|
+
|
|
13
|
+
## License
|
|
14
|
+
|
|
15
|
+
Stripe API is currently licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/).
|
|
16
|
+
|
|
17
|
+
## Build Automation
|
|
18
|
+
|
|
19
|
+
[](https://github.com/hivesolutions/stripe-api/actions)
|
|
20
|
+
[](https://coveralls.io/r/hivesolutions/stripe-api?branch=master)
|
|
21
|
+
[](https://pypi.python.org/pypi/stripe-api)
|
|
22
|
+
[](https://www.apache.org/licenses/)
|
|
23
|
+
|
|
24
|
+
Keywords: Stripe api
|
|
25
|
+
Platform: UNKNOWN
|
|
26
|
+
Classifier: Development Status :: 3 - Alpha
|
|
27
|
+
Classifier: Topic :: Utilities
|
|
28
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
29
|
+
Classifier: Operating System :: OS Independent
|
|
30
|
+
Classifier: Programming Language :: Python
|
|
31
|
+
Classifier: Programming Language :: Python :: 2.6
|
|
32
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.0
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.1
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.2
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.4
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# [Stripe API](http://stripe-api.hive.pt)
|
|
2
|
+
|
|
3
|
+
Python API client for the [Stripe](https://stripe.com/) service.
|
|
4
|
+
|
|
5
|
+
## License
|
|
6
|
+
|
|
7
|
+
Stripe API is currently licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/).
|
|
8
|
+
|
|
9
|
+
## Build Automation
|
|
10
|
+
|
|
11
|
+
[](https://github.com/hivesolutions/stripe-api/actions)
|
|
12
|
+
[](https://coveralls.io/r/hivesolutions/stripe-api?branch=master)
|
|
13
|
+
[](https://pypi.python.org/pypi/stripe-api)
|
|
14
|
+
[](https://www.apache.org/licenses/)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Stripe API
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Stripe API.
|
|
8
8
|
#
|
|
@@ -22,16 +22,7 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
@@ -41,25 +32,19 @@ import os
|
|
|
41
32
|
import setuptools
|
|
42
33
|
|
|
43
34
|
setuptools.setup(
|
|
44
|
-
name
|
|
45
|
-
version
|
|
46
|
-
author
|
|
47
|
-
author_email
|
|
48
|
-
description
|
|
49
|
-
license
|
|
50
|
-
keywords
|
|
51
|
-
url
|
|
52
|
-
zip_safe
|
|
53
|
-
packages
|
|
54
|
-
|
|
55
|
-
],
|
|
56
|
-
|
|
57
|
-
"" : os.path.normpath("src")
|
|
58
|
-
},
|
|
59
|
-
install_requires = [
|
|
60
|
-
"appier"
|
|
61
|
-
],
|
|
62
|
-
classifiers = [
|
|
35
|
+
name="stripe-api",
|
|
36
|
+
version="0.3.0",
|
|
37
|
+
author="Hive Solutions Lda.",
|
|
38
|
+
author_email="development@hive.pt",
|
|
39
|
+
description="Stripe API Client",
|
|
40
|
+
license="Apache License, Version 2.0",
|
|
41
|
+
keywords="Stripe api",
|
|
42
|
+
url="http://stripe-api.hive.pt",
|
|
43
|
+
zip_safe=False,
|
|
44
|
+
packages=["stripe"],
|
|
45
|
+
package_dir={"": os.path.normpath("src")},
|
|
46
|
+
install_requires=["appier"],
|
|
47
|
+
classifiers=[
|
|
63
48
|
"Development Status :: 3 - Alpha",
|
|
64
49
|
"Topic :: Utilities",
|
|
65
50
|
"License :: OSI Approved :: Apache Software License",
|
|
@@ -74,6 +59,10 @@ setuptools.setup(
|
|
|
74
59
|
"Programming Language :: Python :: 3.4",
|
|
75
60
|
"Programming Language :: Python :: 3.5",
|
|
76
61
|
"Programming Language :: Python :: 3.6",
|
|
77
|
-
"Programming Language :: Python :: 3.7"
|
|
78
|
-
]
|
|
62
|
+
"Programming Language :: Python :: 3.7",
|
|
63
|
+
],
|
|
64
|
+
long_description=open(os.path.join(os.path.dirname(__file__), "README.md"), "rb")
|
|
65
|
+
.read()
|
|
66
|
+
.decode("utf-8"),
|
|
67
|
+
long_description_content_type="text/markdown",
|
|
79
68
|
)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Stripe API
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Stripe API.
|
|
8
8
|
#
|
|
@@ -19,16 +19,7 @@
|
|
|
19
19
|
# You should have received a copy of the Apache License along with
|
|
20
20
|
# Hive Stripe API. If not, see <http://www.apache.org/licenses/>.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
""" The version of the module """
|
|
24
|
-
|
|
25
|
-
__revision__ = "$LastChangedRevision$"
|
|
26
|
-
""" The revision number of the module """
|
|
27
|
-
|
|
28
|
-
__date__ = "$LastChangedDate$"
|
|
29
|
-
""" The last change date of the module """
|
|
30
|
-
|
|
31
|
-
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
|
|
22
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
32
23
|
""" The copyright for the module """
|
|
33
24
|
|
|
34
25
|
__license__ = "Apache License, Version 2.0"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Stripe API
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Stripe API.
|
|
8
8
|
#
|
|
@@ -22,21 +22,13 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
38
29
|
""" The license for the module """
|
|
39
30
|
|
|
31
|
+
|
|
40
32
|
class AccountAPI(object):
|
|
41
33
|
|
|
42
34
|
def list_accounts(self):
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Stripe API
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Stripe API.
|
|
8
8
|
#
|
|
@@ -22,21 +22,13 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
38
29
|
""" The license for the module """
|
|
39
30
|
|
|
31
|
+
|
|
40
32
|
class BalanceAPI(object):
|
|
41
33
|
|
|
42
34
|
def get_balance(self):
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Stripe API
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Stripe API.
|
|
8
8
|
#
|
|
@@ -22,16 +22,7 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
@@ -52,6 +43,7 @@ BASE_URL = "https://api.stripe.com/v1/"
|
|
|
52
43
|
""" The default base URL to be used when no other
|
|
53
44
|
base URL value is provided to the constructor """
|
|
54
45
|
|
|
46
|
+
|
|
55
47
|
class API(
|
|
56
48
|
appier.API,
|
|
57
49
|
token.TokenAPI,
|
|
@@ -61,7 +53,7 @@ class API(
|
|
|
61
53
|
source.SourceAPI,
|
|
62
54
|
account.AccountAPI,
|
|
63
55
|
balance.BalanceAPI,
|
|
64
|
-
customer.CustomerAPI
|
|
56
|
+
customer.CustomerAPI,
|
|
65
57
|
):
|
|
66
58
|
|
|
67
59
|
def __init__(self, *args, **kwargs):
|
|
@@ -74,13 +66,14 @@ class API(
|
|
|
74
66
|
self,
|
|
75
67
|
method,
|
|
76
68
|
url,
|
|
77
|
-
data
|
|
78
|
-
data_j
|
|
79
|
-
data_m
|
|
80
|
-
headers
|
|
81
|
-
params
|
|
82
|
-
mime
|
|
83
|
-
kwargs
|
|
69
|
+
data=None,
|
|
70
|
+
data_j=None,
|
|
71
|
+
data_m=None,
|
|
72
|
+
headers=None,
|
|
73
|
+
params=None,
|
|
74
|
+
mime=None,
|
|
75
|
+
kwargs=None,
|
|
84
76
|
):
|
|
85
77
|
auth = kwargs.pop("auth", True)
|
|
86
|
-
if auth:
|
|
78
|
+
if auth:
|
|
79
|
+
headers["Authorization"] = "Bearer %s" % self.api_key
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
# Hive Stripe API
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
|
+
#
|
|
7
|
+
# This file is part of Hive Stripe API.
|
|
8
|
+
#
|
|
9
|
+
# Hive Stripe API is free software: you can redistribute it and/or modify
|
|
10
|
+
# it under the terms of the Apache License as published by the Apache
|
|
11
|
+
# Foundation, either version 2.0 of the License, or (at your option) any
|
|
12
|
+
# later version.
|
|
13
|
+
#
|
|
14
|
+
# Hive Stripe API is distributed in the hope that it will be useful,
|
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
# Apache License for more details.
|
|
18
|
+
#
|
|
19
|
+
# You should have received a copy of the Apache License along with
|
|
20
|
+
# Hive Stripe API. If not, see <http://www.apache.org/licenses/>.
|
|
21
|
+
|
|
22
|
+
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
|
+
""" The author(s) of the module """
|
|
24
|
+
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
26
|
+
""" The copyright for the module """
|
|
27
|
+
|
|
28
|
+
__license__ = "Apache License, Version 2.0"
|
|
29
|
+
""" The license for the module """
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ChargeAPI(object):
|
|
33
|
+
|
|
34
|
+
def list_charges(self, payment_intent=None, limit=None):
|
|
35
|
+
url = self.base_url + "charges"
|
|
36
|
+
params = {}
|
|
37
|
+
if payment_intent:
|
|
38
|
+
params["payment_intent"] = payment_intent
|
|
39
|
+
if limit:
|
|
40
|
+
params["limit"] = limit
|
|
41
|
+
contents = self.get(url, params=params)
|
|
42
|
+
return contents
|
|
43
|
+
|
|
44
|
+
def create_charge(
|
|
45
|
+
self,
|
|
46
|
+
amount,
|
|
47
|
+
currency,
|
|
48
|
+
exp_month,
|
|
49
|
+
exp_year,
|
|
50
|
+
number,
|
|
51
|
+
cvc=None,
|
|
52
|
+
name=None,
|
|
53
|
+
description=None,
|
|
54
|
+
statement_descriptor=None,
|
|
55
|
+
address_country=None,
|
|
56
|
+
address_state=None,
|
|
57
|
+
address_city=None,
|
|
58
|
+
address_zip=None,
|
|
59
|
+
address_line1=None,
|
|
60
|
+
address_line2=None,
|
|
61
|
+
metadata={},
|
|
62
|
+
):
|
|
63
|
+
url = self.base_url + "charges"
|
|
64
|
+
params = {
|
|
65
|
+
"amount": amount,
|
|
66
|
+
"currency": currency,
|
|
67
|
+
"source[object]": "card",
|
|
68
|
+
"source[exp_month]": exp_month,
|
|
69
|
+
"source[exp_year]": exp_year,
|
|
70
|
+
"source[number]": number,
|
|
71
|
+
}
|
|
72
|
+
if cvc:
|
|
73
|
+
params["source[cvc]"] = cvc
|
|
74
|
+
if name:
|
|
75
|
+
params["source[name]"] = name
|
|
76
|
+
if description:
|
|
77
|
+
params["description"] = description
|
|
78
|
+
if statement_descriptor:
|
|
79
|
+
params["statement_descriptor"] = statement_descriptor[:22]
|
|
80
|
+
if address_country:
|
|
81
|
+
params["source[address_country]"] = address_country
|
|
82
|
+
if address_state:
|
|
83
|
+
params["source[address_state]"] = address_state
|
|
84
|
+
if address_city:
|
|
85
|
+
params["source[address_city]"] = address_city
|
|
86
|
+
if address_zip:
|
|
87
|
+
params["source[address_zip]"] = address_zip
|
|
88
|
+
if address_line1:
|
|
89
|
+
params["source[address_line1]"] = address_line1
|
|
90
|
+
if address_line2:
|
|
91
|
+
params["source[address_line2]"] = address_line2
|
|
92
|
+
for key, value in metadata.items():
|
|
93
|
+
params["metadata[" + key + "]"] = value
|
|
94
|
+
contents = self.post(url, params=params)
|
|
95
|
+
return contents
|
|
96
|
+
|
|
97
|
+
def create_charge_token(
|
|
98
|
+
self,
|
|
99
|
+
amount,
|
|
100
|
+
currency,
|
|
101
|
+
token,
|
|
102
|
+
description=None,
|
|
103
|
+
statement_descriptor=None,
|
|
104
|
+
metadata={},
|
|
105
|
+
):
|
|
106
|
+
url = self.base_url + "charges"
|
|
107
|
+
params = {"amount": amount, "currency": currency, "source": token}
|
|
108
|
+
if description:
|
|
109
|
+
params["description"] = description
|
|
110
|
+
if statement_descriptor:
|
|
111
|
+
params["statement_descriptor"] = statement_descriptor[:22]
|
|
112
|
+
for key, value in metadata.items():
|
|
113
|
+
params["metadata[" + key + "]"] = value
|
|
114
|
+
contents = self.post(url, params=params)
|
|
115
|
+
return contents
|
|
116
|
+
|
|
117
|
+
def get_charge(self, charge):
|
|
118
|
+
url = self.base_url + "charges/%s" % charge
|
|
119
|
+
contents = self.get(url)
|
|
120
|
+
return contents
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Stripe API
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Stripe API.
|
|
8
8
|
#
|
|
@@ -22,21 +22,13 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
38
29
|
""" The license for the module """
|
|
39
30
|
|
|
31
|
+
|
|
40
32
|
class CustomerAPI(object):
|
|
41
33
|
|
|
42
34
|
def create_customer(self):
|
|
@@ -44,21 +36,15 @@ class CustomerAPI(object):
|
|
|
44
36
|
contents = self.post(url)
|
|
45
37
|
return contents
|
|
46
38
|
|
|
47
|
-
def create_card_customer(
|
|
48
|
-
self,
|
|
49
|
-
customer_id,
|
|
50
|
-
exp_month,
|
|
51
|
-
exp_year,
|
|
52
|
-
number
|
|
53
|
-
):
|
|
39
|
+
def create_card_customer(self, customer_id, exp_month, exp_year, number):
|
|
54
40
|
url = self.base_url + "customers/%s/sources" % customer_id
|
|
55
41
|
contents = self.post(
|
|
56
42
|
url,
|
|
57
|
-
params
|
|
58
|
-
"source[object]"
|
|
59
|
-
"source[exp_month]"
|
|
60
|
-
"source[exp_year]"
|
|
61
|
-
"source[number]"
|
|
62
|
-
}
|
|
43
|
+
params={
|
|
44
|
+
"source[object]": "card",
|
|
45
|
+
"source[exp_month]": exp_month,
|
|
46
|
+
"source[exp_year]": exp_year,
|
|
47
|
+
"source[number]": number,
|
|
48
|
+
},
|
|
63
49
|
)
|
|
64
50
|
return contents
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Stripe API
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Stripe API.
|
|
8
8
|
#
|
|
@@ -22,41 +22,46 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
38
29
|
""" The license for the module """
|
|
39
30
|
|
|
31
|
+
|
|
40
32
|
class IntentAPI(object):
|
|
41
33
|
|
|
42
34
|
def create_intent(
|
|
43
35
|
self,
|
|
44
36
|
amount,
|
|
45
37
|
currency,
|
|
46
|
-
application_fee_amount
|
|
47
|
-
capture_method
|
|
48
|
-
confirm
|
|
38
|
+
application_fee_amount=None,
|
|
39
|
+
capture_method=None,
|
|
40
|
+
confirm=None,
|
|
41
|
+
description=None,
|
|
42
|
+
three_d_secure=None,
|
|
43
|
+
payment_method_types=[],
|
|
44
|
+
metadata={},
|
|
49
45
|
):
|
|
50
46
|
url = self.base_url + "payment_intents"
|
|
51
|
-
params = {
|
|
52
|
-
"amount" : amount,
|
|
53
|
-
"currency" : currency
|
|
54
|
-
}
|
|
47
|
+
params = {"amount": amount, "currency": currency}
|
|
55
48
|
if application_fee_amount:
|
|
56
49
|
params["application_fee_amount"] = application_fee_amount
|
|
57
|
-
if capture_method:
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
if capture_method:
|
|
51
|
+
params["capture_method"] = capture_method
|
|
52
|
+
if confirm:
|
|
53
|
+
params["confirm"] = confirm
|
|
54
|
+
if description:
|
|
55
|
+
params["description"] = description
|
|
56
|
+
if three_d_secure:
|
|
57
|
+
params["payment_method_options[card][request_three_d_secure]"] = (
|
|
58
|
+
three_d_secure
|
|
59
|
+
)
|
|
60
|
+
for payment_method_type in payment_method_types:
|
|
61
|
+
params["payment_method_types[]"] = payment_method_type
|
|
62
|
+
for key, value in metadata.items():
|
|
63
|
+
params["metadata[" + key + "]"] = value
|
|
64
|
+
contents = self.post(url, params=params)
|
|
60
65
|
return contents
|
|
61
66
|
|
|
62
67
|
def capture_intent(self, identifier):
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
4
|
# Hive Stripe API
|
|
5
|
-
# Copyright (c) 2008-
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
6
|
#
|
|
7
7
|
# This file is part of Hive Stripe API.
|
|
8
8
|
#
|
|
@@ -22,38 +22,21 @@
|
|
|
22
22
|
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
23
|
""" The author(s) of the module """
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
35
26
|
""" The copyright for the module """
|
|
36
27
|
|
|
37
28
|
__license__ = "Apache License, Version 2.0"
|
|
38
29
|
""" The license for the module """
|
|
39
30
|
|
|
31
|
+
|
|
40
32
|
class SecureAPI(object):
|
|
41
33
|
|
|
42
|
-
def create_3d_secure(
|
|
43
|
-
self,
|
|
44
|
-
amount,
|
|
45
|
-
currency,
|
|
46
|
-
return_url,
|
|
47
|
-
card = None,
|
|
48
|
-
customer = None
|
|
49
|
-
):
|
|
34
|
+
def create_3d_secure(self, amount, currency, return_url, card=None, customer=None):
|
|
50
35
|
url = self.base_url + "3d_secure"
|
|
51
|
-
params = {
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if customer: params["customer"] = customer
|
|
58
|
-
contents = self.post(url, params = params)
|
|
36
|
+
params = {"amount": amount, "currency": currency, "return_url": return_url}
|
|
37
|
+
if card:
|
|
38
|
+
params["card"] = card
|
|
39
|
+
if customer:
|
|
40
|
+
params["customer"] = customer
|
|
41
|
+
contents = self.post(url, params=params)
|
|
59
42
|
return contents
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
# Hive Stripe API
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
|
+
#
|
|
7
|
+
# This file is part of Hive Stripe API.
|
|
8
|
+
#
|
|
9
|
+
# Hive Stripe API is free software: you can redistribute it and/or modify
|
|
10
|
+
# it under the terms of the Apache License as published by the Apache
|
|
11
|
+
# Foundation, either version 2.0 of the License, or (at your option) any
|
|
12
|
+
# later version.
|
|
13
|
+
#
|
|
14
|
+
# Hive Stripe API is distributed in the hope that it will be useful,
|
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
# Apache License for more details.
|
|
18
|
+
#
|
|
19
|
+
# You should have received a copy of the Apache License along with
|
|
20
|
+
# Hive Stripe API. If not, see <http://www.apache.org/licenses/>.
|
|
21
|
+
|
|
22
|
+
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
|
+
""" The author(s) of the module """
|
|
24
|
+
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
26
|
+
""" The copyright for the module """
|
|
27
|
+
|
|
28
|
+
__license__ = "Apache License, Version 2.0"
|
|
29
|
+
""" The license for the module """
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class SourceAPI(object):
|
|
33
|
+
|
|
34
|
+
def get_source(self, token):
|
|
35
|
+
url = self.base_url + "sources/%s" % token
|
|
36
|
+
contents = self.get(url)
|
|
37
|
+
return contents
|
|
38
|
+
|
|
39
|
+
def create_card_source(
|
|
40
|
+
self,
|
|
41
|
+
exp_month,
|
|
42
|
+
exp_year,
|
|
43
|
+
number,
|
|
44
|
+
type="card",
|
|
45
|
+
cvc=None,
|
|
46
|
+
name=None,
|
|
47
|
+
address_country=None,
|
|
48
|
+
address_state=None,
|
|
49
|
+
address_city=None,
|
|
50
|
+
address_zip=None,
|
|
51
|
+
address_line1=None,
|
|
52
|
+
address_line2=None,
|
|
53
|
+
):
|
|
54
|
+
url = self.base_url + "sources"
|
|
55
|
+
params = {
|
|
56
|
+
"type": type,
|
|
57
|
+
"card[exp_month]": exp_month,
|
|
58
|
+
"card[exp_year]": exp_year,
|
|
59
|
+
"card[number]": number,
|
|
60
|
+
}
|
|
61
|
+
if cvc:
|
|
62
|
+
params["card[cvc]"] = cvc
|
|
63
|
+
if name:
|
|
64
|
+
params["owner[name]"] = name
|
|
65
|
+
if address_country:
|
|
66
|
+
params["owner[address][country]"] = address_country
|
|
67
|
+
if address_state:
|
|
68
|
+
params["owner[address][state]"] = address_state
|
|
69
|
+
if address_city:
|
|
70
|
+
params["owner[address][city]"] = address_city
|
|
71
|
+
if address_zip:
|
|
72
|
+
params["owner[address][postal_code]"] = address_zip
|
|
73
|
+
if address_line1:
|
|
74
|
+
params["owner[address][line1]"] = address_line1
|
|
75
|
+
if address_line2:
|
|
76
|
+
params["owner[address][line2]"] = address_line2
|
|
77
|
+
contents = self.post(url, params=params)
|
|
78
|
+
return contents
|
|
79
|
+
|
|
80
|
+
def create_3d_secure_source(
|
|
81
|
+
self,
|
|
82
|
+
amount,
|
|
83
|
+
currency,
|
|
84
|
+
return_url,
|
|
85
|
+
type="three_d_secure",
|
|
86
|
+
card=None,
|
|
87
|
+
customer=None,
|
|
88
|
+
):
|
|
89
|
+
url = self.base_url + "sources"
|
|
90
|
+
params = {
|
|
91
|
+
"amount": amount,
|
|
92
|
+
"currency": currency,
|
|
93
|
+
"type": type,
|
|
94
|
+
"redirect[return_url]": return_url,
|
|
95
|
+
}
|
|
96
|
+
if card:
|
|
97
|
+
params["three_d_secure[card]"] = card
|
|
98
|
+
if customer:
|
|
99
|
+
params["three_d_secure[customer]"] = customer
|
|
100
|
+
contents = self.post(url, params=params)
|
|
101
|
+
return contents
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
# Hive Stripe API
|
|
5
|
+
# Copyright (c) 2008-2025 Hive Solutions Lda.
|
|
6
|
+
#
|
|
7
|
+
# This file is part of Hive Stripe API.
|
|
8
|
+
#
|
|
9
|
+
# Hive Stripe API is free software: you can redistribute it and/or modify
|
|
10
|
+
# it under the terms of the Apache License as published by the Apache
|
|
11
|
+
# Foundation, either version 2.0 of the License, or (at your option) any
|
|
12
|
+
# later version.
|
|
13
|
+
#
|
|
14
|
+
# Hive Stripe API is distributed in the hope that it will be useful,
|
|
15
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
# Apache License for more details.
|
|
18
|
+
#
|
|
19
|
+
# You should have received a copy of the Apache License along with
|
|
20
|
+
# Hive Stripe API. If not, see <http://www.apache.org/licenses/>.
|
|
21
|
+
|
|
22
|
+
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
|
+
""" The author(s) of the module """
|
|
24
|
+
|
|
25
|
+
__copyright__ = "Copyright (c) 2008-2025 Hive Solutions Lda."
|
|
26
|
+
""" The copyright for the module """
|
|
27
|
+
|
|
28
|
+
__license__ = "Apache License, Version 2.0"
|
|
29
|
+
""" The license for the module """
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class TokenAPI(object):
|
|
33
|
+
|
|
34
|
+
def get_token(self, token):
|
|
35
|
+
url = self.base_url + "tokens/%s" % token
|
|
36
|
+
contents = self.get(url)
|
|
37
|
+
return contents
|
|
38
|
+
|
|
39
|
+
def create_token(
|
|
40
|
+
self,
|
|
41
|
+
exp_month,
|
|
42
|
+
exp_year,
|
|
43
|
+
number,
|
|
44
|
+
cvc=None,
|
|
45
|
+
name=None,
|
|
46
|
+
address_country=None,
|
|
47
|
+
address_state=None,
|
|
48
|
+
address_city=None,
|
|
49
|
+
address_zip=None,
|
|
50
|
+
address_line1=None,
|
|
51
|
+
address_line2=None,
|
|
52
|
+
):
|
|
53
|
+
url = self.base_url + "tokens"
|
|
54
|
+
params = {
|
|
55
|
+
"card[exp_month]": exp_month,
|
|
56
|
+
"card[exp_year]": exp_year,
|
|
57
|
+
"card[number]": number,
|
|
58
|
+
}
|
|
59
|
+
if cvc:
|
|
60
|
+
params["card[cvc]"] = cvc
|
|
61
|
+
if name:
|
|
62
|
+
params["card[name]"] = name
|
|
63
|
+
if address_country:
|
|
64
|
+
params["card[address_country]"] = address_country
|
|
65
|
+
if address_state:
|
|
66
|
+
params["card[address_state]"] = address_state
|
|
67
|
+
if address_city:
|
|
68
|
+
params["card[address_city]"] = address_city
|
|
69
|
+
if address_zip:
|
|
70
|
+
params["card[address_zip]"] = address_zip
|
|
71
|
+
if address_line1:
|
|
72
|
+
params["card[address_line1]"] = address_line1
|
|
73
|
+
if address_line2:
|
|
74
|
+
params["card[address_line2]"] = address_line2
|
|
75
|
+
contents = self.post(url, params=params)
|
|
76
|
+
return contents
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: stripe-api
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Stripe API Client
|
|
5
|
+
Home-page: http://stripe-api.hive.pt
|
|
6
|
+
Author: Hive Solutions Lda.
|
|
7
|
+
Author-email: development@hive.pt
|
|
8
|
+
License: Apache License, Version 2.0
|
|
9
|
+
Description: # [Stripe API](http://stripe-api.hive.pt)
|
|
10
|
+
|
|
11
|
+
Python API client for the [Stripe](https://stripe.com/) service.
|
|
12
|
+
|
|
13
|
+
## License
|
|
14
|
+
|
|
15
|
+
Stripe API is currently licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/).
|
|
16
|
+
|
|
17
|
+
## Build Automation
|
|
18
|
+
|
|
19
|
+
[](https://github.com/hivesolutions/stripe-api/actions)
|
|
20
|
+
[](https://coveralls.io/r/hivesolutions/stripe-api?branch=master)
|
|
21
|
+
[](https://pypi.python.org/pypi/stripe-api)
|
|
22
|
+
[](https://www.apache.org/licenses/)
|
|
23
|
+
|
|
24
|
+
Keywords: Stripe api
|
|
25
|
+
Platform: UNKNOWN
|
|
26
|
+
Classifier: Development Status :: 3 - Alpha
|
|
27
|
+
Classifier: Topic :: Utilities
|
|
28
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
29
|
+
Classifier: Operating System :: OS Independent
|
|
30
|
+
Classifier: Programming Language :: Python
|
|
31
|
+
Classifier: Programming Language :: Python :: 2.6
|
|
32
|
+
Classifier: Programming Language :: Python :: 2.7
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.0
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.1
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.2
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.4
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
41
|
+
Description-Content-Type: text/markdown
|
stripe_api-0.2.0/PKG-INFO
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.1
|
|
2
|
-
Name: stripe_api
|
|
3
|
-
Version: 0.2.0
|
|
4
|
-
Summary: Stripe API Client
|
|
5
|
-
Home-page: http://stripe-api.hive.pt
|
|
6
|
-
Author: Hive Solutions Lda.
|
|
7
|
-
Author-email: development@hive.pt
|
|
8
|
-
License: Apache License, Version 2.0
|
|
9
|
-
Description: UNKNOWN
|
|
10
|
-
Keywords: Stripe api
|
|
11
|
-
Platform: UNKNOWN
|
|
12
|
-
Classifier: Development Status :: 3 - Alpha
|
|
13
|
-
Classifier: Topic :: Utilities
|
|
14
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
-
Classifier: Operating System :: OS Independent
|
|
16
|
-
Classifier: Programming Language :: Python
|
|
17
|
-
Classifier: Programming Language :: Python :: 2.6
|
|
18
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.0
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.1
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.2
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.3
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.4
|
|
24
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
25
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
26
|
-
Classifier: Programming Language :: Python :: 3.7
|
stripe_api-0.2.0/README.md
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# [Stripe API](http://stripe-api.hive.pt)
|
|
2
|
-
|
|
3
|
-
Python API client for the Stripe service.
|
|
4
|
-
|
|
5
|
-
## License
|
|
6
|
-
|
|
7
|
-
Stripe API is currently licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/).
|
|
8
|
-
|
|
9
|
-
## Build Automation
|
|
10
|
-
|
|
11
|
-
[](https://travis-ci.org/hivesolutions/stripe_api)
|
|
12
|
-
[](https://coveralls.io/r/hivesolutions/stripe_api?branch=master)
|
|
13
|
-
[](https://pypi.python.org/pypi/stripe_api)
|
|
14
|
-
[](https://www.apache.org/licenses/)
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
# Hive Stripe API
|
|
5
|
-
# Copyright (c) 2008-2019 Hive Solutions Lda.
|
|
6
|
-
#
|
|
7
|
-
# This file is part of Hive Stripe API.
|
|
8
|
-
#
|
|
9
|
-
# Hive Stripe API is free software: you can redistribute it and/or modify
|
|
10
|
-
# it under the terms of the Apache License as published by the Apache
|
|
11
|
-
# Foundation, either version 2.0 of the License, or (at your option) any
|
|
12
|
-
# later version.
|
|
13
|
-
#
|
|
14
|
-
# Hive Stripe API is distributed in the hope that it will be useful,
|
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
-
# Apache License for more details.
|
|
18
|
-
#
|
|
19
|
-
# You should have received a copy of the Apache License along with
|
|
20
|
-
# Hive Stripe API. If not, see <http://www.apache.org/licenses/>.
|
|
21
|
-
|
|
22
|
-
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
|
-
""" The author(s) of the module """
|
|
24
|
-
|
|
25
|
-
__version__ = "1.0.0"
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
|
|
35
|
-
""" The copyright for the module """
|
|
36
|
-
|
|
37
|
-
__license__ = "Apache License, Version 2.0"
|
|
38
|
-
""" The license for the module """
|
|
39
|
-
|
|
40
|
-
class ChargeAPI(object):
|
|
41
|
-
|
|
42
|
-
def list_charges(self, payment_intent = None, limit = None):
|
|
43
|
-
url = self.base_url + "charges"
|
|
44
|
-
params = {}
|
|
45
|
-
if payment_intent: params["payment_intent"] = payment_intent
|
|
46
|
-
if limit: params["limit"] = limit
|
|
47
|
-
contents = self.get(url, params = params)
|
|
48
|
-
return contents
|
|
49
|
-
|
|
50
|
-
def create_charge(
|
|
51
|
-
self,
|
|
52
|
-
amount,
|
|
53
|
-
currency,
|
|
54
|
-
exp_month,
|
|
55
|
-
exp_year,
|
|
56
|
-
number,
|
|
57
|
-
cvc = None,
|
|
58
|
-
name = None,
|
|
59
|
-
description = None,
|
|
60
|
-
statement_descriptor = None,
|
|
61
|
-
address_country = None,
|
|
62
|
-
address_state = None,
|
|
63
|
-
address_city = None,
|
|
64
|
-
address_zip = None,
|
|
65
|
-
address_line1 = None,
|
|
66
|
-
address_line2 = None,
|
|
67
|
-
metadata = {}
|
|
68
|
-
):
|
|
69
|
-
url = self.base_url + "charges"
|
|
70
|
-
params = {
|
|
71
|
-
"amount" : amount,
|
|
72
|
-
"currency" : currency,
|
|
73
|
-
"source[object]" : "card",
|
|
74
|
-
"source[exp_month]" : exp_month,
|
|
75
|
-
"source[exp_year]" : exp_year,
|
|
76
|
-
"source[number]" : number
|
|
77
|
-
}
|
|
78
|
-
if cvc: params["source[cvc]"] = cvc
|
|
79
|
-
if name: params["source[name]"] = name
|
|
80
|
-
if description: params["description"] = description
|
|
81
|
-
if statement_descriptor: params["statement_descriptor"] = statement_descriptor[:22]
|
|
82
|
-
if address_country: params["source[address_country]"] = address_country
|
|
83
|
-
if address_state: params["source[address_state]"] = address_state
|
|
84
|
-
if address_city: params["source[address_city]"] = address_city
|
|
85
|
-
if address_zip: params["source[address_zip]"] = address_zip
|
|
86
|
-
if address_line1: params["source[address_line1]"] = address_line1
|
|
87
|
-
if address_line2: params["source[address_line2]"] = address_line2
|
|
88
|
-
for key, value in metadata.items():
|
|
89
|
-
params["metadata[" + key + "]"] = value
|
|
90
|
-
contents = self.post(url, params = params)
|
|
91
|
-
return contents
|
|
92
|
-
|
|
93
|
-
def create_charge_token(
|
|
94
|
-
self,
|
|
95
|
-
amount,
|
|
96
|
-
currency,
|
|
97
|
-
token,
|
|
98
|
-
description = None,
|
|
99
|
-
statement_descriptor = None,
|
|
100
|
-
metadata = {}
|
|
101
|
-
):
|
|
102
|
-
url = self.base_url + "charges"
|
|
103
|
-
params = {
|
|
104
|
-
"amount" : amount,
|
|
105
|
-
"currency" : currency,
|
|
106
|
-
"source" : token
|
|
107
|
-
}
|
|
108
|
-
if description: params["description"] = description
|
|
109
|
-
if statement_descriptor: params["statement_descriptor"] = statement_descriptor[:22]
|
|
110
|
-
for key, value in metadata.items():
|
|
111
|
-
params["metadata[" + key + "]"] = value
|
|
112
|
-
contents = self.post(url, params = params)
|
|
113
|
-
return contents
|
|
114
|
-
|
|
115
|
-
def get_charge(self, charge):
|
|
116
|
-
url = self.base_url + "charges/%s" % charge
|
|
117
|
-
contents = self.get(url)
|
|
118
|
-
return contents
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
# Hive Stripe API
|
|
5
|
-
# Copyright (c) 2008-2019 Hive Solutions Lda.
|
|
6
|
-
#
|
|
7
|
-
# This file is part of Hive Stripe API.
|
|
8
|
-
#
|
|
9
|
-
# Hive Stripe API is free software: you can redistribute it and/or modify
|
|
10
|
-
# it under the terms of the Apache License as published by the Apache
|
|
11
|
-
# Foundation, either version 2.0 of the License, or (at your option) any
|
|
12
|
-
# later version.
|
|
13
|
-
#
|
|
14
|
-
# Hive Stripe API is distributed in the hope that it will be useful,
|
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
-
# Apache License for more details.
|
|
18
|
-
#
|
|
19
|
-
# You should have received a copy of the Apache License along with
|
|
20
|
-
# Hive Stripe API. If not, see <http://www.apache.org/licenses/>.
|
|
21
|
-
|
|
22
|
-
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
|
-
""" The author(s) of the module """
|
|
24
|
-
|
|
25
|
-
__version__ = "1.0.0"
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
|
|
35
|
-
""" The copyright for the module """
|
|
36
|
-
|
|
37
|
-
__license__ = "Apache License, Version 2.0"
|
|
38
|
-
""" The license for the module """
|
|
39
|
-
|
|
40
|
-
class SourceAPI(object):
|
|
41
|
-
|
|
42
|
-
def get_source(self, token):
|
|
43
|
-
url = self.base_url + "sources/%s" % token
|
|
44
|
-
contents = self.get(url)
|
|
45
|
-
return contents
|
|
46
|
-
|
|
47
|
-
def create_card_source(
|
|
48
|
-
self,
|
|
49
|
-
exp_month,
|
|
50
|
-
exp_year,
|
|
51
|
-
number,
|
|
52
|
-
type = "card",
|
|
53
|
-
cvc = None,
|
|
54
|
-
name = None,
|
|
55
|
-
address_country = None,
|
|
56
|
-
address_state = None,
|
|
57
|
-
address_city = None,
|
|
58
|
-
address_zip = None,
|
|
59
|
-
address_line1 = None,
|
|
60
|
-
address_line2 = None
|
|
61
|
-
):
|
|
62
|
-
url = self.base_url + "sources"
|
|
63
|
-
params = {
|
|
64
|
-
"type" : type,
|
|
65
|
-
"card[exp_month]" : exp_month,
|
|
66
|
-
"card[exp_year]" : exp_year,
|
|
67
|
-
"card[number]" : number
|
|
68
|
-
}
|
|
69
|
-
if cvc: params["card[cvc]"] = cvc
|
|
70
|
-
if name: params["owner[name]"] = name
|
|
71
|
-
if address_country: params["owner[address][country]"] = address_country
|
|
72
|
-
if address_state: params["owner[address][state]"] = address_state
|
|
73
|
-
if address_city: params["owner[address][city]"] = address_city
|
|
74
|
-
if address_zip: params["owner[address][postal_code]"] = address_zip
|
|
75
|
-
if address_line1: params["owner[address][line1]"] = address_line1
|
|
76
|
-
if address_line2: params["owner[address][line2]"] = address_line2
|
|
77
|
-
contents = self.post(url, params = params)
|
|
78
|
-
return contents
|
|
79
|
-
|
|
80
|
-
def create_3d_secure_source(
|
|
81
|
-
self,
|
|
82
|
-
amount,
|
|
83
|
-
currency,
|
|
84
|
-
return_url,
|
|
85
|
-
type = "three_d_secure",
|
|
86
|
-
card = None,
|
|
87
|
-
customer = None
|
|
88
|
-
):
|
|
89
|
-
url = self.base_url + "sources"
|
|
90
|
-
params = {
|
|
91
|
-
"amount" : amount,
|
|
92
|
-
"currency" : currency,
|
|
93
|
-
"type" : type,
|
|
94
|
-
"redirect[return_url]" : return_url
|
|
95
|
-
}
|
|
96
|
-
if card: params["three_d_secure[card]"] = card
|
|
97
|
-
if customer: params["three_d_secure[customer]"] = customer
|
|
98
|
-
contents = self.post(url, params = params)
|
|
99
|
-
return contents
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
# Hive Stripe API
|
|
5
|
-
# Copyright (c) 2008-2019 Hive Solutions Lda.
|
|
6
|
-
#
|
|
7
|
-
# This file is part of Hive Stripe API.
|
|
8
|
-
#
|
|
9
|
-
# Hive Stripe API is free software: you can redistribute it and/or modify
|
|
10
|
-
# it under the terms of the Apache License as published by the Apache
|
|
11
|
-
# Foundation, either version 2.0 of the License, or (at your option) any
|
|
12
|
-
# later version.
|
|
13
|
-
#
|
|
14
|
-
# Hive Stripe API is distributed in the hope that it will be useful,
|
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
-
# Apache License for more details.
|
|
18
|
-
#
|
|
19
|
-
# You should have received a copy of the Apache License along with
|
|
20
|
-
# Hive Stripe API. If not, see <http://www.apache.org/licenses/>.
|
|
21
|
-
|
|
22
|
-
__author__ = "João Magalhães <joamag@hive.pt>"
|
|
23
|
-
""" The author(s) of the module """
|
|
24
|
-
|
|
25
|
-
__version__ = "1.0.0"
|
|
26
|
-
""" The version of the module """
|
|
27
|
-
|
|
28
|
-
__revision__ = "$LastChangedRevision$"
|
|
29
|
-
""" The revision number of the module """
|
|
30
|
-
|
|
31
|
-
__date__ = "$LastChangedDate$"
|
|
32
|
-
""" The last change date of the module """
|
|
33
|
-
|
|
34
|
-
__copyright__ = "Copyright (c) 2008-2019 Hive Solutions Lda."
|
|
35
|
-
""" The copyright for the module """
|
|
36
|
-
|
|
37
|
-
__license__ = "Apache License, Version 2.0"
|
|
38
|
-
""" The license for the module """
|
|
39
|
-
|
|
40
|
-
class TokenAPI(object):
|
|
41
|
-
|
|
42
|
-
def get_token(self, token):
|
|
43
|
-
url = self.base_url + "tokens/%s" % token
|
|
44
|
-
contents = self.get(url)
|
|
45
|
-
return contents
|
|
46
|
-
|
|
47
|
-
def create_token(
|
|
48
|
-
self,
|
|
49
|
-
exp_month,
|
|
50
|
-
exp_year,
|
|
51
|
-
number,
|
|
52
|
-
cvc = None,
|
|
53
|
-
name = None,
|
|
54
|
-
address_country = None,
|
|
55
|
-
address_state = None,
|
|
56
|
-
address_city = None,
|
|
57
|
-
address_zip = None,
|
|
58
|
-
address_line1 = None,
|
|
59
|
-
address_line2 = None
|
|
60
|
-
):
|
|
61
|
-
url = self.base_url + "tokens"
|
|
62
|
-
params = {
|
|
63
|
-
"card[exp_month]" : exp_month,
|
|
64
|
-
"card[exp_year]" : exp_year,
|
|
65
|
-
"card[number]" : number,
|
|
66
|
-
}
|
|
67
|
-
if cvc: params["card[cvc]"] = cvc
|
|
68
|
-
if name: params["card[name]"] = name
|
|
69
|
-
if address_country: params["card[address_country]"] = address_country
|
|
70
|
-
if address_state: params["card[address_state]"] = address_state
|
|
71
|
-
if address_city: params["card[address_city]"] = address_city
|
|
72
|
-
if address_zip: params["card[address_zip]"] = address_zip
|
|
73
|
-
if address_line1: params["card[address_line1]"] = address_line1
|
|
74
|
-
if address_line2: params["card[address_line2]"] = address_line2
|
|
75
|
-
contents = self.post(url, params = params)
|
|
76
|
-
return contents
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.1
|
|
2
|
-
Name: stripe-api
|
|
3
|
-
Version: 0.2.0
|
|
4
|
-
Summary: Stripe API Client
|
|
5
|
-
Home-page: http://stripe-api.hive.pt
|
|
6
|
-
Author: Hive Solutions Lda.
|
|
7
|
-
Author-email: development@hive.pt
|
|
8
|
-
License: Apache License, Version 2.0
|
|
9
|
-
Description: UNKNOWN
|
|
10
|
-
Keywords: Stripe api
|
|
11
|
-
Platform: UNKNOWN
|
|
12
|
-
Classifier: Development Status :: 3 - Alpha
|
|
13
|
-
Classifier: Topic :: Utilities
|
|
14
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
-
Classifier: Operating System :: OS Independent
|
|
16
|
-
Classifier: Programming Language :: Python
|
|
17
|
-
Classifier: Programming Language :: Python :: 2.6
|
|
18
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.0
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.1
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.2
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.3
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.4
|
|
24
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
25
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
26
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|