Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

PayPal Integration


Reply


23 Posts   6105 Views

Avatar
Jedateach

Forum Moderator, 232 Posts

25 April 2011 at 1:34pm

what version of ecommerce are you using? ...I'm suspecting this is the problem.

You shouldn't need the test module.

Avatar
theoldlr

Community Member, 103 Posts

26 April 2011 at 3:04am

Jedatech,

I'm using the .8.1rc1 version of ecommerce. My site is now using the payment_paypal module, and I got it working to the extent that I get errors in the debug.log as described in the README, but I keep getting "You do not have permissions to make this API call" errors. I looked the error up in the paypal API, and this is supposedly caused by using the wrong paypal endpoint, or the wrong API username/password/signature. Well I triple checked each of those, and tested my API credentials using this simple form provided by paypal (with my credentials plugged in):

<form method=post action=https://api-3t.sandbox.paypal.com/nvp>
<input type=hidden name=USER value=yourAPIusername>
<input type=hidden name=PWD value=yourAPIpassword>
<input type=hidden name=SIGNATURE value=yourAPIsignature>
<input type=hidden name=VERSION value=71.0>
<input type=hidden name=METHOD value= SetExpressCheckout>
Amount: <input name=PAYMENTREQUEST_0_AMT value=1.00>
<input type=hidden name=RETURNURL value="http://www.paypal.com">
<input type=hidden name=CANCELURL value="http://www.paypal.com">
<input type=hidden name=PAYMENTREQUEST_0_PAYMENTACTION value=Sale>
<input type=hidden name=PAYMENTREQUEST_0_CURRENCYCODE value="USD">
<input type=submit value=SetExpressCheckout>
</form>

Using this form I get a proper, successful response, but I'm having no luck with the module. I'm using the PayPalExpressChecoutPayment::set_config_details with my credentials as outlined in the README, and I've debugged enough to see that they are being used by the module. I'm really not sure what's not working right here... Here is the debug.log entry (with my api info removed):

PayPal Debug:
Mode: test
API url: https://api-3t.sandbox.paypal.com/nvp
Redirect url: https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=TOKENGOESHERE&useraction=commit
Username: APIUsername
Password: APIPassword
Signature: APISignature
Response Array
(
[TIMESTAMP] => 2011-04-25T14:42:47Z
[CORRELATIONID] => 1bab0366ae004
[ACK] => Failure
[VERSION] => 0.000000
[BUILD] => 1838679
[L_ERRORCODE0] => 10002
[L_SHORTMESSAGE0] => Authentication/Authorization Failed
[L_LONGMESSAGE0] => You do not have permissions to make this API call
[L_SEVERITYCODE0] => Error
)

Thanks!

Avatar
Jedateach

Forum Moderator, 232 Posts

26 April 2011 at 11:30am

You're definitely using the right username/password....generated from within your sandbox account? (not the sandbox account itself)

Avatar
theoldlr

Community Member, 103 Posts

13 May 2011 at 4:05am

Yes, I definitely have the right sandbox creds as they worked when using the simple form paypal support provided (see my previous post in this thread). I have no idea what else to try or check... this is now a fresh SS install.

Here is the $postfields array that is sent to the RESTful request in PayPalExpressCheckoutPayment ~ line341

VERSION   64
USER   CORRECT SANDBOX USERNAME
SOLUTIONTYPE   Sole
SIGNATURE   CORRECT SANDBOX SIGNATURE
RETURNURL   http://sl/PaypalExpressCheckoutaPayment_Handler/confirm
PWD   CORRECT SANDBOX PWD
PAYMENTREQUEST_0_SHIPTOZIP   49203
PAYMENTREQUEST_0_SHIPTOSTREET2   
PAYMENTREQUEST_0_SHIPTOSTREET   2080 Brooklyn Road
PAYMENTREQUEST_0_SHIPTOPHONENUM   
PAYMENTREQUEST_0_SHIPTONAME   Default Admin Robinson
PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE   US
PAYMENTREQUEST_0_SHIPTOCITY   Jackson
PAYMENTREQUEST_0_CURRENCYCODE   USD
PAYMENTREQUEST_0_AMT   25
NOSHIPPING   1
METHOD   SetExpressCheckout
LANDINGPAGE   Billing
EMAIL   REPLACEEMAIL@MYDOMAIN.com
CANCELURL   http://sl/PaypalExpressCheckoutaPayment_Handler/cancel
BUTTONSOURCE   NULL

Still getting the same error--Paypal could not be contacted and "Authentication/Authorization Failed" in debug.log

I have used RESTful service on this machine before, so I don't think it's a curl problem. Any ideas?
Thank you!!!

Avatar
theoldlr

Community Member, 103 Posts

28 May 2011 at 6:00am

I never found the EXACT solution to why I couldnt connect to paypal on my local test machine, but I did discover that it was the test machine causing the problem. Just an FYI for anyone else that runs into this.

Avatar
GRiiDWeb

Community Member, 60 Posts

30 May 2011 at 3:46am

Hi,
I'm very close now to having things in place.
Could anyone guide me as to how the PayPal API code should look in the /config file?
I have all my API usernames, etc and ready to input them. It's just the last little bit I'm stuck on.

Thanks again

G

Avatar
Jedateach

Forum Moderator, 232 Posts

30 May 2011 at 4:37pm

@GRiiDWeb: Whats the specific issue you're having?

Avatar
GRiiDWeb

Community Member, 60 Posts

30 May 2011 at 8:32pm

There are 2 current issues. It may be my limited programming skills that make me miss the obvious.
Completed so far are the installation of the e-commerce (very latest) module and the Payment module. Changes to the module of recent mean that the code -

Payment::set_supported_methods(array(
'PayPalPayment' => 'PayPal',
));

if(Director::isLive()) {
PayPalPayment::set_account_email('example@mail.co.uk');
}
else {
PayPalPayment::set_test_mode('example@mail.co.uk');
}

no longer redirects to PayPal, but gets 'stuck'. So leaving that for the moment I have installed your new PayPal Payment module. Suggested in the Forum to use was -

Payment::set_supported_methods(array(
'PayPalPayment' => 'Paypal Payment', //old paypal payment
'PayPalExpressCheckoutPayment' => 'Paypal Express Checkout' //new paypal payment module -- needs to be included
));

so can switch to PayPal Express (however both types of PayPal show in checkout). I have requested all my API details from PayPal. What I seem to be missing is the know how of where to put the API details and what to set in the mysite/config. Currently I just get a 500 error.

As you may remember, I've beena keen follower of this project. I have a working version of commerce, but without the shipping modifiers, which is the thing I really could do with.

Your expert guidence is appreciated.

GW