简体   繁体   中英

A 404 error occurred Page not found. The requested URL could not be matched by routing. No Exception available

I have implemented the stripe system on my website using stripe documentation

https://stripe.com/docs/tutorials/checkout

I have made a payment file and a charge file .

this is the code for payment file

    <div class="panel-body">
        <form action="in/payment/charge.phtml" method="POST">
          <script
            src="https://checkout.stripe.com/checkout.js" class="stripe-button"
            data-key="xxxxxxxxxxxxxxxxxxx"
            data-image="logo.png"
            data-name="abc.com"
            data-description="EBS($750.00)"
            data-amount="75000">
          </script>
        </form> 
    </div>

Furthermore the code for charge file includes try catch clause.

     <?php

try {
  require_once('Stripe/lib/Stripe.php');
  Stripe::setApiKey("secret_key_here"); //Secret Key

  $charge = Stripe_Charge::create(array(
  "amount" => 750,
  "currency" => "usd",
  "card" => $_POST['stripeToken'],
  "description" => "Charge for Events Plan Subscription."
 ));
    //send the file, this line will be reached if no error was thrown above
    echo "<h1>Your payment has been completed. You have Subscribed to Events Basic Plan</h1>";


//you can send the file to this email:
echo $_POST['abc@gmail.in'];
}
//catch the errors in any way you like

 catch(Stripe_CardError $e) {

 }


 catch (Stripe_InvalidRequestError $e) {
 // Invalid parameters were supplied to Stripe's API

 } catch (Stripe_AuthenticationError $e) {
 // Authentication with Stripe's API failed
 // (maybe you changed API keys recently)

} catch (Stripe_ApiConnectionError $e) {
  // Network communication with Stripe failed
} catch (Stripe_Error $e) {

// Display a very generic error to the user, and maybe send
// yourself an email
} catch (Exception $e) {

// Something else happened, completely unrelated to Stripe
}
?>

It displays stripe popup as soon as I click pay with card. But soon after entering details and pressing pay button is shows 404 page with message:

A 404 error occurred 
Page not found.  
The requested URL could not be matched by routing. 
No Exception available

I am newbie to zend framework. I have made necessary route changes in module.config.php .

        return array(
'router' => array(
'routes' => array(
       'rpayment' => array(
                'type'    => 'Segment',
                'options' => array(
                        'route'    => 'payment[/:action[/]]',
                        'constraints' => array(
                                'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                        ),
                        'defaults' => array(
                                '__NAMESPACE__' => 'Webin\Controller',
                               'controller' => 'Payment',
                                'action' => 'index',
                        ),
                ),
        ),

I dont know where I am wrong? Can anyone please point out error?

Is this the correct path?

require_once('Stripe/lib/Stripe.php');

Is stripe in a folder in the root directory of the website? I recently spent too much time on a small overlook like this. I had to add ../ to the front of Stripe/lib/Stripe.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM