-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
66 lines (52 loc) · 1.64 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python
from decouple import config
import simple_stripe_client
# print()
STRIPE_SECRET_KEY = config('STRIPE_SECRET_KEY')
stripe_api = simple_stripe_client.Api(STRIPE_SECRET_KEY, debug_http=True)
CUSTOMER_DATA = {
}
# create customer
# customer = stripe_api.customers.post()
# update customer
customer_id = 'cus_AUVASurSCMYLb7'
# get bank accounts
# accounts = stripe_api.customers.id(customer_id).sources.get(object='bank_account',limit=3)
# accounts = stripe_api.customers.id(customer_id).sources
# print(repr(stripe_api))
# print(accounts)
# customer = stripe_api.customers.id(customer_id).post(description="This is the test customer created",metadata={ 'name' : 'RohitX', 'customer_id' : 123,'last_name':'desf'},email='[email protected]')
# print(customer)
#
# DELETE Customer
# customer_del = stripe_api.customers.id(customer_id).delete()
# print("\n\n\n\n")
# print(customer_del)
# print("\n\n\n")
# print(stripe_api.charges.get)
# data = stripe_api.charges.get(limit=1)
# charge_id = 'ch_1Dz60xJKzeKazErxinipPnZa'
# data = stripe_api.charges.id(charge_id).post(description='this is test description x')
# print(data)
# data = stripe_api.charges.id(charge_id).get()
# print("\n\n\n")
# print(data['description'])
# print("\n\n\n")
# print(data['metadata'])
##Create new charge
CHARGE_DATA = {
'amount': 15921,
'currency': 'gbp',
'source': 'tok_amex',
'capture' : False,
'metadata': {
'first_name' : 'rohit',
'meta_1' : 123,
}
}
#
charge = stripe_api.charges.post(**CHARGE_DATA)
print(charge)
# charge_id = 'ch_1A9W9lJKzeKazErx0YGhbt0l'
# result = stripe_api.charges.id(charge_id).get()
# print(result)