Payment Forms Webhooks

In this article, you will learn about Payment Form Webhooks and how to configure them from the Payment Gateway Dashboard.

The Payment Form webhook will be triggered when your customers make a complete payment using the payment form you shared.

Configure Webhooks

To start receiving webhook event notifications,

  1. Go to Payment Gateway Dashboard > click Developers in the left navigation.
  2. Select Webhooks in the Payment Gateway section.
  3. Click Add Webhook URL and select the event you want to be notified about.
  4. Enter the URL where you want to receive the webhook notifications, and click Add.

You will start to receive webhook event notifications on the URLs you have specified. You can use one URL to handle several different event types at once or specify individual URLs for specific events.

1200

Configure Webhooks

Payment Forms Sample Payload


{
    "data": {
        "form": {
            "form_id": "my-form-1",
            "cf_form_id": 2011640,
            "form_url": "https://payments-test.cashfree.com/forms/webhook-trial-1",
            "form_currency": "INR"
        },
        "order": {
            "order_amount": 22.00,
            "order_id": "CFPay_U1mgll3c0e9g_ehdcjjbtckf",
            "order_status": "PAID",
            "transaction_id": 1021206,
            "customer_details": {
                "customer_phone": "9999999999",
                "customer_email": "[email protected]",
                "customer_name": "John Doe",
                "customer_fields": [
                    {
                        "title": "Zoom ID",
                        "value": "john"
                    },
                    {
                        "title": "Company Designation",
                        "value": ""
                    }
                ]
            },
            "amount_details": [
                {
                    "title": "Webinar Tickets",
                    "value": 398,
                    "quantity": 2
                },
                {
                    "title": "Zoom Platform Fee",
                    "value": 10
                },
                {
                    "title": "Buy me a coffee :)",
                    "value": 0
                },
                {
                    "title": "Amount Dropdown Trial",
                    "value": 50,
                    "selectedoption": "Option 1"
                }
            ]
            
        }
    },
    "event_time": "2021-04-16T14:10:36+05:30",
    "type": "PAYMENT_FORM_ORDER_WEBHOOK",
    "version": 1
}

Payload Field Description

FieldDescriptionExample
cf_form_idUnique Identifier (generated by Cashfree) for this Form.1543566
form_idUnique Identifier (provided by merchant) for the Form. Only for merchant reference. Use this for other form-related APIs.payment_1psw
form_urlUnique URL created to accept payments. Customers can click this URL to make the payment.https://payments-test.cashfree.com/forms/webhook-trial-1
form_currencyDefault is INR. International currencies are supported.INR
order_amountThe amount paid by the customer.250.00
order_idUnique order ID generated for the payment received.124847
order_statusStatus is PAIDPAID
transaction_idUnique transaction ID generated for the payment received.43437
customer_detailsCustomer object, it contains customer details.
customer_nameName of the customerJohn
customer_phonePhone number of the customer9000000000
customer_emailEmail ID of the customer[email protected]
customer_fields Customer fields is an array. It contains the values filled by the customer against the custom fields created for the form.
titleLabel defined for the field during form creation.
valueValue entered by the customer against the field.
amount_details Amount details is an array. It contains the amount and quantity value filled by the customer against the amount fields created for the form.
titleLabel defined for the field during form creation.
valueValue entered by the customer against the field.
quantityQuantity entered by the customer against the field.
typeType of the webhook. PAYMENT_FORM_ORDER_WEBHOOKPAYMENT_FORM_ORDER_WEBHOOK
versionThe version of webhook. You should build your parsing logic considering this version.1
event_timeTime when this webhook was created.2021-04-16T14:10:36+05:30

Use Webhooks with No-Code Integration Platforms

Cashfree Payments supports configuring webhook with the below no-code integration platforms to receive automatic notifications about the payments.

  • Zapier
  • make
  • Pabbly

Zapier

You can create a webhook URL on Zapier, configure the URL on Cashfree Payments Dashboard, and receive notifications automatically. Zapier provides a no-code integration solution for Webhooks.

