This section provides details on how to integrate with Auto Collect. It explains how to create a virtual account and receive payments from your customers.

Auto Collect Integration Flow
### Steps to Integrate
Setup
Initialization and Authorization
Create Virtual Account
Share Details with Customer for Payments
Customer Makes Payment
Get Notified Instantly for Successful Payments
Receive Amount and Reconcile
# Step 1: Setup
Get the [Client Id and Client Secret key](🔗) from your Auto Collect dashboard and ensure that your IP is whitelisted.
**Host URL**: Use the following URL for PROD and TEST, respectively:
**Production Environment**: <https://cac-api.cashfree.com> **Test Environment**: <https://cac-gamma.cashfree.com>
# Step 2: Initialization and Authorization
Call the authenticate API to Cashfree system/server to obtain an Authorization Bearer token. All other API calls must have this token as Authorization header in the format 'Bearer <token>' (without quotes) to get processed. Know more about the [authorize](🔗) API.
**Sample Response**
<pre><code>{ "status": "SUCCESS", "message": "Token generated", "subCode": "200", "data": {"token":"eyJ0eXA...fWStg", "expiry":1564130052} }</code></pre>
# Step 3: Create Virtual Account
Create a unique virtual bank account number or UPI ID for each customer to make the payment. Create a virtual account using the [Create Virtual Account /VPA](🔗) API.
**Sample Code to Create a virtual Bank Account**
<pre><code>curl --location --request POST 'https://{Host URL}/cac/v1/createVA' \ --header 'Authorization: Bearer {Token}' \ --header 'Content-Type: application/json' \ --data-raw ' { "vAccountId":"VATEST1", "name":"john doe", "phone":"9876543210", "email":"[email protected]", "remitterAccount":"007711300000000", "remitterIfsc":"Bank0000001" }</code></pre>
**Sample Code to Create a Virtual UPI ID**
<pre><code>curl --location --request POST 'https://{Host URL}/cac/v1/createVA' \ --header 'Authorization: Bearer {Token}' \ --header 'Content-Type: application/json' \ --data-raw ' { "virtualVpaId":"VATEST1", "name":"john doe", "phone":"9876543210", "email":"[email protected]", "remitterAccount":"007711300000000", "remitterIfsc":"Bank0000001" } '</code></pre>
# Step 4: Share Details with Customer for Payments
Share the virtual bank account details or virtual UPI ID with the customers. Customers can make payment through NEFT, RTGS, IMPS, UPI ID, or other UPI applications.
# Step 5: Customer Makes Payment
Customers will make the payment to the virtual bank account that you have shared. Payment can be made through bank transfer or UPI payment method.
# Step 6: Get Notified Instantly for Successful Payments
You get notified instantly on your phone and email when customers make the payment. Ensure you have enabled the notification preferences and added your phone number and email to receive the notifications. The [AMOUNT_COLLECTED](🔗) webhook also notifies you when your customers make the payment. Ensure you have configured webhooks for your account.
**Sample Response**
Transfer to Virtual Bank Account
<pre><code>{ "event": "AMOUNT_COLLECTED", "amount": 3021, "vAccountId": "1234", "vAccountNumber": "808080101234", "email": "[email protected]", "phone": "9876543210", "referenceId": 7606233, "utr": "0212345321344", "creditRefNo": "0976541123", "remitterAccount": "123455666778", "remitterIfsc": "UTIB0000870", "remarks": "UPI", "remitterName": "Cashfree payments", "paymentTime": "2020-09-10 12:06:16", "signature": "fOFgW9+4lpj+VNBuDxQ2TKk1syDXZmqeMZRbaJc87Bk=" }</code></pre>
Transfer to Virtual UPI ID
<pre><code>{ "event":"AMOUNT_COLLECTED", "amount":"400", "vAccountId":"abcd123", "virtualVpaId":"cashmelgabcd123@yesbankltd", "isVpa":"1", "email":"[email protected]", "phone":"9876543210", "referenceId":87654, "utr":"N123456789", "creditRefNo":"0976541123", "remitterAccount":"123455666778", "remitterName":"CASHFREE PAYMENTS", "paymentTime":"2019-07-20 15:27:37", "signature":"8uV792gBZaasJHBFSsfaMHLuqnZKkoBFjw9gEJ8Sx85V+jgbpg4ME=" }</code></pre>
# Step 7: Receive Amount and Reconcile
Cashfree settles the amount to your account as per agreed settlement cycles.
For payments through virtual bank accounts, the settlements are made at 9 AM, 12 PM, 3 PM, and 6 PM on all bank working days.
For payments through Virtual UPI, the settlements are made at 6 PM on all bank working days.
[AMOUNT_SETTLED](🔗) webhook notifies you when the payment is settled to your bank account.
**Sample Response**
<pre><code>{ "event":"AMOUNT_SETTLED", "amount":"25000", "count":"10", "utr":"N123456789" "settlementId":"256" "signature":"8uV792gBZaasJHBFSsfaMHLuqnZKkoBFjw9gEJ8Sx85V+jgbpg4ME=" }</code></pre>