Here is my code :

https://paiza.io/projects/SUiG5qp_wttfcrQn-0Mwew?language=php FYI -> [index.htm -> LineNo : 781 & 782]

After successfully received payment response page return 404 error

The form & CC-Avenue Payment Gateway Request page working good, after customer paid the response page return 404 error.

How can i solve the error?

Dani AI

Generated

Quick diagnostic and checklist for (building on and ):

When CCAvenue completes a payment it posts an encrypted payload (usually in a POST field named encResp) to the merchant’s redirect URL; a 404 there means CCAvenue could not successfully load the endpoint you gave it (either the path does not exist, the host/protocol doesn’t match what CCAvenue expects, or the host is unreachable). ’s point about online compilers is relevant: many sandboxed runners are not reachable from external services, so the gateway’s POST never reaches your code. was right to call out the redirect URL in the merchant settings. (dev.to)

Immediate steps to find the cause (fast, reproducible checks):

  • Confirm the exact redirect URL configured in the CCAvenue dashboard (protocol, hostname, path and trailing slash must match what you expect). ()
  • Check your webserver access/error logs while you run a transaction; look for a POST to your handler and the 404 line. Example to watch Apache logs live:
    sudo tail -f /var/log/apache2/access.log | grep --line-buffered "POST\|404"

    Logs tell whether the request arrived and which path CCAvenue called. (betterstack.com)

  • Simulate the gateway POST with curl to confirm your handler responds (use a dummy encResp if needed):
    curl -v -X POST -d "encResp=TEST" "https://your-domain/ccavResponseHandler.php"

If you are developing locally or on an online playground, move the handler to a publicly reachable URL or expose it with a tunnel (ngrok, cloudflared, etc.) so CCAvenue’s servers can reach it. Tunneling is the simplest way to test webhooks/callbacks during development. (ngrok.com)

Other gotchas to check: file name and case (Linux is case-sensitive), .htaccess or rewrite rules that convert the POST to something else (mod_rewrite misconfigurations often surface as unexpected 404s), authentication/permissions on the script, and that the handler is explicitly prepared to accept POST and decrypt encResp with your working key. If everything on your side looks correct but CCAvenue still returns 404, collect the access-log line (timestamp, request line, client IP) and ask CCAvenue support to verify the URL/whitelist for your account. (httpd.apache.org)

Recommended Answers

All 2 Replies

Many online compilers and such block the app from doing much more than basic operations. You should put this on a real server that you know can access the URL from. Also, you need to vardump() the variables on the reticent line if you can't see why it's doing that.

Have you set the redirect-url correctly while setting up the payment gateway? as you mentioned 404, that means CCAvenue sent you successful payment response but is not under your control or something not defined.

I would recommend to use https://github.com/kishanio/CCAvenue-PHP-Library

Here in this library;

$ccavenue = new CCAvenueClient( '<merchant_id>', '<working_key>', '<redirect_url>' );

redirect_url should be the URL of your ccAvenueResponseHandler.php

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.