To create a Webhook URL using Zapier,

  1. Create a Zapier account or sign in using your existing credentials.
  2. Select Webhooks by Zapier and complete the setup.
  3. Click Create Zap.
1433

Create Zap

  1. Select Webhooks by Zapier as the Trigger App, and Catch Raw Hook as the Trigger Event.
886

Trigger App and Event

  1. Click Continue.
  2. Copy the Webhook URL provided and add it as the Payment Form webhook URL on the Cashfree Payments Dashboard webhook screen as the URL to receive notifications.
795

Custom Webhook URL

  1. Click Test Trigger to verify the configuration.
  2. In the Action screen, select Code by Zapier as the next Trigger App, Run Javascript as the Trigger Event, and click Continue.
827

Run Javascript Code by Zapier

  1. Add data as the key in Input Data field, Raw Body as the value. Copy the code below to the Code section, and click Continue.

// this is wrapped in an `async` function
// you can use await throughout the function
var obj = {}, data = JSON.parse(inputData.data)

obj.form = data.data.form
obj.order= {
  "order_amount": data.data.order.order_amount,
  "order_id": data.data.order.order_id,
  "order_status": data.data.order.order_status,
  "transaction_id": data.data.order.transaction_id
}

obj.order.customer_details = {
  "customer_phone": data.data.order.customer_details.customer_phone,
  "customer_email": data.data.order.customer_details.customer_email,
  "customer_name": data.data.order.customer_details.customer_name
}

if (data.data.order.customer_details.customer_fields && data.data.order.customer_details.customer_fields.length) {
  data.data.order.customer_details.customer_fields.map((mapObj) => {
    obj.order.customer_details["customer_"+mapObj.title] = mapObj.value
  })
}
 
if (data.data.order.amount_details && data.data.order.amount_details.length) {
  obj.order.amount_details = {};
  data.data.order.amount_details.map((mapObj) => {
    obj.order.amount_details["amount_"+mapObj.title] = mapObj.value
    if (mapObj.quantity) { //reads quantity for Item field type
      obj.order.amount_details["amount_"+mapObj.title+"_quantity"] = mapObj.quantity
    }
  })
}

output = obj
708

Set up Action

  1. Test the configuration and click Publish Zap. For confirmation, click Publish & Turn On. Connect to any app on Zapier to transfer the data and use it for further analysis.

make

To create a Webhook URL using make,

  1. Create an account with make or sign in using your existing make account credentials.
  2. Click Create a new scenario.
1436

Create new scenario

  1. Search for webhooks and select Webhooks from the options shown.
1435

Select Webhooks

  1. Select Custom Webhook. Enter a name for the webhook, and click Save.
1435

Create Webhook

  1. A webhook URL will be generated as shown in the image below. Copy the webhook URL shown and add it as the Payment Form webhook URL on the Cashfree Payments Dashboard webhook screen as the URL to receive notifications. You can trigger and check. You will start receiving payment-related notifications via this webhook URL.
1432

Copy Webhok URL

You can click Add Another Module and connect to any app on make to transfer the data and use it for further analysis. When you want to add the payment details to a google sheet whenever you receive payment from payments forms, you can click Add Another Module and select Google Sheets. Then add your Google account and select Google Sheets, details will be saved in this sheet.


Pabbly

To create a Webhook URL using Pabbly,

  1. Create an account with Pabbly or sign in using your existing make account credentials.
1428

Pabbly Dashboard

  1. Click Create Workflow and specify a name.
  2. In the Choose App field select Webhook. Copy the webhook URL shown on the screen and add it as the Payment Form webhook URL on the Cashfree Payments Dashboard webhook screen as the URL to receive notifications. You will start receiving payment-related notifications via this webhook URL.
1421

Capture Webhook

You can also save payment notifications in a Google Sheet. To do this, select Google Sheets as the application and add rows/columns as per your requirement and capture data in the Google Sheet.


Experience the all-new Cashfree Payments Docs! Faster, smarter, and easier to navigate. Check it out here!🎉