Cashfree and Pega Integration
Cashfree Payments is a payments and banking technology company that enables businesses in India to collect payments online and make payouts.
Step 1 : Login or signup at cashfree.com and switch to test environment https://merchant.cashfree.com/merchants/landing?env=test
Step 2 : Click on "Try Test Environment" under the Payment gateway
Step 3 : Go to the developers option under the left nav bar
Step 4 : Click on API keys and generate the keys and download them we would be using them for our REST connect
--------------------------------------------------------------------------------------------------------------
PEGA CONFIGURATION
Step 1 : We would be requiring to create two REST connects 1) To create a new order for a payment ( Every payment is considered as an order for Cashfree ) and 2) Verify the payment status (Validation)
a) Create Order :
1) Configure -> Integration -> Connectors -> Create REST Integration
2) Configure in the following way
Endpoint : https://sandbox.cashfree.com/pg/orders
Headers : Add the following
1) x-api-version
2) x-client-id
3) x-client-secret
Click on Next
3) Choose POST Method and continue
4) Click + Add response and enter your client ID and secret from the dashboard you download , pass the x-api-version as 2022-01-01
In the request body use the following json,
{
"order_id": "order_1626945143520",
"order_amount": 10.12,
"order_currency": "INR",
"order_note": "Additional order info",
"customer_details": {
"customer_id": "12345",
"customer_name": "name",
"customer_email": "techsupport@cashfree.com",
"customer_phone": "9816512345"
}
}
5) Proceed and choose to create a new datapage , in any of your desired class structure
and generation process happens
b) Check Payment Status :
1) Create another REST integration with endpoint URL : https://test.cashfree.com/api/v2/orders/{orderID}/status
and add the same headers as before
2) Proceed with the method as "GET" as we are going to get the payment status
3) In orderID param use one of the orderID from the response you got from the previous connect-rest to check its status
4) You will see the response for the paymentStatus
5) Continue with generation process
Step 2 : Create a Sample Casetype (optional to test) :
Use the following fields and add a button to invoke our connectors
2) Add actions to the button in the following way :
pass the Amount as a parameter to your activity
a ) Optionally in your CreateOrder - datapage you can pass some fields like name phone number as a param to your requestDT , in my case I pass the Amount field alone as a param
b) Similarly in your GetStatus datapage pass your OrderID from the CreateOrder ConnectREST
c) Activity Config : This is my way of approach, feel free to go with your way
d) Make sure to pass the paymentLink to your open URL window to start the payment checkout
3) Validation : Additionally to check whether user has made payment you can use the getStatus datapage (2nd connect rest response) to proceed with case or not
My Sample activity to check the same ,
Thanks for reading, I hope the steps are clear feel free to reach out with any concerns :)
Obtaining an aggregator license in India is a crucial step for businesses in the transportation, logistics, and digital marketplace sectors. It ensures compliance with government regulations and builds trust with users. The process can be complex, requiring thorough documentation and adherence to guidelines. Leveraging professional assistance simplifies the process and ensures a smooth application experience. Securing this license is vital for operating legally and sustainably in the growing aggregator ecosystem.
ReplyDelete