无法使用PayPal模块处理交易 [英] Cannot process transaction using PayPal module

查看:106
本文介绍了无法使用PayPal模块处理交易的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试测试Python和Paypal集成.

I am trying to test Python and Paypal integration.

这是我到这里的PayPal模块的调用: http://www.chickenwingsw. com/paypal-on-python

Here is my call to the PayPal module I got here: 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:['由于地址无效,无法处理交易.'

PayPalException: ['The transaction cannot be processed due to an invalid address.']

我已经使用帐户类型Website Payments Pro设置了我的Paypal沙箱帐户.

I have setup my Paypal sandbox account using the account type Website Payments Pro.

任何帮助将不胜感激.

推荐答案

好吧, 奇怪的事情发生了.

Well, Strange thing happened.

在星期五尝试此操作,但没有成功,但在星期一和ta'da再次使用,成功了.

Was trying this on Friday and didn't work but came back to it on Monday and ta'da, it worked.

我在星期五将我的沙盒帐户设置为贝宝,所以不确定我是否需要等待,或者沙盒环境是否有问题.

I set my sandbox account with paypal on friday so not sure if I needed to wait or if there was an issue with the sandbox environment.

无论如何,如果有人在寻找示例,此代码应该可以工作.

Anyway, this code should work if anyone is looking for an example.

干杯.

这篇关于无法使用PayPal模块处理交易的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