close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Send fixed deposit price to PayPal

Thread began 12/10/2010 8:46 am by Heckie | Last modified 12/17/2010 11:33 am by Jason Byrnes | 2114 views | 6 replies |

Heckie

Send fixed deposit price to PayPal

I have set up a shopping cart using eCart 5.2 for a heating supply company using PayPal Pro UK. Heres the link to the product page: index.php

The way it works is that customer only has to pay a £25 deposit to book an installation, then the balance on completion to the installer (separate invoice).

The cart is quite complex in that there are separate rates of VAT for different products, but I have managed to set it up to calculate and display everything correctly and it works!!

What I need to do however is let the customer only pay the £25 deposit.

Is there a way to set a fixed price in the code that passes to PayPal?

Sign in to reply to this post

Dave BuchholzBeta Tester

I think what I would do is hard code the deposit as the amount sent to paypal as it is always the same, look for this code on the confirm page:

php:
$PP_PayProUK_itemized[0][0] = "AMT";
  $PP_PayProUK_itemized[1][0] = "".$eCart1->GrandTotal()  ."";



and change it to:

php:
$PP_PayProUK_itemized[0][0] = "AMT";
  $PP_PayProUK_itemized[1][0] = ""."25.00"  ."";



you will also need to amend the PayPal Express Checkout code as well and allow for this in your admin system

One thing I noticed is that when I added a boiler to the checkout is was subject to 5% vat bit against the deposit amount you say inc. 17.5% vat ?

Nice site by the way

Sign in to reply to this post

Heckie

Thanks!

I thought it was that line of code, but I had used the wrong syntax!

Regarding the VAT - The products themselves are subject the 5% VAT, but the deposit is subject to full rate so that is correct (or at least how the client wants it)!

Sign in to reply to this post

Heckie

Cant seem to get this to work - getting the following error:

Direct Pay Full Response:
Transaction refused because of an invalid argument. See additional error messages for details.The totals of the cart item amounts do not match order amounts.10413Error60.016207250.02

PayPal Express Checkout requests and responses :
Transaction refused because of an invalid argument. See additional error messages for details. The totals of the cart item amounts do not match order amounts. 10413Error63.01613293

Heres my PHP code:

<?php
$WA_PP_ECO_SetResult = WA_PP_ECO_SOAPObject();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WA_PP_ECO_Set_params = array();
$WA_PP_ECO_Set_params[0] = array();
$WA_PP_ECO_Set_params[1] = array();
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "Username";
$WA_PP_ECO_Set_params[1][$nextIndex] = "xxxxxxxxxx";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "Password";
$WA_PP_ECO_Set_params[1][$nextIndex] = "xxxxxxxxxx";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "Signature";
$WA_PP_ECO_Set_params[1][$nextIndex] = "xxxxxxxxxx";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "System";
$WA_PP_ECO_Set_params[1][$nextIndex] = "WPPro";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "Currency";
$WA_PP_ECO_Set_params[1][$nextIndex] = "GBP";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "OrderTotal";
$WA_PP_ECO_Set_params[1][$nextIndex] = "".$ecartNRG->GrandTotal() .""; //*********IS THIS WHAT I CHANGE?************//

