python: 获得PayPal Transaction信息,payment 信息(GetTransactionDetails API), python paypal nvp

 

安装 python 的paypal的库:

https://github.com/paypal/PayPal-Python-SDK

要求: Python 2.6 or 2.7 +

 

安装:

pip install paypal

## or easy_install:
# easy_install paypal

## or download the source, un-tar/un-zip it, cd into paypal-python, and:
# python setup.py install

 

申请 NVP/SOAP 开发账户

参考:python: 获得PayPal余额(GetBalance API), python paypal nvp

 

然后创建文件 paypal_nvp.py

#!/usr/bin/env python
# coding=utf-8

# link: https://github.com/gtaylor/paypal-python
# Installation : sudo pip install paypal

from paypal import PayPalInterface
import json

# configs is related to below link:
# https://github.com/gtaylor/paypal-python/blob/aa7a987ea9e9b7f37bcd8a8b54a440aad6c871b1/paypal/settings.py

paypal_api = PayPalInterface(
    API_USERNAME='your-username',
    API_PASSWORD='your-password',
    API_SIGNATURE='your-signature',
    API_ENVIRONMENT='SANDBOX',  # ['SANDBOX', 'PRODUCTION'],
    API_AUTHENTICATION_MODE='3TOKEN', # ['3TOKEN', 'CERTIFICATE']
    DEBUG_LEVEL=0,
    HTTP_TIMEOUT=30
)

# https://developer.paypal.com/docs/classic/api/merchant/GetRecurringPaymentsProfileDetails_API_Operation_NVP/

# balance_details = paypal_api._call('GetBalance')
# print(balance_details)
# print(balance_details['L_AMT0'] + ' ' + balance_details['L_CURRENCYCODE0'])

# pal_details = paypal_api._call('GetPalDetails')
# print(pal_details)

transaction_details = paypal_api._call(
    'GetTransactionDetails',
    TRANSACTIONID = 'your-transaction-id-string'
)

print(transaction_details)

 

 

python: 获得PayPal Transaction信息,payment 信息(GetTransactionDetails API), python paypal nvp
python: 获得PayPal Transaction信息,payment 信息(GetTransactionDetails API), python paypal nvp

 

API操作

  • AddressVerify – 验证帐户持有人的地址和邮政编码。这是一个限制版API。要确定您是否可以使用此限制版API,请与您的PayPal集成团队联系。
  • GetTransactionDetails – 检索有关交易的信息。您指定交易ID,返回的信息包括:交易日期,金额,状态等。使用GetTransactionDetails 使用NVP / SOAP API时。
  • GetBalance – 显示PayPal帐户的可用余额。
  • PaymentDetails – 允许您开发显示自定义付款信息的应用:发件人电子邮件,货币,即时付款通知URL,付款状态等等。跟踪ID,IPN交易ID或付款密钥指定您想要的付款。使用Adaptive API时使用PaymentDetails。

 

更多参考:

python: 获得PayPal余额(GetBalance API), python paypal nvp

 

本文:python: 获得PayPal Transaction信息,payment 信息(GetTransactionDetails API), python paypal nvp

Loading

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.