Skip to content

Lantern Analytics for Cashfree

Cashfree analytics: revenue by channel, campaign and country

Connect Cashfree Payments to Lantern with a webhook and see which channels, campaigns and AI assistants bring the customers who pay, in rupees.

What Cashfree can't tell you

Cashfree shows you settlements and payment success rates. Lantern adds the other half: where each paying customer came from before they reached your checkout.

Lantern is web analytics for founders. Its script records where every visitor comes from: Google, Reddit, a campaign, or an AI assistant like ChatGPT. Connect Cashfree and each payment is credited to the channel, referrer, campaign, country and landing page that first brought that customer, even when they paid days or weeks later.

Lantern's Sources card with a revenue column next to visitors for each channel: Organic Search, Direct, Social, AI, Referral, Email and Paid
Revenue by channel on Lantern's dashboard, next to the visitors each channel sent.

How Lantern connects to Cashfree

  • API key: None needed. Cashfree has no API for listing past payments.
  • Webhook: Add Lantern's URL under Developers → Webhooks for the Payment Gateway. Paste your secret key into Lantern so it can verify Cashfree's signature on every webhook.
  • History on connect: From the moment you connect.

Webhook events to subscribe to: PAYMENT_SUCCESS_WEBHOOK, REFUND_STATUS_WEBHOOK. Everything is set up from your site's Settings → Revenue panel, which shows the webhook URL and the exact steps.

Set it up

  1. Start a free trial and add your website. Paste the setup prompt into your coding agent, or add one script tag.
  2. Pass the visitor id to Cashfree: put lantern_visitor_id in order_tags on the order. If the customer is signed in, add lantern_user_id with the id you pass to identify.
  3. Open Settings → Revenue → Cashfree in Lantern and connect it.
Creating a Cashfree order (Payment Gateway API)
const order = await cashfree.PGCreateOrder({
  order_amount: 499,
  order_currency: "INR",
  customer_details: {
    customer_id: user.id,
    customer_email: user.email,
    customer_phone: user.phone,
  },
  order_tags: {
    lantern_visitor_id: visitorId, // window.lantern?.visitorId?.(), sent from the browser
    lantern_user_id: user.id,
  },
});

Renewals and refunds don't need tagging. They share the customer and subscription of the first payment, so Lantern credits them to the same channel.

Good to know

  • Connect before a launch: without a history import, Lantern counts payments from the moment the webhook is added.
  • Refunds are subtracted from the order they reverse.
  • Amounts arrive in rupees and are shown exactly as paid.

Questions

Why doesn't Lantern import my past Cashfree payments?

Cashfree's API has no endpoint for listing past payments, so Lantern starts counting when you add the webhook.

Is the Cashfree secret key required?

It's optional but recommended. Cashfree signs webhooks with it, so with the key Lantern rejects anything that didn't come from Cashfree. Without it, the unguessable webhook URL is the only check.

Does it work with UPI?

Yes. Lantern reads successful payments from Cashfree whatever the payment method.

Other payment providers

Lantern also connects to Razorpay, Stripe, Dodo Payments, Paddle, Polar and Lemon Squeezy. Connect more than one to the same site and Lantern adds them up.