Sandbox Environment for Embedded Payments Partners

In this section, you will learn how to use the test environment for Embedded Payments Partners along with its features.

Build and safely test your Embedded Payment Gateway Integration in our Sandbox ('Test') Environment developed exclusively for Embedded Payments Partners. Our aim is to streamline the integration process for developers seeking to incorporate our Payments and/or Onboarding APIs & Webhooks into their software platforms.

This dedicated testing environment is crafted to cater to the needs of developers, providing them with a robust space to experiment, simulate, and seamlessly code our development solutions within their platforms. With our Sandbox Environment, developers can confidently test and refine their integrations, ensuring a smooth and efficient implementation of our APIs and Webhooks.

Advantages

  • Safe Testing: You can conduct thorough testing without affecting real transactions. This safeguards your live environment while refining payment flows.
  • Realistic Simulations: You can mimic real-world scenarios with our realistic simulations. You can as well test various payment methods, edge cases, and user interactions effortlessly.
  • Enhanced Debugging: You can diagnose and troubleshoot issues effectively with detailed error reporting. Identify and resolve potential challenges before you impact your live users.

How to Simulate Working Environment in Sandbox?

To begin with, login to your Partner Dashboard > and click the Switch to Test option. The dashboard will switch to the Test Environment (sandbox). There will be a visible label at the top to let you identify that you are in the Test Environment.

Switch To Test

Switch To Test

When you are in the test environment, the "Switch to Test" button will change to “Switch to Prod”. You can use it to switch back to the live environment.

While operating within the test environment, you have the capability to simulate essential features of the payment gateway. This empowers you to replicate and test the necessary functionalities vital for the seamless operation of the payment gateway system.

You can add new merchants from the Merchants section through the Add Merchant option. The added merchant will be enabled in test environment with payment gateway activated and default pricing.

❗️

Only Business Name, Registered Email and Phone Number are mandatory when adding a merchant in the test environment. You can then select the checkbox "I agree to the terms and conditions" and submit the form.

This activation takes upto 5 mins. Refresh the Merchants tab to recheck the activation status.

Please note that KYC is required for activating merchants in the live environment.

Add Merchant - Test Environment

Add Merchant - Test Environment

You can access the Developers tab, and generate Partner API Key and configure Partner Webhooks as well. Once done, you can follow integration steps mentioned in the Embedded Payment Gateway Integration guide.

Generate API Keys - Test Environment

Generate API Keys - Test Environment

Sample request to Create an Order -

curl --location 'https://sandbox.cashfree.com/pg/orders' \
--header 'x-partner-apikey: {{partnerAPIKey}}' \
--header 'x-partner-merchantid: {{partnermerchantId}}' 
--header 'x-api-version: 2022-09-01' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
  "order_amount": "10",
  "order_currency": "INR",
  "customer_details": {
    "customer_id": "USER123",
    "customer_name": "joe",
    "customer_email": "[email protected]",
    "customer_phone": "+919876543210"
  },
  "order_meta": { 
    "return_url": "https://b8af79f41056.eu.ngrok.io?order_id={order_id}",
    "notify_url": "https://b8af79f41056.eu.ngrok.io/webhook.php",
  }
}'

Sample request to Get Order details -

curl --request GET \
     --url https://sandbox.cashfree.com/pg/orders/{{order_id}}\
     --header 'x-partner-apikey: {{partnerAPIKey}}' \
     --header 'x-partner-merchantid: {{partnermerchantId}}'
     --header 'accept: application/json' \
     --header 'x-api-version: 2022-09-01'

Apart from this, you can simulate payments using payments methods such as Card, UPI, and other payment modes that are part of the integration. Other features like Summary, PG Orders, Reports will also work in Test Environment

ℹ️

The data between Live and Test environments is completely isolated. Any data changes (eg. merchant addition, order creation etc.) in this environment will not happen in Live, and vice versa. These are not live transactions, these are just simulations. No fund movement will occur.


Partner Webhooks

You can also configure webhooks in the test environment. To configure partner webhook,

  1. Go to Partner Dashboard > Developers > Webhooks.
Configure Webhooks

Configure Webhooks

  1. Click Add Webhook URL and enter the URL where you want to receive the updates.
  2. Select the events for which you want to configure the webhooks to receive updates, and click Add Webhook.

Notifications will be sent to your configured endpoint as a POST request with the body containing the various parameters specifying the details of each event. Each request contains an event parameter that identifies its type.

We support webhooks in both encoded and JSON formats.


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