In this tutorial, we will see how to integrate CCAvenue payment gateway in PHP.
CCAvenue is one of the leading online payment gateway service provider similar to other popular providers PayPal, Citrus, PayUMoney etc. Easy integration is an advantage of CCAvenue payment gateway.
For integration of CCAvenue, you should follow few steps -
For sending additional information,you need to set some custom input names with values after payment. Look at the additional information section in the above code. IN this section, you can see labels Merchant Param1, Merchant Param2 and so on. You can change the names of label but names of input should be merchant_param1, merchant_param2 etc. You can't change them with custom names like say home_address, office email etc. If you change them CCAvenue process will not send them to the function after successful transaction.
In the next chapter, we will learn How to handle the CCAvenue response in php after the successful payment.
In this tutorial, we have learnt, how to integrate CCAvenue payment gateway in PHP. If you like this post, please share it with your friends.
For integration of CCAvenue, you should follow few steps -
1. Registration with CCAvenue -
To start the integration, you should first get registered with CCAvenue. This is free and easy process. Here, you should mention the details asked by CCAvenue and you will get many things in return. After login to the CCAvenue dashboard and you will get the Merchant ID and Working Key, which will be useful later in an integration process.
2. Create a form for submitting to CCAvenue payment gateway -
This is the main process of integration of CCAvenue in php. To integrate and make the form working properly, CCAvenue has provided certain types of input names that are required to be used exactly in the same way as provided. Copy the below code and paste it in your project code. You might need to arrange the input controls as per you requirement.
<form method="POST" name="customerData" action="ccav-request-handler.php"> <input type="hidden" name="tid" id="tid" /> <input type="hidden" name="merchant_id" value=""/> <input type="hidden" name="order_id" value=""/> <input type="hidden" name="amount" value=""/> <input type="hidden" name="currency" value="INR"/> <input type="hidden" name="redirect_url" value=""/> <input type="hidden" name="cancel_url" value=""/> <input type="hidden" name="language" value="EN"/> <h5>Billing information(optional):</h5> <label>Billing Name:</label> <input type="text" name="billing_name" value="Charli"/> <label>Billing Address:</label> <input type="text" name="billing_address" value="Room no 1101, near Railway station Ambad"/> <label>Billing City:</label><input type="text" name="billing_city" value="Indore"/> <label>Billing State:</label><input type="text" name="billing_state" value="MH"/> <label>Billing Zip:</label><input type="text" name="billing_zip" value="425001"/> <label>Billing Country:</label><input type="text" name="billing_country" value="India"/> <label>Billing Tel:</label><input type="text" name="billing_tel" value="9999999999"/> <label>Billing Email:</label><input type="text" name="billing_email" value="test@test.com"/> <label>Additional Info:</label> <label>Merchant Param1:</label> <input type="text" name="merchant_param1" value="additional Info."/> <label>Merchant Param2:</label> <input type="text" name="merchant_param2" value="additional Info."/> <label>Merchant Param3:</label> <input type="text" name="merchant_param3" value="additional Info."/> <label>Merchant Param4:</label> <input type="text" name="merchant_param4" value="additional Info."/> <label>Merchant Param5:</label> <input type="text" name="merchant_param5" value="additional Info."/> </form>
For sending additional information,you need to set some custom input names with values after payment. Look at the additional information section in the above code. IN this section, you can see labels Merchant Param1, Merchant Param2 and so on. You can change the names of label but names of input should be merchant_param1, merchant_param2 etc. You can't change them with custom names like say home_address, office email etc. If you change them CCAvenue process will not send them to the function after successful transaction.
In the next chapter, we will learn How to handle the CCAvenue response in php after the successful payment.
In this tutorial, we have learnt, how to integrate CCAvenue payment gateway in PHP. If you like this post, please share it with your friends.
Comments
Post a Comment