Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Authorize.net amount charged does not match total in OSC


webdesignpro

Recommended Posts

On a site that's in the final phase of testing before going live in the next couple of days, my client just switched authoriznet from TEST to LIVE mode... and made this observation:

 

While at Authorize.net I noticed that the dollar values being charged there did not match the dollar values totaled and reported on the checkout page of the web site. For example, a test order was charged $25.31 according to Authorize.net and only $23.86 according to the checkout page. The difference, $1.45, is exactly equal to the "resellers discount" that I set up for you. So it would seem that Authorize.com is not getting our total after the resellers discount is subtracted.

 

However, It is slightly more confusing and complicated than that. One customer (look at the Invoice in OScommerce) was charged $77.49 by Authorize.net and only $70.52 at our website. The difference is only partially explained by the "resellers discount" of $6.70 (70.52 + 6.70 = $77.22 -- not the $77.49 charged by Authorize.net). Somehow there was an additional $.27 charged to Pegs credit card account for some unknown reason. Likewise, Peg's smaller order of $38.70 from MBT resulted in a charge of $42.18 at Authorize.net -- the difference amounts to the "resellers discount" of $3.35 plus an additional $.13 ??.

 

1) We need to make sure that Authorize.net sees our bottom line total which includes the "resellers discount"

 

2) We need to figure out where the extra 27 cents and 13 cents are coming from.

 

I've added a the Members Discount Module that gives a 10% discount to approved wholesale buyers. Apparently the reduced total is not being transmitted to authorizenet. I'm not sure where the other numbers are coming from, but it might be the 4% tax on the higher non-discounted final price.

 

The site is at http://www.my-big-toe.com, so please take a look if you have an idea what might be causing the problem.

 

Thanks!

--

Harold Corbin

Link to comment
Share on other sites

  • 4 weeks later...

Have you found any solutions yet? I have a similar problem, I need to add in an insurance amount.

 

I have been successful in using a total module, ot_insurance.php (based upon ot_loworderfee.php) in the total_amount modules. It works well, all calculations are right and the totals come out correctly. The OSC saves it, and the invoice and data all are right... :)

 

