问题
I am trying to test Python and Paypal integration.
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)
I get an error when I run print(testPayPal())
PayPalException: ['The transaction cannot be processed due to an invalid address.']
I have setup my Paypal sandbox account using the account type Website Payments Pro.
Any help would be appreciated.
回答1:
Well, Strange thing happened.
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.
Cheers.
来源:https://stackoverflow.com/questions/10656603/cannot-process-transaction-using-paypal-module