Zen Cart Logo
Forums / PayPal Express Checkout support / Significantly changing information sent to Paypal using Express Checkout

Significantly changing information sent to Paypal using Express Checkout

Views: 3,055

Results 1 to 4 of 4
14 Jan 2013, 6:07 PM
#1
jtgrocery avatar

jtgrocery

New Zenner

Join Date:
Jan 2013
Posts:
2
Plugin Contributions:
0

Significantly changing information sent to Paypal using Express Checkout

running version: v1.5.1, No upgrades
I've looked extensively in FAQ and forums with no luck on this question.

I am a new Zencart user. I'm running a small delivery company. On Zen cart, I supply the delivery cost of each item, but I don't know the actual cost of the item until I purchase it. I purchase, but the customer usually has a better idea of the item cost than I do. I therefore want the customer to "authorize" funds using Paypal, when I deliver goods, I will explain the total cost in person (goods plus the delivery) and "capture" funds when the customer receives products.

I had the Paypal Standard "button" installed with a "authorization" with a set amount as part of the button, but this forces the customer to need to accomplish two steps. 1. Go to a page with the "button" and go through the Paypal process. 2 Check out. It would be much less confusing to the customer to use the Paypal Express Checkout so that Paypal was part of the check out process.

I have successfully installed Paypal express checkout, but I'm unable to make it pass the information I want.

In short, during checkout I want to pass specific information to Paypal different than supplied by Zen. It would be the same every time (all purchases). For example:

  1. That this is an "authorization" rather than "sale". (I found and updated this in admin during the paypal Express Checkout install, it is operating correctly)
  2. The product name sent to Paypal should always be "authorization of funds for requested purchase"
  3. The price sent to Paypal should always be $250.

I understand the basics of PHP, and I've changed a couple little things to my page. I assumed to accomplish 2 and 3 I would just track down the thing that passed the "total" and "products" to Paypal and supply an amount and description in their place. I assumed it would be in /includes/modules/payment/paypalwpp.php Not so easy to figure out. I have been unable to unravel what variable or where it is being passed.

Where (file and location in file) would I change so that I could change these two things (amount and product) as they are sent to Paypal?

Is this is simple as I think it should be? It's my last step before I take my first Zencart "live". :smile: Thanks.

15 Jan 2013, 12:18 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Significantly changing information sent to Paypal using Express Checkout

The getLineItemDetails() function in that file is what prepares the details of line items and prices submitted to PayPal for Express Checkout.

17 Jan 2013, 2:16 AM
#3
jtgrocery avatar

jtgrocery

New Zenner

Join Date:
Jan 2013
Posts:
2
Plugin Contributions:
0

Re: Significantly changing information sent to Paypal using Express Checkout

Thank you very much for the inforation.

I must admit that even with that information I've spent a couple of days and was unable to figure it out. My knowledge of arrays is much weaker than the person that wrote the code.

I'm assuming that the value has to be changed just before:

$options = $this->getLineItemDetails($this->selectCurrency($order->info['currency']));

(app line 278)

I looked at the logs that I was getting back to try to figure our what part of the array to change. I may be misinterpreting the results. I thought it must be

$info['DESC']= 'some description';
$info['AMT']= 250.00;
or
$order_amount = 250;

or
$order['DESC']= 'some description';
$order['AMT']= 250.00;

I tried moving these around as I thought the problem might be the error check that occurs further down. Sometimes it wouldn't change the amount, sometimes it would error out. I never got the description to change. I feel like I've tried every possible combination of every way of putting in into the array, but I keep getting back errors.

17 Jan 2013, 3:37 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Significantly changing information sent to Paypal using Express Checkout

There are a LOT of checks and balances to ensure that the amounts prepared for sending to PayPal actually match the exact amounts the are in the order that the customer has prepared in their shopping basket.
It gets quite complicated when you suddenly want to throw all that away and charge (or even just authorize, as you say you're trying to do on) the customer an amount completely different from what they're purchasing.

Another way you could tackle it (without having to make big programming changes) would be to change the name of the Low Order Fee module (Maybe call it "authorization of funds", like you mentioned before), set the threshold to $225 and the fee amount to $50 and simply use that to add an extra flat amount to the customer's order. At least that way you could always add yourself a buffer of maybe $50 to handle whatever problem you're trying to solve here.