Skip to main content
Cashfree is an India-only payment gateway. Checkout is processed in *INR, other currencies are converted using your configured or live exchange rates. Customers must have a valid phone number in their profile to complete a payment.

Prerequisites

  • Cashfree Account with an activated Payment Gateway
  • Access to the Cashfree Merchant Dashboard
  • Your application ready for integration

Get Your API Credentials

1

Open the Developers section

Log in to the Cashfree Merchant Dashboard and click Developers in the top-right navigation, then go to API Keys under Payment Gateway.
2

Generate your API keys

  • Test environment: API keys are generated automatically.
  • Production environment: Click Generate API Keys and complete the OTP / 2FA authentication. Production keys can only be generated once your Payment Gateway is activated.
3

Copy your credentials

  • App ID (x-client-id): Copy your client App ID.
  • Secret Key (x-client-secret): Copy the secret key and keep it secure — never expose it publicly.
These map to the Client App ID and Client Secret fields in Spartan.

Create Webhook

1

Open the webhook settings

In the Cashfree Dashboard, go to Developers → Webhooks and click Add Webhook Endpoint.
2

Set the webhook URL

Use the webhook callback URL shown on the Spartan Cashfree gateway page. It ends with /api/cashfree/webhook/callback.For example:
https://yourdomain.com/api/cashfree/webhook/callback
Select the latest webhook version from the drop-down, then click Test to verify the endpoint returns a response, and click Next.
3

Select events and save

Select the events you want to monitor (such as successful payment, payment failure, and refunds), then click Add Webhook.

Add Cashfree to Spartan

1

Open the Cashfree gateway

Log in to Spartan as an administrator, then go to Modules → Gateways → Cashfree.Spartan Configuration
2

Enter the Cashfree credentials

Enter the following credentials:
  • Mode: Select Live for production, or Sandbox for testing.
  • Client App ID: The App ID copied from Cashfree.
  • Client Secret: The Secret Key copied from Cashfree. Leave blank to keep the current stored value.
Click Save Settings when complete. Changes take effect immediately after saving.

Troubleshooting

Common Issues

  1. Invalid Credentials
    • Verify the Client App ID and Client Secret are correct for the selected mode (Live vs. Sandbox).
    • Make sure your Payment Gateway is activated to use Live keys.
    • Ensure there are no extra spaces when copying credentials.
  2. Webhook Not Receiving Events
    • Check the webhook URL ends with /api/cashfree/webhook/callback.
    • Verify the webhook URL is accessible publicly.
    • Confirm the endpoint passed the Test check inside Cashfree.
    • Check your server logs for errors.
  3. Payment Processing Failures
    • Ensure the customer has a valid phone number in their profile.
    • Confirm payments are being processed in INR.
    • Check your webhook configuration.