Page 1 of 2

2Checkout - error processing your credit card

Posted: Tue Apr 02, 2024 8:23 pm
by GetSirius
Hello,

Still working on a Phoenix 1.0.9.0 site. Using imported data from osC 2.3.4. 2Checkout is not currently used in my 2.3.4 shop.

Using the 2Checkout module included with Phoenix. I can get from my website to 2checkout, I can enter my credit card info, and am returned to my website. But when I am returned to my website I see a message "There has been an error processing your credit card. Please try again." The shopping cart does not show a sale, item is still in my cart.

This happens even though I get a message from 2checkout that my card was successfully charged. My credit card company sends me a message that there was a charge on my card.

I assume that "Secret Word" field in Phoenix is "Secrete Key" (next to Merchant Code) on 2co since orders appear to be accepted from Phoenix by 2co.

Return after sale link is set at 2co as: https://mywebsite.com/shop/checkout_process.php
When I see the error message, the page is: shop/checkout_payment.php?payment_error=pm2checkout

Anyone willing to help me with this?

Re: 2Checkout - error processing your credit card

Posted: Sat Apr 06, 2024 5:12 pm
by GetSirius
Some additional information that may help someone offer an answer to my problem. Checked error_log and see the following:

PHP Notice: Undefined index: credit_card_processed in .../store/includes/modules/payment/pm2checkout.php on line 94

Code: Select all

    public function before_process() {
      if ( ($_POST['credit_card_processed'] != 'Y') && ($_POST['credit_card_processed'] != 'K') ){
        Href::redirect(Guarantor::ensure_global('Linker')->build('checkout_payment.php', ['payment_error' => $this->code]));
      }
    }

Re: 2Checkout - error processing your credit card

Posted: Mon Apr 08, 2024 2:40 pm
by burt
I'm not sure that `before_process` function does anything, as $_POST credit_card_processed is not set up anywhere. So it will always fail.

Try deleting out that block of code you pasted in the message above.
Save the file and try again.

Re: 2Checkout - error processing your credit card

Posted: Mon Apr 08, 2024 3:14 pm
by GetSirius
Thank you for the reply. I deleted that code block and tested. Result when sent back to my website from 2checkout was "This page isn’t working. glassicicles.com is currently unable to handle this request."

Tried deleting only the "if" line and bracket, same result.

However, Phoenix did record the transaction, so that is progress. Phoenix recorded the same transaction a second time when I re-loaded the not working page.

So, my question now is how to make the page work without this line of code?

Re: 2Checkout - error processing your credit card

Posted: Mon Apr 08, 2024 5:46 pm
by BrockleyJohn
I've been having a look at this for Chuck. The underlying issue is that there's a choice of return mechanisms offered in the merchant panel - giving the customer a button to press which sends POST data or using an automated redirect which sends GET.

It's easy enough to handle both by coding (POST ?? GET) and I have this working in demo mode - see attched

It needs testing in live too (because of the hash checking) which I can't!

Re: 2Checkout - error processing your credit card

Posted: Sat Jun 08, 2024 8:38 am
by burt
@GetSirius did you test this updated module kindly recoded by @BrockleyJohn ?

Any feedback you can publically provide (ie, in this thread), will help to determine if this is OK to replace the existing core module. Thanks.

Re: 2Checkout - error processing your credit card

Posted: Sat Jun 08, 2024 12:04 pm
by ecartz
I would prefer this version:
pm2checkout.zip
I believe that the original has an error on a non-existent order_format method.

Re: 2Checkout - error processing your credit card

Posted: Sat Jun 08, 2024 3:50 pm
by GetSirius
@burt - Sorry but no, I have not tested yet. We have been away for over a month and I was not aware of the update. I will get at it soon and post what I find.
..and thank you to @BrockleyJohn and @ecartz for the effort.

Re: 2Checkout - error processing your credit card

Posted: Sat Jun 08, 2024 5:27 pm
by GetSirius
Deleted text - no longer relevant.

Re: 2Checkout - error processing your credit card

Posted: Sun Jun 09, 2024 7:12 pm
by GetSirius
Tested again after correcting my secret word error as noted by 2checkout: "Please use the buy link secret word instead of the Secret Key"

@ecartz version (return method set at 2CO "via link in thank you page"):
Results in sale at 2CO, but when returned to Phoenix I was asked to log in to Phoenix. No order showing in Phoenix dashboard. Log in and item still in shopping cart.

Change the return method to Header Redirect results in successful sale at 2CO and sale recorded in Phoenix using ecartz version

@BrockleyJohn version:
Ordering worked at 2CO and was recorded in Phoenix (with email notices sent), but when returned to my website I received a 500 Internal Server Error.

OK, so ecartz version of the file appears to be working. There is one issue yet. While the orders show up properly in Phoenix, at 2CO they appear like this with no cost value on products. Not sure if this is an issue with Phoenix code, or something at 2CO:
Order details
1 x Cart purchase: (reference number deleted) 1 6.33 USD
2 x Clear Glass Icicles, Traditional Twist Style 1 0.00 USD
Each Clear Glass Icicle is priced at $3.00 - $0.33 sales tax added. Displays as it should in Phoenix email notices:
2 x Clear Glass Icicles, Traditional Twist Style = $6.00
------------------------------------------------------
Sub-Total $6.00
Flat Rate $0.00
WI TAX 5.5% $0.33
Total $6.33
Other than that, the new file appears to be working well enough to use. Thank you all!

What would be really nice? To have ability for Phoenix to record details from 2checkout such as successful sale, refund made, etc.