2Checkout - error processing your credit card

Open to all! Ask other shopowners for help.
GetSirius
Member
Posts: 50
Joined: Wed Mar 17, 2021 7:15 pm
Phoenix Version:
Has thanked: 14 times
Been thanked: 2 times

2Checkout - error processing your credit card

Post 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?


Join The Code Co-op to get access to your library in the Code Co-op Forum
GetSirius
Member
Posts: 50
Joined: Wed Mar 17, 2021 7:15 pm
Phoenix Version:
Has thanked: 14 times
Been thanked: 2 times

Re: 2Checkout - error processing your credit card

Post 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]));
      }
    }
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: 2Checkout - error processing your credit card

Post 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.
GetSirius
Member
Posts: 50
Joined: Wed Mar 17, 2021 7:15 pm
Phoenix Version:
Has thanked: 14 times
Been thanked: 2 times

Re: 2Checkout - error processing your credit card

Post 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?
BrockleyJohn
Certified Developer
Posts: 173
Joined: Mon Mar 01, 2021 5:37 pm
Phoenix Version:
Has thanked: 2 times
Been thanked: 30 times

Re: 2Checkout - error processing your credit card

Post 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!
You do not have the required permissions to view the files attached to this post.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: 2Checkout - error processing your credit card

Post 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.
I am not here to build for you.
I am here to build with you. Let's help each other.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: 2Checkout - error processing your credit card

Post by ecartz »

I would prefer this version:
pm2checkout.zip
I believe that the original has an error on a non-existent order_format method.
You do not have the required permissions to view the files attached to this post.
GetSirius
Member
Posts: 50
Joined: Wed Mar 17, 2021 7:15 pm
Phoenix Version:
Has thanked: 14 times
Been thanked: 2 times

Re: 2Checkout - error processing your credit card

Post 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.
GetSirius
Member
Posts: 50
Joined: Wed Mar 17, 2021 7:15 pm
Phoenix Version:
Has thanked: 14 times
Been thanked: 2 times

Re: 2Checkout - error processing your credit card

Post by GetSirius »

Deleted text - no longer relevant.
Last edited by GetSirius on Sun Jun 09, 2024 7:13 pm, edited 1 time in total.
GetSirius
Member
Posts: 50
Joined: Wed Mar 17, 2021 7:15 pm
Phoenix Version:
Has thanked: 14 times
Been thanked: 2 times

Re: 2Checkout - error processing your credit card

Post 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.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply