-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexample_pay_transaction.py
More file actions
42 lines (34 loc) · 978 Bytes
/
example_pay_transaction.py
File metadata and controls
42 lines (34 loc) · 978 Bytes
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
import sys
import chargeover
import pprint
# For authentication, fill in these values from your ChargeOver
# server information under "Configuraion->API and Webhooks"
endpoint =
username =
password =
# Set this to True to use "COv1 Signature" authorization
key_auth = False
co = chargeover.ChargeOver(
endpoint,
username,
password,
key_auth = key_auth)
# Our data for the transaction
tdata = {
"customer_id": 1,
# You can optionally supply an amount (if you don't specify an amount, you MUST specify a list of invoice_id values -- the amount will be calculated for you)
"amount": 18.62,
# You can optionally supply a list of invoice_id values to apply this payment to
"applied_to": [
{
"invoice_id": 24601
}
]
}
# post a new transaction
id = co.create('transaction', tdata)
if id is None:
pprint.pprint(co.get_last_response())
exit()
else:
print("Our transaction ID is: " + str(id))