Jump to content

Payment gw - correct way to create order with callback


Recommended Posts

Hi,

 

I'm developing payment module in PS 1.7. On successful payment, the gateway will call validation url of the shop with supplied reference id.

Now I'm in doubt, whether to create the order before (note, that the user can hit back and select another payment), or create the order in the callback? (callback is called later by the gw, so session is not available)

Also what reference to use? I think cart id can be used, but the problem here is that meanwhile the user can open the shop in another tab and add products (probably not a big problem, i can test paid amount to prevent this).

 

Thanks for advice.

 

Link to comment
Share on other sites

It would be better if you will create a separate controller for processing the payment and once the payment is done then just redirect your page to the validation controller of your payment method. You should send some parameters to the validation controller so that you can confirm your payment there also. Just confirm your payment there and then call the validateOrder method in the validation controller.

 

It would be better if you will take the reference from default payment method modules of the Prestashop like bank wire or cashondelivery.

Link to comment
Share on other sites

  • 5 years later...

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