forked from glim/rest-api-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcreate.py
51 lines (48 loc) · 1.33 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
from paypalrestsdk import Payout, ResourceNotFound
import random
import string
sender_batch_id = ''.join(
random.choice(string.ascii_uppercase) for i in range(12))
payout = Payout({
"sender_batch_header": {
"sender_batch_id": sender_batch_id,
"email_subject": "You have a payment"
},
"items": [
{
"recipient_type": "EMAIL",
"amount": {
"value": 0.99,
"currency": "USD"
},
"receiver": "[email protected]",
"note": "Thank you.",
"sender_item_id": "item_1"
},
{
"recipient_type": "EMAIL",
"amount": {
"value": 0.90,
"currency": "USD"
},
"receiver": "[email protected]",
"note": "Thank you.",
"sender_item_id": "item_2"
},
{
"recipient_type": "EMAIL",
"amount": {
"value": 2.00,
"currency": "USD"
},
"receiver": "[email protected]",
"note": "Thank you.",
"sender_item_id": "item_3"
}
]
})
if payout.create():
print("payout[%s] created successfully" %
(payout.batch_header.payout_batch_id))
else:
print(payout.error)