Jump to content
AdmiralRedBeard

Stripe payment option not recognizing discount coupon amount

Recommended Posts

Hi,

 

I am in desperate need of some help. I installed the Stripe payment option in my v2.3.4 online store as an additional option to PayPal.

 

I am testing to make sure that the discount coupons that I set up in my admin area are calculated and processed upon payment by the customer. In both PayPal and now in Stripe the amount of the coupon discount are not either being carried or recognized on the processor's end. The coupon discount accurately displays on my checkout_confirmation page. This is very discouraging. I am hoping that someone can help me because it is delaying the grand opening of my online store because I want to offer a Grand Opening sale. I posted back in December about my PayPal issue and have not received any help or advice.

 

I have attached screenshots of the Stripe log and the order info from my website.Stripe Log.pdfshopping cart page.pdf

 

Any help that you can provide me would be greatly appreciated and I'm sure would help others.

 

Thank you in advance.

 

Tim

Edited by AdmiralRedBeard

Share this post


Link to post
Share on other sites

Hi - I think both modules (certainly Stripe) use the onbject $order->info[total] to calculate how much to charge, in turn that is composed in the orders class using the order_total modules.

 

Couple of things - check that whichever coupon system you have installed (there is no native one so you have an addon of some sort) - there would have been an edit someplace into the orders class - make sure that's done and also the ot_coupon module should be installed under admin > modules > order total (may be called summat else but ot_coupon stars in the kgt coupons) addon

Check the order totals are in the correct sort order - there's usully some blurb in the documents for the payment module

 

Is the total on checkout_confirmation what you would expect to see?

Share this post


Link to post
Share on other sites

Hi Bob,

Thank you for your reply. I will check the admin area for the coupon. The order does display the correct totals on the checkout confirmation page.

Tim

Share this post


Link to post
Share on other sites

Hi Bob,

 

I looked at my admin directory for the order_total like you mentioned.

Here is what I have regarding the order type files:

admin/orders.php

admin/orders_status

admin/includes/boxes/orders.php

admin/includes/classes/order.php

admin/includes/languages/english/orders.php

admin/includes/languages/english/orders_status.php

admin/includes/languages/english/modules/cfg_modules/cfgm_order_total.php

admin/includes/languages/english/modules/dashboard/d_orders.php

 

There were several files relating to gift vouchers and coupons added to both the admin and catalog directories from the addon.

 

The discounts get applied to my order_total table. They appear and are calculated on the order info that is displayed on the checkout_confirmation page and also on the order history when you view the order details.

 

Here is some of the Stripe.php code from catalog/includes/modules/payment/stripe.php where it sends the order total to Stripe. The function called before_process() is where I see the total being populated into a params array. I do not know where or how this function gets called. I tried playing around with the total in this area and the Stripe test error log shows a zero value for the amount and I was getting an error message on the checkout_confirmation page something about an integer value. Within the before_process functon it is setting the ['amount'] equal to $order->info['total']. This total should be reflecting the discounted total, but like I said I do not know when/where the function gets called to process.

 

The before_process funtion: Stripe.php function.pdf

The params section of that function: Stripe.php params.pdf

 

I get so lost in all of this code and I am absolutely stumped. If the correct total is in the table and displays within the shopping cart then why does it not transfer to the payment processor? That's what I do not quite understand and that is what I am hoping you can help me to solve.

 

Thank you so much for tryingto help me! I truly appreciate it.

 

Tim

Edited by AdmiralRedBeard

Share this post


Link to post
Share on other sites

Hi Bob,

 

I seem to have figured out my issue.

 

I did a search online for before_process oscommerce and I found an old forum entry that told me that that payment before_process() function gets called in the checkout_process.php step. It also stated that the call to that function needs to come after the place where $order_totals_module is defined. So I looked at my version of checkout_process and the call to the payment before_process() function was before the $order_totals_module.

 

Since I had not initially modified the checkout_process.php file I overwrote it with the version that came with the CCGV addon. That was my mistake. I didn't think that it would be altered other than for the CCGV module. Anyway, it now works for my coupons and it works for points redeemed. The only thing that I didn't test yet is the gift vouchers.

 

I sincerely appreciate the effort that you put into this request. I hope that I didn't bother you too much.

 

Tim 

Share this post


Link to post
Share on other sites

Thankyou AdmiralRedBeard! I ran into this same problem with Paypal when using a CCGV coupon - Paypal would claim it was going to debit the discounted amount, and the order would show the discounted amount, and yet the actual amount being taken by Paypal was the full pre-discount amount. It was doing my head in, but your solution is right on the money, so to speak. $payment_modules->before_process() needs to be called *after* $order_total_modules->process() in checkout_process.php, as it is in the stock 2.3.4, whereas CCGV's version of this file inexplicably moves it to the wrong place.

It would be good to get a fixed version of CCGV uploaded if anyone has access to do that; this is bound to bite other people.

Thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×