我正在尝试测试 Python 和 Paypal 的集成。
这是我对 PayPal 模块的调用:http: //www.chickenwingsw.com/paypal-on-python
def testPayPal():
import paypal
PAYPAL_TEST_USERNAME = 'noeldo_1337351894_biz_api1.testacc.com'
PAYPAL_TEST_PASSWORD = '1337353453'
PAYPAL_TEST_SIGNATURE = 'AZ89-T17NMRVoILpOrfuXDv1jXZAlfJ0g5ZB76Rp5DNC010UYwxC2KS'
PAYPAL_TEST_SIG_URL = 'https://api-3t.sandbox.paypal.com/nvp'
paypal.SKIP_AMT_VALIDATION = True
pp = paypal.PayPal(PAYPAL_TEST_USERNAME, PAYPAL_TEST_PASSWORD, PAYPAL_TEST_SIGNATURE, PAYPAL_TEST_SIG_URL)
rresp = pp.DoDirectPayment(paymentaction='Sale',
ipaddress='127.69.56.20',
creditcardtype='Visa',
acct='4188161369058553',
expdate=paypal.ShortDate(2017, 5),
cvv2='111',
salutation='Mr',
firstname='Homer',
middlename='J',
lastname='Simpson',
suffix='GSTEST',
street='742 Evergreen Terrace.',
city='San Jose',
state='CA',
countrycode='US',
zip='95131',
phonenum='123-456-7890',
shiptostreet='742 Evergreen Terrace.',
shiptocity='San Jose',
shiptostate='CA',
shiptozip='95131',
shiptocountrycode='US',
amt='100.00',
currencycode='USD')
logging.info('testPayPal: got response %s' % resp)
运行时出现错误print(testPayPal())
PayPalException: ['由于地址无效,交易无法处理。']
我已经使用帐户类型 Website Payments Pro 设置了我的 Paypal 沙盒帐户。
任何帮助,将不胜感激。