forked from glim/rest-api-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.py
67 lines (64 loc) · 1.7 KB
/
create.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
67
from paypalrestsdk import Invoice
import logging
import json
logging.basicConfig(level=logging.INFO)
invoice = Invoice({
"merchant_info": {
"email": "jaypatel512-facilitator@hotmail.com", # You must change this to your sandbox email account
"first_name": "Dennis",
"last_name": "Doctor",
"business_name": "Medical Professionals, LLC",
"phone": {
"country_code": "001",
"national_number": "5032141716"
},
"address": {
"line1": "1234 Main St.",
"city": "Portland",
"state": "OR",
"postal_code": "97217",
"country_code": "US"
}
},
"billing_info": [{"email": "example@example.com"}],
"items": [
{
"name": "Sutures",
"quantity": 100,
"unit_price": {
"currency": "USD",
"value": 5
}
}
],
"note": "Medical Invoice 16 Jul, 2013 PST",
"payment_term": {
"term_type": "NET_45"
},
"shipping_info": {
"first_name": "Sally",
"last_name": "Patient",
"business_name": "Not applicable",
"phone": {
"country_code": "001",
"national_number": "5039871234"
},
"address": {
"line1": "1234 Broad St.",
"city": "Portland",
"state": "OR",
"postal_code": "97216",
"country_code": "US"
}
},
"shipping_cost": {
"amount": {
"currency": "USD",
"value": 10
}
}
})
if invoice.create():
print(json.dumps(invoice.to_dict(), sort_keys=False, indent=4))
else:
print(invoice.error)