我是Paypal SDK的新手,我想从交易ID中获取付款详情,我的代码如下:
import libs.paypalrestsdk as Paypals
api = Paypals.configure({
"mode": "sandbox",
"client_id": "MY-CLIENT_ID",
"client_secret": "MY-SECRET"
})
payment = Paypals.Payment.find("5LA50068PM345884U")
如何执行?
如何通过我的client_id和秘密在交易中使用?
答案 0 :(得分:1)
我使用 PayPal Classic API 来获取PayPal交易详情:
pip install paypal
from paypal import PayPalInterface
paypal_api = PayPalInterface(
API_USERNAME = username,
API_PASSWORD = secret,
API_SIGNATURE = signatur,
API_ENVIRONMENT = environment,
DEBUG_LEVEL=0,
HTTP_TIMEOUT=30
)
transaction_details = paypal_api._call(
'GetTransactionDetails',
TRANSACTIONID=transaction_id
)
并回答你的问题:
答案 1 :(得分:1)
pip install paypalrestsdk
import paypalrestsdk
sdk_mode = 'sandbox'
paypal_client_id = "paypal_client_id"
paypal_client_secret = "paypal_client_secret"
paypal_api = paypalrestsdk.Api({
'mode': sdk_mode,
'client_id': paypal_client_id,
'client_secret': paypal_client_secret})
payment = paypalrestsdk.Payment.find("pay-xxx1233", api=paypal_api)