Title: Card Declined/Payment Failed
Last modified: August 31, 2016

---

# Card Declined/Payment Failed

 *  [jawad96](https://wordpress.org/support/users/jawad96/)
 * (@jawad96)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/)
 * Hi there,
 * I have a query regarding this earlier posted message: [https://wordpress.org/support/topic/custom-transaction-failed-landing-page](https://wordpress.org/support/topic/custom-transaction-failed-landing-page)
 * When a card is declined/failed the Cart page with the message ‘Your Order was
   cancelled’ is not very informative as the customer will not know what caused 
   this?
 * I am currently talking to a gateway developer and they say WooCommerce does not
   have a failed transaction landing page – is that correct?
 * Many Thanks,
    Jawad
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

Viewing 15 replies - 1 through 15 (of 25 total)

1 [2](https://wordpress.org/support/topic/card-declinedpayment-failed/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/card-declinedpayment-failed/page/2/?output_format=md)

 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7172885)
 * Correct however, gateways can add error messages of their own if a payment is
   rejected.
 *  Thread Starter [jawad96](https://wordpress.org/support/users/jawad96/)
 * (@jawad96)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7172890)
 * Hi Mike,
 * Thanks for that.
 * So this message that gateways can add – will the be added on the ‘Cart’ page 
   on my website when it gets redirected and replaces the text ‘Your order was cancelled’
   with an error code that the gateway developer should change? Or is this message
   shown on the merchants site?
 * Because I am telling him to do this and he keeps telling me it is not possible
   because WooCommerce does not have a page for this.
 * Any assistance on the best way to tell the developer what to change/edit will
   be useful code wise.
 * Many Thanks,
    Jawad
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7172895)
 * It depends on how the gateway works really. If its direct (i.e. it takes payment
   as soon as you place order), adding a notice is really easy – no need to even
   change order status because it won’t be made.
 * If its offsite, usually you’d return to the thanks page where the user would 
   get an option to try again.
 * Auth.net DPM for example which is mine, redirects back to the store, and if there
   was an error it passes an error message via query string to the thanks page:
 *     ```
       $order->update_status( 'failed', $e->getMessage() );
       			$redirect_url = add_query_arg( 'wc_error', $e->getMessage(), $order->get_checkout_payment_url( true ) );
       ```
   
 *  Thread Starter [jawad96](https://wordpress.org/support/users/jawad96/)
 * (@jawad96)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7172917)
 * Hi Mike,
 * Thanks for your reply. The gateway plugin is relatively simple and consists of
   one file – if you wanted to have a look:- [https://github.com/SSLWireless/Woocommerce-sslcommerz-v2.4.6/blob/master/index.php](https://github.com/SSLWireless/Woocommerce-sslcommerz-v2.4.6/blob/master/index.php)
 * Currently – after clicking checkout the website redirects to the merchants website
   for the customer to enter their card details. Then customer then gets redirected
   back to my website with the correct response – so successful transaction redirects
   to the Thank You page.
 * At the moment I am testing the responses in sandbox and when I choose ‘Failure’
   it responds by going back to cart page with the message ‘Your order has been 
   cancelled’ and sets the status to ‘Failed’. Is it possible to return to cart 
   page but modify the notification message from ‘Your order has been cancelled’?
 * Many Thanks,
    Jawad
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7172924)
 * If I were doing it, I’d return to either the thanks page or the wc-api endpoints,
   then redirect with a better error message. Like the above example.
 *  Thread Starter [jawad96](https://wordpress.org/support/users/jawad96/)
 * (@jawad96)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7172932)
 * Hi Mike,
 * Please look at my thanks page:
 * [https://i.gyazo.com/6f01e79fa65caae47f748987fe0a2ded.png](https://i.gyazo.com/6f01e79fa65caae47f748987fe0a2ded.png)
 * Where would the error message be displayed on this page?
 * Where would the button be to attempt to order again?
 * Also – this is the URL for the page ‘checkout/order-received/1561/?key=wc_order_56e80bea47076’–
   surely this will confuse customer? But also set the status to processing?
 * Thanks for your help.
 * Many Thanks,
    Jawad
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7172997)
 * It would be at the top, and most of the other content would be hidden. You can
   simulate the error itself. Go to the page and add this to the address bar:
 *     ```
       ?wc_error=I%20am%20a%20fish
       ```
   
 *  Thread Starter [jawad96](https://wordpress.org/support/users/jawad96/)
 * (@jawad96)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7173002)
 * Hi Mike,
 * Thanks for your response. So I went back and used this URL ‘checkout/order-received/
   1561/?wc_error=I%20am%20a%20fish’
 * And it outputted error message ‘I am a fish’
 * But also `Notice: Undefined variable: order in /plugins/woocommerce/includes/
   shortcodes/class-wc-shortcode-checkout.php on line 208`
 * ‘Thank you. Your order has been received.’
 * Surely it should not output the last statement ‘your order has been received’?
 * I suppose my main query is – it would be slightly odd for the URL to also be ‘/
   order-received/’ when in fact it got declined?
 * Furthermore, doesn’t going to the Thank You page process it as an order, meaning
   that the products would no longer be in the cart – as it would need to have the
   products in the cart and the button to attempt to order again which I cannot 
   see?
 * I am happy to use your method but having a bit of trouble wrapping my head around
   it. Could you possibly show a screenshot of your gateway plugin failure response
   page including the URL?
 * I just need some solid details to go back to the developer with so I can explain
   to him how it should be.
 * Many Thanks,
    Jawad
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7173003)
 * > Furthermore, doesn’t going to the Thank You page process it as an order, meaning
   > that the products would no longer be in the cart – as it would need to have
   > the products in the cart and the button to attempt to order again which I cannot
   > see?
 * Again this was just an example, the developer doesn’t have to send the user here.
   It was just an example. His code can send the user anywhere; cart, checkout, 
   anywhere, and it can append the error message. Use whatever is most appropriate.
 * The thanks page is just useful because if the order status is failed, a retry
   button is presented to the user. In your test, the order status wouldn’t have
   been failed.
 * So going back to the original qu:
 * > I am currently talking to a gateway developer and they say WooCommerce does
   > not have a failed transaction landing page – is that correct?
 * This is true, it doesn’t have a dedicated failed page. So perhaps use checkout
   or the order received page with an error message.
 *  Thread Starter [jawad96](https://wordpress.org/support/users/jawad96/)
 * (@jawad96)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7173006)
 * Hi Mike,
 * Thank you for that information. That’s what I needed to know. Currently – the
   gateway falls back to cart page with the notification “Your Order has been Cancelled”.
 * I think the best way would be to fallback to the ‘Checkout’ page with the appended
   error message and have the status set to ‘Failed’.
 * That is what I was mainly after – appending the message ‘Your order has been 
   cancelled’ but the developer kept saying it was not possible. But you confirmed
   it now so I will show him this.
 * Many Thanks,
    Jawad
 *  Thread Starter [jawad96](https://wordpress.org/support/users/jawad96/)
 * (@jawad96)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7173007)
 * Hi Mike,
 * One more quick question as well:-
 * Currently, an updated plugin by the developer, when a ‘Failed’ payment is simulated
   the fallback page is the ‘Cart’ page and status is set to ‘Failed’.
 * The Cart page however is empty with no products that were added prior to the 
   failed simulation?
 * The only way to be able to allow customer to ‘Order Again’ with the products 
   still in the cart would be to set the fallback page to the Thank You page? Is
   it not possible to fallback to the Cart or Checkout page with the products still
   in the cart?
 * Many Thanks,
    Jawad
 *  Thread Starter [jawad96](https://wordpress.org/support/users/jawad96/)
 * (@jawad96)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7173078)
 * Hi Mike,
 * Any update on my earlier query?
 * One other thing I was curious about is the order Thank You page. If you copy 
   the URL including the wc key, then a customer can always go back to this page?
 * Usually I find with most shopping sites that the Thank You page is one off or
   has a session expiry, so something like after 15 minutes it will expire – is 
   this possible?
 * Many Thanks,
    Jawad
 * P.S Are you using Annotate for uploading screenshots? How are you uploading to
   the domain: [https://annotate.driftt.com/view?i=xqpkxk9wrsld7pl%2F2016-03-16_at_00.19.png%2F](https://annotate.driftt.com/view?i=xqpkxk9wrsld7pl%2F2016-03-16_at_00.19.png%2F)?
 *  [airmvp23g](https://wordpress.org/support/users/airmvp23g/)
 * (@airmvp23g)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7173080)
 * I have had a similar issue with a Failed Transaction without any details. It 
   mostly says Server Error, but no details. It is probably coming from Authorize.
   net, but I would like to be able to change this wording to something more helpful
   to the customer. Where can I go to change this message?
 * Thanks.
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7173086)
 *     ```
       The only way to be able to allow customer to 'Order Again' with the products still in the cart would be to set the fallback page to the Thank You page? Is it not possible to fallback to the Cart or Checkout page with the products still in the cart?
       ```
   
 * The cart can be cleared by gateways which is what is happening here. If you direct
   to ‘thanks’ page, the items are still listed. Thats why I prefer it.
 * airmvp23g please don’t hijack other uses threads. Make your own.
 *  [airmvp23g](https://wordpress.org/support/users/airmvp23g/)
 * (@airmvp23g)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/card-declinedpayment-failed/#post-7173095)
 * Apologies

Viewing 15 replies - 1 through 15 (of 25 total)

1 [2](https://wordpress.org/support/topic/card-declinedpayment-failed/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/card-declinedpayment-failed/page/2/?output_format=md)

The topic ‘Card Declined/Payment Failed’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [declined](https://wordpress.org/support/topic-tag/declined/)
 * [Failed](https://wordpress.org/support/topic-tag/failed/)

 * 25 replies
 * 3 participants
 * Last reply from: [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/card-declinedpayment-failed/page/2/#post-7173143)
 * Status: not resolved