Jump to content

Payment module - need order id before validateOrder


mikecheung

Recommended Posts

I created a payment module for credit card processing.

 

I have a problem where my customer is receiving a email confirming their order before they have entered their credit card information.  This has caused a bit of confusion for the customer.

 

The current process is as follows:

  1. User chooses payment method
  2. User confirms that they want to use this payment method
    1. Module runs validateOrder because one of the variable required by the payment gateway is order id.
    2. Email gets sent to user saying that their order has been confirmed
  3. User gets redirected to payment gateways site
  4. If user inputs everything correctly on the site, the user will be redirected back to my site
    1. I change the status of the order based on whether the users transaction has been approved or not.

My questions are :

  1. Is it possible to get the order id before I validate order? (I can see how this may not make sense with multiple transactions happening at the same time)
  2. if not, can I prevent the order from sending a order confirmed email until step 4?

Your help is greatly appreciated.

  • Like 1
Link to comment
Share on other sites

You can use the cart id instead of the order id. The cart should contain everything the payment gateway needs and an order can always be linked to cart id after the call to validateOrder. Up until the point that validateOrder is called - the cart_id IS the order_id if that makes sense....

  • Like 2
Link to comment
Share on other sites

I concur, I always use cart id in my payment modules.  Now if the gateway requires a unique Id, and you have built the module in a way that the customer can attempt multiple times (perhaps due to a decline the first time), then you can try to add a timestamp after the cart id.  something like "cart id_timestamp" or "cart id::timestamp"

 

ie..  123_54638383

  • Like 2
Link to comment
Share on other sites

Thanks guys, that was one of my options, it's just more difficult to compare payment gateway report and order list page because the order_id is what shown and not the cart_id.  Was hoping for a different way, but if that is what is recommended, that's what I'll use.

 

appreciate the answers.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...