I've built myself a nice, simple little store to sell some stuff I've got laying around and some nice jewelry I got last week. I would like to give users the option to pay with PayPal exclusively (since it will also process CC's I figure that's all I really need). The problem is that the paypal website has crap for instructions, very unclear without proper examples or code samples or anything. It's been very frustrating for me.
So I think I've got a general idea of how the API works and now I am at the first step of my code where I am just trying to get anything to work with the API. I keep getting ACK=Failure.
For testing purposes I am using CURL :)
$url = "https://api-3t.sandbox.paypal.com/nvp"; $post = "METHOD=SetExpressCheckout&"; $post .= "VERSION=53.0&"; $post .= "USER=sdk-three_api1.sdk.com&"; // sandbox info $post .= "PWD=QFZCWN5HZM8VBG7Q&"; // sandbox info $post .= "SIGNATURE=A-IzJhZZjhg29XQ2qnhapuwxIDzyAZQ92FRP5dqBzVesOkzbdUONzmOU&"; // sandbox info $post .= "PAYMENTREQUEST_0_AMT=10.00&"; $post .= "PAYMENTREQUEST_0_CURRENCYCODE=USD&"; $post .= "RETURNURL=".$settings['site']['url'].urlencode("?page=cart&msg=completed")."&"; $post .= "CANCELURL=".$settings['site']['url'].urlencode("?page=cart&msg=canceled")."&"; $post .= "PAYMENTREQUEST_0_PAYMENTACTION=Sale&"; $post .= "TOTALORDER=10.00&"; // Here is my custom CURL function in which returns the results of the post to the API echo "<pre>".urldecode(str_replace("&","<br />",getpage($url,$post,"cookie.txt")))."</pre>";
I formatted this for easy reading, but here is what it returns:
L_SHORTMESSAGE0=Transaction refused because of an invalid argument. See additional error messages for details.
L_LONGMESSAGE0=Order total is missing.
I looked up error 10400 and it just says "Total Order is missing" with no other explanation. Clearly Total Order is there, so I don't know what to do. I'd call Paypal but there isn't anyone there ATM.
I've followed the instructions on PayPals "Getting started with Express Checkout" (https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECGettingStarted), clearly there is something missing.
If you have any experience with PayPal API I'd appreciate your input. I'd like to get this finished by tomorrow so I can (hopefully) make some money for rent. Kind of in a hard place right and need to get this going as I've people waiting to buy!