Cashfree Payout Code Explanation

1. HTML Structure

The page contains a responsive web form to initiate payouts. The structure is as follows:

Fields in the Form:

2. PHP Script

The backend PHP script processes the form submission and communicates with the Cashfree API.

Fetching Form Data

When the form is submitted, the data is dynamically assigned to variables using $_POST.

Generating Unique Transfer ID

A unique transfer_id is created using the current timestamp.

Cashfree API Integration

The script integrates the Cashfree Payout API to initiate bank transfers. Key integration parameters:

API Endpoint

Request Body Construction

The API payload includes:

3. Handling API Responses

The script handles responses from Cashfree:

4. Encryption

Payout details are encrypted using AES-256-CBC for secure storage and transfer. The IV and encryption key are used for security.

5. Server IP Address

The server's public IP is fetched using https://api.ipify.org for IP whitelisting in Cashfree's dashboard.

Copy Code Example

index.php