Reputation: 831
I am developing an ecommerce API with all features of products, catalogs, orders etc... I am stucked in how to process with payment gateways like ccavenue, payumoney... etc those payment gateways are redirecting to banks sites for authentication so I couldn't process this with API. Anyone please help me for making flow of payment process in E commerce API system ?
Thanks in Advance.
Upvotes: 0
Views: 1001
Reputation: 809
usually when the gateway redirect the browser to their website, you have to do the following:
After user click checkout:
after gateway finish and redirect the browser to your site
[gateway must return the transaction Id which you supply it]
Important
some customer will just close the gateway page without continue the process,, so you will get a lot of pending orders after couple days,, also the stock will be decreased.
to solve this issue you should run cron job each 1 hour for example
.. it will cancel any pending orders which are created from more than 10 minutes and it will restock the products
Another Solution:
some gateways ask you to give them confirm URL .. and after the transaction is done .. they send the results to your confirm URL ,, so you have to develop API in your site to process this confirmation response,, in this case even if the user has problem in his browser after finish the transaction and he could not redirect back to your site .. he will get success order
EDIT
okay then you have three sides in the transaction life cycle
1- customer website : we will call it caller
2- your API provider: will call it API
3- finally the gateway
so put in your mind this process can not be done successfully without save some information in API side
the process will go like the following
caller will create order in pending status
caller will send transaction info to your API, this information must have the return URL + the transaction ID
API will save the received information in its DB and generate another request to the gateway, this request must have the return URL + the transaction Id
after gateway finish, it will redirect to your API,, your API will extract the results and return it to Caller return URL
caller will receive the response, extract the results, update the order
Important:
if you would like to keep the process between the caller and gateway
Case A:
usually gateway redirect the user by return html form + JS script which will submit the form when this html is rendered ..
so in this case ..do not print the html repose and just return it to caller ,, let him print it .. so in this case redirection will happen between caller and gateway
Case B:
Upvotes: 4
Reputation: 534
All Payment gateways have a field to pass your custom value/ order id. And they will return you back that value. Look into their documentation. Also look for notification fields.
Upvotes: 0