BUT the authorize net direct payment module does not add the insurance total to the amount it charges my customers... :( Everything else is in the total.

 

In authorize_direct.php, $order->info['total'] is used to pass the total in the authorize_direct.php to the variable x_Amount. However, after the pass, it still does not include the total from the ot_insurance.php somehow... even though that amount is in the total amount on the screen, in the database, and everywhere else. :roll:

 

Perhaps Bao Nguyen can help here... he suggested creating a global variable to the guy who uses gift certificates, but I could not quite follow his logic:

 

http://www.oscommerce.com/forums/viewtopic.php...ize+total#90922

 

It would seem in your case you should create a global variable (such as $discount) containing the discount amount, then pass that to the authorize_direct.php and use a line something like:

 

x_Amount => number_format($order->info['total'] , 2)- $discount,

 

and that would do it...

 

:oops: I am sorry I can't tell you how to do all that, but if you figure out how, please let me know so I can do it for my insurance add in...

 

Richard

Link to comment
Share on other sites

when you calculate these discounts and changes in price, are you updating the price for the order back in the database or simply doing the calculations in the code?

Link to comment
Share on other sites

jchasick...

 

Thanks so much for trying to help. I really appreciate the quick response.

 

I am calculating the insurance amount on the total during the checkout_confirmation.php phase where the totals are brought in from the /includes/mocules/order_total/ modules.

 

The shipping insurance shows up right, and is included in the total shown. The order of themodules iis right as set in the admin->modules->order total page. The totals for each module is correct, including shipping insurance.

 

When you hit the "confirm order" button and go to checkout_process.php everything seems to go fine, the order is saved, the right thank you comes up, the order is correctly entered in the database, the invoice prints right... everything goes well...

 

EXCEPT that the amount passed to the authorize_direct.php does not include the shipping insurance amount.

 

Hope that helps you...?

 

Also see my post I sent during the few minutes while you were answering:

 

http://www.oscommerce.com/forums/viewtopic.php?t=37392

 

Thanks again,

 

Richard

Link to comment
Share on other sites

if you know how to use phpmyadmin go into your db and look at the records for those sales and see if that information was posted back to the db - my suspicion is that you are calculating these correctly in your code mods, but you are not writing the data back to the db before completing the order so you are left with the original data, not the modified data - while going thru the process you are seeing the values in the global variables being passed along the chain, but that doesnt mean it has been written to the db

 

just a stab at a potential problem without looking at the code (which I really dont have the time to do right now......)

Link to comment
Share on other sites

the code in authorizenet_direct.php that you want to check values being passed is

 

x_Amount => number_format($order->info['total'], 2),

 

 

do you have a test site or just the live site?

 

you could put in an

 

echo number_format($order->info['total'],2); or

print number_format($order->info['total'],2);

 

to view the value being passed before

 

$form_data = array(

Link to comment
Share on other sites

Good idea for starters... but:

 

The authorize_direct.php does not print back to a page unfortunately, so cannot be queried so easily. However, the amount that is ULTIMATELY posted to authorize net is ALWAYS incorrect, it does not include the insurance amount in the total.

 

 

I viewed the $order->info['total'] value using the same lines you suggest in checkout_confirmation.php during and after totaling.... and in the order_total modules. At each stage of totalling, including ot_insurance.pgp, it added in ALL the parts to the $order->info['total'].

 

If I print the value of number_format($order->info['total'],2) at the point when it is time to confirm the order while in checkout_confirmation.php, the value is RIGHT... it includes the shipping insurance. That is what is so confusing.

 

This seems to mean that there is some kind of RE-totalling going on AFTER the "confirm order" button is pressed and before the payment module is run...

 

Bao Nguyen addresses some of this in the following post, but I can't quite understand his solution...

 

http://www.oscommerce.com/forums/viewtopic.php?t=29922

 

Clues here?

 

Thanks again,

 

Richard

Link to comment
Share on other sites

put a exit; towards the end of the module so it stops before completing/before the call to authorizenet itself - this should allow the information to get posted on screen

 

it looks he is saying basically the same thing I am, except that the calculations need to be done before the information gets passed to the authnet module:

 

 

// *** Subtract that gift discount and assign new value ****

$order->info['total'] = $order->info['total'] - $gift_discount_amount;

 

//************************************************************

// Authorizenet ADC Direct Connection

// Make sure the /catalog/includes/class/order.php is included

// and $order object is created before this!!!

if(MODULE_PAYMENT_AUTHORIZENET_STATUS) {

include(DIR_WS_MODULES . 'authorizenet_direct.php');

}

//************************************************************

 

 

it is very strange that you can track that variable all the way up to that point and it is showing the correct info and then it changes at the end :?

 

it has to be something really simple that i am overlooking here...

Link to comment
Share on other sites

Ok...

 

I added: print number_format($order->info['total'],2);

 

in checkout_confirmation.php following lines <> 220:

if (MODULE_ORDER_TOTAL_INSTALLED) {

$order_total_modules->process();

echo $order_total_modules->output();

// added

print number_format($order->info['total'],2);

}

--------------------

And I added it again with an exit; in authorize_direct.php at the end of the formdata() array declaration:

 

x_Description => 'Your Products Description',

tep_session_name() => tep_session_id());

//added

print number_format($order->info['total'],2);

exit;

-----------------

Output on the confirm order page is $495.93 which includes shipping insurance (listed right after shipping) of $2.00...

 

Output on exit from authorize_direct.php: 493.93... lost the shipping insurance amount.

 

Sometime between the call to checkout_process.php and the payment module processing there has to be a recalculation of $order->info['total']

 

Beats me where...

 

I have not tried this with any other payment modules except mail order, which works ok.

 

Continuing thanks...

 

Richard

Link to comment
Share on other sites

If I remember correctly the authorize.net contribution includes a file at the top of checkout_process.php

 

This sets up some authorize.net variables from the order->info array.

 

Unfortunately it is usually included before the include for the order_total modules. As these have not been initiated then they wont have a chance to adjust order->info['total'] etc.

 

The solution is to move the placement of code so the order_total modules are included and instantiated first.

Trust me, I'm an Accountant.

Link to comment
Share on other sites

Thank you Ian, we are getting closer to the solution... but not yet.

 

I, checkout_process.php, I tried to put these lines:

 

// load the before_process function from the payment modules

$payment_modules->before_process();

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

$order_totals = $order_total_modules->process();

//

 

ABOVE

 

//************************************************************

// Authorizenet ADC Direct Connection

// Make sure the /catalog/includes/class/order.php is included

// and $order object is created before this!!!

if(MODULE_PAYMENT_AUTHORIZENET_STATUS) {

include(DIR_WS_MODULES . 'authorizenet_direct.php');

}

//************************************************************

 

BUT, it drops out back to checkout_payment.php with a "a problem processing your credit card..." error.

 

An "exit;" added in the first lines of authorize_direct.php doesn't ever get called... so it does not processes the authorizenet_direct.php. It seems that the the order that Bao Nguyen states for events is necessary.

 

If I process the ADC module include in his order, it gets there and exits as expected... changing the order of includes and requires every way I could did not change the dropping out... the only way it processed through was to have it in the original order Bao created.

 

However, as you point out, the checkout_process.php does total the orders AFTER the ADC module is done setting up its own variables. So that is the problem, but what is the solution...?

 

Thanks Ian,

 

Richard

Link to comment
Share on other sites

You proabaly should not have moved

 

$payment_modules->before_process();

 

just

 

$order_total_modules = new order_total;

$order_totals = $order_total_modules->process();

Trust me, I'm an Accountant.

Link to comment
Share on other sites

I appreciate your help, men.

 

Amazing, I tried it every way I could... even dropped the whole ADC entry down a line at a time, and it would still drop out....

 

But when I started from a fresh copy of checkout_process.php and modified it , the thing then took off and now seems to work right... 8) THANKS, IAN.

 

