forked from glim/rest-api-sdk-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute.py
More file actions
17 lines (14 loc) · 674 Bytes
/
execute.py
File metadata and controls
17 lines (14 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# # Execute an approved PayPal payment
# Use this call to execute (complete) a PayPal payment that has been approved by the payer.
# You can optionally update transaction information by passing in one or more transactions.
# API used: /v1/payments/payment
from paypalrestsdk import Payment
import logging
logging.basicConfig(level=logging.INFO)
# ID of the payment. This ID is provided when creating payment.
payment = Payment.find("PAY-28103131SP722473WKFD7VGQ")
# PayerID is required to approve the payment.
if payment.execute({"payer_id": "DUFRQ8GWYMJXC"}): # return True or False
print("Payment[%s] execute successfully"%(payment.id))
else:
print(payment.error)