$WA_PP_ECO_Do_itemized = array();
$WA_PP_ECO_Do_itemized[0] = array();
$WA_PP_ECO_Do_itemized[1] = array();
$cartIndex = 0;
while ( !$ecartNRG->EOF() ) {
$nextIndex = count($WA_PP_ECO_Do_itemized[0]);
$WA_PP_ECO_Do_itemized[0][$nextIndex] = "Amount" . strval($cartIndex+1) . "";
$WA_PP_ECO_Do_itemized[1][$nextIndex] = "".$ecartNRG->DisplayInfo("Price") ."";
$nextIndex = count($WA_PP_ECO_Do_itemized[0]);
$WA_PP_ECO_Do_itemized[0][$nextIndex] = "Name" . strval($cartIndex+1) . "";
$WA_PP_ECO_Do_itemized[1][$nextIndex] = "".$ecartNRG->DisplayInfo("Name") ."";
$nextIndex = count($WA_PP_ECO_Do_itemized[0]);
$WA_PP_ECO_Do_itemized[0][$nextIndex] = "Number" . strval($cartIndex+1) . "";
$WA_PP_ECO_Do_itemized[1][$nextIndex] = "".$ecartNRG->DisplayInfo("ID") ."";
$nextIndex = count($WA_PP_ECO_Do_itemized[0]);
$WA_PP_ECO_Do_itemized[0][$nextIndex] = "Quantity" . strval($cartIndex+1) . "";
$WA_PP_ECO_Do_itemized[1][$nextIndex] = "".$ecartNRG->DisplayInfo("Quantity") ."";
$nextIndex = count($WA_PP_ECO_Do_itemized[0]);
$WA_PP_ECO_Do_itemized[0][$nextIndex] = "Tax" . strval($cartIndex+1) . "";
$WA_PP_ECO_Do_itemized[1][$nextIndex] = "";
$ecartNRG->MoveNext();
$cartIndex ++;
}
$ecartNRG->MoveFirst();
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "ItemTotal";
$WA_PP_ECO_Set_params[1][$nextIndex] = "".$ecartNRG->TotalColumn("TotalPrice") ."";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "TaxTotal";
$WA_PP_ECO_Set_params[1][$nextIndex] = "".$ecartNRG->GetTax() ."";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "ShippingTotal";
$WA_PP_ECO_Set_params[1][$nextIndex] = "".$ecartNRG->GetShipping() ."";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "HandlingTotal";
$WA_PP_ECO_Set_params[1][$nextIndex] = "".$ecartNRG->GetCharges() - $ecartNRG->GetDiscounts() ."";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "ReturnURL";
$WA_PP_ECO_Set_params[1][$nextIndex] = "http://77.92.68.215/~nrgsavin/installation/pp_confirm.php";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "CancelURL";
$WA_PP_ECO_Set_params[1][$nextIndex] = "http://77.92.68.215/~nrgsavin/installation/pp_cancel.php";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "PaymentAction";
$WA_PP_ECO_Set_params[1][$nextIndex] = "Authorization";

$WA_PP_ECO_SetResult = WA_PP_ECO_Set_Post($WA_PP_ECO_Set_params,$WA_PP_ECO_Do_itemized);
if ($WA_PP_ECO_SetResult->isError) {
if ("pp_checkout_failure.php" != "") {
header("Location: ". "pp_checkout_failure.php"); exit;
}
}
else {
$ecartNRG->redirStr = $WA_PP_ECO_SetResult->ECOServer;
}
}
?>
Sign in to reply to this post

Jason ByrnesWebAssist

yu cant just change the grand total that is passed.


you need to change all of the prices that are passed:
$WA_PP_ECO_Set_params[0][$nextIndex] = "OrderTotal";
$WA_PP_ECO_Set_params[1][$nextIndex] = "".$ecartNRG->GrandTotal() ."";


$WA_PP_ECO_Do_itemized[0][$nextIndex] = "Amount" . strval($cartIndex+1) . "";
$WA_PP_ECO_Do_itemized[1][$nextIndex] = "".$ecartNRG->DisplayInfo("Price") ."";


$WA_PP_ECO_Set_params[0][$nextIndex] = "ItemTotal";
$WA_PP_ECO_Set_params[1][$nextIndex] = "".$ecartNRG->TotalColumn("TotalPrice") ."";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "TaxTotal";
$WA_PP_ECO_Set_params[1][$nextIndex] = "".$ecartNRG->GetTax() ."";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "ShippingTotal";
$WA_PP_ECO_Set_params[1][$nextIndex] = "".$ecartNRG->GetShipping() ."";
$nextIndex = count($WA_PP_ECO_Set_params[0]);
$WA_PP_ECO_Set_params[0][$nextIndex] = "HandlingTotal";
$WA_PP_ECO_Set_params[1][$nextIndex] = "".$ecartNRG->GetCharges() - $ecartNRG->GetDiscounts() ."";


paypal looks at the grand total, the itemized amount * itemized quantity, the item total, tax total shipping total and handling total and makes sure they all add up correctly.


you will need to do some unsupported custom coding to get this working the way you want it to.

Sign in to reply to this post

Heckie

I gave it a shot and managed to get it working with custom columns and calculations - didn't need any hand coding - did it all through the eCart Behaviour panel.

Sign in to reply to this post

Jason ByrnesWebAssist

OK, glad to hear you have it working.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...