I have to connect payments via Pay Pal DoDirectPayment. Does anyone knows some tutorial on this or any kind of help would be great? The problem is that everything works fine offline but when I put online its not working well. The error message is 'transaction failed'. This is the error message i am getting:
-----------
object(stdClass)#6 (6) { ["Timestamp"]=> string(20) "2007-04-09T14:19:50Z" ["Ack"]=> string(18) "FailureWithWarning" ["CorrelationID"]=> string(13) "682b2af79229b" ["Errors"]=> array(2) { [0]=> object(stdClass)#7 (4) { ["ShortMessage"]=> string(95) "Transaction refused because of an invalid argument. See additional error messages for details." ["LongMessage"]=> string(23) "Order total is missing." ["ErrorCode"]=> string(5) "10400" ["SeverityCode"]=> string(5) "Error" } [1]=> object(stdClass)#8 (4) { ["ShortMessage"]=> string(95) "Transaction refused because of an invalid argument. See additional error messages for details." ["LongMessage"]=> string(23) "Item amount is missing." ["ErrorCode"]=> string(5) "10430" ["SeverityCode"]=> string(7) "Warning" } } ["Version"]=> string(8) "2.400000" ["Build"]=> string(6) "1.0006" }
What should I do exactly? The quote u isolated is already in the error message?? The problem here is that everything works fine offline but the trouble begins when its online?
I'm gonna need to see some code. When someone tries to buy something, what sort of code are you using to populate the fields that get passed? Item description? Price? Let's see the form that your building and using.
/** * List of Examples * * This file contains an example of how each operation is supposed to be carried out. * * I have commented out all the examples, simply uncomment the operations you wish to test * * The examples here are presented using fictitious data, to reproduce the results you will have * to substitute the equivalent data with those of your own. Thank you. * * You are required to sign up for your own API username, password and signature * * The examples will be in the following order for all the operations supported by this program: * * Simply include the file paypal_base.php and then you can go ahead to select any of the operations available * * * - DoDirectPayment * - SetExpressCheckout * - GetExpressCheckoutDetails * - DoExpressCheckoutPayment * * More of the API operations shall be supported in the subsequent versions of this program * * If you are interested in the source code, please visit the projects home page at [url]http://phppaypalpro.sourceforge.net/[/url] * * @author Israel Ekpo <perfectvista@users.sourceforge.net> * @copyright Copyright 2007, Israel Ekpo * @license [url]http://phppaypalpro.sourceforge.net/LICENSE.txt[/url] BSD License * @version 0.1 * @package PaypalBase * @filesource */
/* // SetExpressCheckout // On Success Will return a token with value like EC-7EG51014BE327234S // Customer should then be redirected by your server to URL like // [url]https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-7EG51014BE327234S[/url] // Customer will then enter payment at paypal.com and upon success customer will be sent back to the $ReturnURL // that you provided in the operation with the tokon and PayerID appended as parameters to the $ReturnURL //==========================================================================================================
if ($Paypal->success()) { var_dump($Paypal->getAPIResponse()); } else { var_dump($Paypal->getAPIException()); }
// GetExpressCheckoutDetails
// At the $Return URL get the ExpressCheckoutDetails by calling this operation using the token // The PayperID will be used in the next step, DoExpressCheckoutPayment // This operation returns all the details about the person making the payment (name, contact info etc) //==========================================================================================================
if ($Paypal->success()) { var_dump($Paypal->getAPIResponse());
} else { var_dump($Paypal->getAPIException()); }
// DoExpressCheckoutPayment // The $token and $PayerID are used in this operation to complete the transaction. // This is where the final Paypal Transaction ID like 4PJ31634YK772325W will be issued. //==========================================================================================================
$Paypal->addPaymentItem('Perfume for Ladies', 'Item Number 90887', 1, $tax1, $item1, $currencyId); $Paypal->addPaymentItem('Cologne for Gentlement', 'Item Number 90888', 1, $tax2, $item2, $currencyId); $Paypal->addPaymentItem('Toys for Kids', 'Item Number 90889', 1, $tax3, $item3, $currencyId);
// // TransactionSearch // Searching for a set of Transactions by passing certain criteria to the Paypal Webservice //==========================================================================================================
// GetTransactionDetails // Retrieves the Transaction Details for a specific transaction by passing certain criteria to the Paypal Webservice. // The details available here are better than those for the Transaction Search //========================================================================================================== */ $Paypal = $API->selectOperation('GetTransactionDetails');
$TransactionID = '11A317146P6709549';
$Paypal->setParams($TransactionID);
$Paypal->execute();
if ($Paypal->success()) { $response = $Paypal->getAPIResponse();