In the Standard Checkout integration method, you prepare the checkout form with the correct order and customer details and redirect users from your checkout page to Cashfree’s payment screen. Cashfree payment gateway supports all major payment methods such as credit and debit cards, wallets, UPI, and net banking.
The Checkout form provides customers with a streamlined flow for initiating payments. Your customers enter payment details on the payment screen hosted by Cashfree and complete the payment. Cashfree handles the PCI compliance guidelines on your behalf in this integration method.
Watch the video to know how to integrate Cashfree Payment Gateway using PHP.
# Steps to Create Checkout Form
[Create Checkout Form](🔗)
[Submit Checkout Form](🔗)
## Create Checkout Form
Customers orders are associated with a unique identifier orderId for each order. The order amount is associated with an identifier orderAmount. To process the payments for these orders, you must send us the orderId and the corresponding orderAmount. We send you the payment status against each order.
You need to send us a few more details to process the payment. Click [here](🔗) to see all the Request Parameters.
Every request to Cashfree must contain authentication information to establish the identity of the user making the request, we use the signature field for this authentication.
See the code below on how to generate a valid signature for Checkout integration.
Create a sample HTML form as shown below. Ensure to fill in the correct credentials for appId and secret key. You can find your AppId and Secret key in the merchant dashboard.
For Production/Live Environment set the action attribute of the form to: **https://www.cashfree.com/checkout/post/submit**
For Test Environment set the action attribute to: **https://test.cashfree.com/billpay/checkout/post/submit**
### Request Parameters
The checkout form accepts all the request parameters mentioned below. Ensure you send us all the required fields. Requests with an invalid signature will be rejected.
|appId||Yes||Your app ID.|
|orderAmount||Yes||Bill amount of the order.|
|orderCurrency||No||Currency for the order. The default currency is INR. See [Currencies Supported](🔗) for the list of available currencies. Contact [[email protected]](🔗) to enable new currencies.|
|orderNote||No||Text that will help customers know more about their order.|
|customerName||Yes||Name of the customer.|
|customerPhone||Yes||Phone number of the customer.|
|customerEmail||Yes||Email ID of the customer.|
|merchantData||No||A base 64 encoded json array (as a key value pair). Maximum 10 pairs allowed, at max 64 chars for each key and 256 chars for each value.|
|returnUrl||Yes||The URL to which the user must be redirected to after completing the payment. We recommend you to use an HTTPS URL for the returnURL.|
|notifyUrl||No||Notification URL is for server-server communication. This URL receives a notification for every successful order. notifyUrl must be an HTTPS URL.|
|paymentModes||No||Payment modes allowed to complete the payment for the order. Available values: cc, dc, nb, upi, paypal, wallet. Example values: "cc", "cc,dc", "paypal, nb", etc. If this parameter is empty, all available payment modes are displayed.|
## Generate Signature
Every request to Cashfree must contain authentication information to establish the identity of the user making the request. We use a digital signature to validate each transaction. This will ensure integrity of the signed data against tampering.
In the sample form above, generate a signature for every checkout. The signature is generated as the HMAC value of the data being passed which is using SHA256 hash function in combination with your secret key.
We will generate a signature at our end and want you to do the same with the posted data and match it with the passed argument.
Signature generation varies across integration methods, ensure you are using the right signature generation method.
You can find your appId and secret key in the merchant dashboard [here](🔗).
## Submit Checkout Form
Once you have the checkout form prepared, paste below HTML just before the closing </form> tag. By default all the fields in the above HTML form are hidden, you can make them visible by removing the type="hidden" text from every input field.
Do not add a name parameter to the HTML submit button.
# Webhook Notification
Webhooks are events that notify you about the payment. A notification is sent to your backend from Cashfree when payments are successful. These notifications are useful in cases when the internet connection is unstable or slow while the payment is being processed. This will allow you to reconcile all the successful orders at your end. Notifications will be sent to notifyUrl which is a part of the [request parameter](🔗) specified while creating an order request.
Notifications are sent only for successful payments.
Sometimes you may receive the same notification more than once. It is recommended to ensure that your implementation of the webhook is idempotent.
# Response Parameters
CashFree sends details about every transaction to both returnUrl and the notifyUrl. These parameters will be posted to the services you host on these URLs.
The returnUrl is the webpage where your customer will be redirected to after completing the payment on the Cashfree payment page, we will post the response parameters to this page. Cashfree will also post form variables to notifyUrl you specify, which runs a program to process these variables.
|orderId||Order ID for which transaction has been processed. Example, GZ-212|
|orderAmount||Bill amount of the order. Example, 256.00|
|referenceId||Cashfree generated unique transaction ID. Example, 140388038803|
|txStatus||Payment status for that order. Values can be: SUCCESS, FLAGGED, PENDING, FAILED, CANCELLED, USER_DROPPED.|
|paymentMode||Payment mode used by customers to make the payment. Example, DEBIT_CARD, PREPAID_CARD, MobiKwik.|
|txMsg||Message related to the transaction. Payment failure reason is included here.|
|txTime||Time of the transaction|
# Response Verification
Similar to every request signature, we send a digital signature in our response message. We recommend you verify this response signature to check the authenticity of the transaction response. This will ensure that the response has not tampered.
# Integration Kits
The integration kits for all major platforms are available below:
PHP - https://github.com/cashfree/php-pg-integration
Java - https://github.com/cashfree/java-pg-integration
Node.js - https://github.com/cashfree/node-pg-integration
.net - https://github.com/cashfree/net-pg-integration
Python - https://github.com/cashfree/python-pg-integration
Ruby - https://github.com/cashfree/ruby-pg-integration
# Test the Integration
After the integration is complete, you can test the flow of the transaction before you start accepting payments online. Click [here](🔗) to know how to view/generate API keys.
You can make a test transaction using the test card and net banking details available below. You can verify the payment status using the PG Dashboard, APIs, or webhooks. After completing the test, you can start accepting payments from your customers in real-time.
|4444 3333 2222 1111||07/23||123||Test|
|4111 1111 1111 1111||07/23||123||Test|
## Test Signature
Generate a signature and verify it using the checksum tool available <a href="https://test.cashfree.com/docs/checksum/" target="_blank">here</a>.
If you see the message, **Failed to verify merchant credentials**, check and correct the details you provided in the checksum tool.