Here is what did the trick in checkout_process.php around line 35:

 

Original as per Bao Nguyen's installation:

 

// load selected payment module

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment($payment);

 

// Need to be included before Authorizenet ADC Direct Connection

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

 

//************************************************************

// Authorizenet ADC Direct Connection

// Make sure the /catalog/includes/class/order.php is included

// and $order object is created before this!!!

if(MODULE_PAYMENT_AUTHORIZENET_STATUS) {

include(DIR_WS_MODULES . 'authorizenet_direct.php');

}

//************************************************************

 

// load the before_process function from the payment modules

$payment_modules->before_process();

 

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

 

$order_totals = $order_total_modules->process();

 

$sql_data_array = array('customers_id' => $customer_id,

 

----------------------------------

The changed code:

// load selected payment module

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment($payment);

 

// Need to be included before Authorizenet ADC Direct Connection

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

 

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

 

$order_totals = $order_total_modules->process();

 

//************************************************************

// Authorizenet ADC Direct Connection

// Make sure the /catalog/includes/class/order.php is included

// and $order object is created before this!!!

if(MODULE_PAYMENT_AUTHORIZENET_STATUS) {

include(DIR_WS_MODULES . 'authorizenet_direct.php');

}

//************************************************************

 

// load the before_process function from the payment modules

$payment_modules->before_process();

 

$sql_data_array = array('customers_id' => $customer_id,

-----------------end of code

 

So, what we have is a shipping insurance module that works with everything.

 

Thank you Ian, and thank you jchasick, I think we did it. :wink:

 

I will submit this as a contribution.

 

Regards,

 

Richard

Link to comment
Share on other sites

I was thinking about that last night (order_totals) but wasn't quite sure where it fit into the path of events so that could well be the point...

 

at least you now know where to focus attention

Link to comment
Share on other sites

  • 2 years later...
I appreciate your help, men.

Amazing, I tried it every way I could... even dropped the whole ADC entry down a line at a time, and it would still drop out....

But when I started from a fresh copy of checkout_process.php and modified it , the thing then took off and now seems to work right... 8) THANKS, IAN.

Here is what did the trick in checkout_process.php around line 35:

Original as per Bao Nguyen's installation:

// load selected payment module

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment($payment);

// Need to be included before Authorizenet ADC Direct Connection

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

//************************************************************

// Authorizenet ADC Direct Connection

// Make sure the /catalog/includes/class/order.php is included

// and $order object is created before this!!!

if(MODULE_PAYMENT_AUTHORIZENET_STATUS) {

include(DIR_WS_MODULES . 'authorizenet_direct.php');

}

//************************************************************

// load the before_process function from the payment modules

$payment_modules->before_process();

 

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

$order_totals = $order_total_modules->process();

$sql_data_array = array('customers_id' => $customer_id,

----------------------------------

The changed code:

// load selected payment module

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment($payment);

// Need to be included before Authorizenet ADC Direct Connection

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

$order_totals = $order_total_modules->process();

//************************************************************

// Authorizenet ADC Direct Connection

// Make sure the /catalog/includes/class/order.php is included

// and $order object is created before this!!!

if(MODULE_PAYMENT_AUTHORIZENET_STATUS) {

include(DIR_WS_MODULES . 'authorizenet_direct.php');

}

//************************************************************

// load the before_process function from the payment modules

$payment_modules->before_process();

 

$sql_data_array = array('customers_id' => $customer_id,

-----------------end of code

So, what we have is a shipping insurance module that works with everything.

Thank you Ian, and thank you jchasick, I think we did it. :wink:

I will submit this as a contribution.

Regards,

Richard

 

 

Hello Richard,

 

I've been using your Shipping Insurance contribution (SI hereafter) from v1.0 ~ v2.01, it works great within my store, only issue I have so far is the insurance amount cannot be includied at Paypal's website. I'm currently using osCommerce Paypal IPN and did not find any solutions there in its forum. I am glad to find out that you did achieve a solution for using SI with Authorize.net two years ago. And would like to know if your approach (as quoted above) can be adpoted into the Paypal IPN. If possible, how should I apply those changes in the checkout_process.php for Paypal?

 

Here is the link to my detailed post about SI with Paypal in the IPN forum this morning

 

I love the SI module very much and wish to get it working for Paypal - Thanks a lot for any help from you!

Link to comment
Share on other sites

  • 8 months later...

hello,

 

is this thread still support?

 

i have installed this contribution and have had some issues with regarding to setting under admin...

 

what i want to set up is:

 

"Where the insured value of the article is not more than $100, a fee of $7.50. Where the insured value exceeds $100, a fee of $7.50 for the first $100 plus $2 for every additional $100 or portion thereof"

 

 

please help as i have tried every possiple way to change the setting but it does did not work out!

 

maybe the code need to be alter...but i am light years away from php

 

please help i am desparate

michael

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...