Send a Razorpay payment link the moment a deal is won
When a HubSpot deal hits Closed Won, we create the payment link, email it to the customer, and log it back on the deal so nothing slips.
When a HubSpot deal moves to Closed Won, collect the money without anyone opening Razorpay. Trigger this on a HubSpot webhook for a deal stage change, and only act when the new stage is Closed Won. Ignore every other stage change.
Start by reading the deal with the HubSpot Get Deal operation, pulling the deal name, the amount, the deal currency, the stage and the associated contact. Then read that contact with HubSpot Get Contact to get their name, email address and phone number. Keep the HubSpot deal id from the webhook, because it is the key that ties everything together later.
Before creating anything, check the deal is safe to bill. Skip it if there is no amount, if the amount is zero, or if there is no associated contact with an email address. Also confirm the deal currency is INR, because the Razorpay payment link is created in Indian rupees and billing a dollar figure as rupees would be wrong. When a deal fails any of these checks, do not create a link and do not email anyone. Post it to Slack with the Send a Message operation instead, naming the deal, its owner and exactly what is missing, so someone can fix the record rather than silently dropping the sale.
For deals that pass, create the link with the Razorpay Create a Payment Link operation. Razorpay expects the amount in paise, so multiply the HubSpot deal amount by 100 and send a whole number: a deal worth 25000 becomes 2500000. Set the currency to INR. Fill the customer name, email and contact from the HubSpot contact, and write a description that names the deal. Stamp the HubSpot deal id into the Razorpay notes field under a key such as hubspot_deal_id, so any payment that arrives can always be traced back to the deal. Notes accept up to 15 key value string pairs, so add the deal name and deal owner there as well. Leave Razorpay's own SMS and email notifications off, because we send the email ourselves through Gmail and do not want the customer contacted twice.
Email the link to the contact with the Gmail Send a Message operation. Keep it short and invoice style: address them by first name, name the deal, state the amount in rupees, include the payment link, and sign off from the deal owner. No marketing copy and no long preamble, this is a request for payment.
Then write the result back onto the record. Use HubSpot Create Note to attach a note to the deal holding the payment link URL and the Razorpay payment link reference, which is the id beginning with plink_, so finance can match an incoming payment to a deal later. Use HubSpot Update Deal to set a payment status property on the deal, for example to Payment link sent, so the pipeline shows at a glance which won deals have been asked to pay.
Two rules to keep this quiet and safe. First, if the deal already has a payment link recorded on it, do not create a second one, just stop, because deal stage changes can fire more than once for the same deal. Second, post one clear Slack message per skipped deal rather than a batch summary, so each broken record can be picked up and fixed on its own.
Treat the CRM as swappable. This is staged against HubSpot because it is the most commonly paired CRM, but the same shape works on a Salesforce or Pipedrive pipeline: read the won deal, create the link for the deal amount, email it to the contact, and write the link and its reference back onto the record.
Example output
What does this prompt do?
- Watches your HubSpot pipeline and reacts the moment a deal is marked Closed Won.
- Creates a Razorpay payment link for the exact deal amount, with the customer's name and email already filled in.
- Emails the customer a short invoice style note naming the deal and the amount, then files the link and its reference back on the deal record.
- Posts any deal missing an amount, a contact email, or the right currency to Slack, so someone can fix the record instead of losing the sale.
What do I need to use this?
- A HubSpot account with a pipeline where deals move into a Closed Won stage.
- A Razorpay account that can accept payments in Indian rupees.
- A Gmail account to send the payment emails from.
- A Slack workspace and a channel where records that need fixing get flagged.
- A field on the HubSpot deal to hold the payment status, so you can see at a glance who has been asked to pay.
How can I customize it?
- Change which pipeline stage sets it off, so the link goes out at signed contract rather than Closed Won.
- Reword the customer email, add your payment terms, or put an expiry date on the link.
- Pick the Slack channel for problem records, and set an amount above which a person reviews the link before it goes out.
FAQs
Will this work on HubSpot Free?
What happens if a won deal has no amount or no contact email?
Does this work for currencies other than Indian rupees?
Can I use it with a different CRM?
Could a customer be emailed twice if the deal is edited again?
How do we match a payment back to the deal it came from?
Related templates
When your flight moves, your calendar times get corrected automatically and you get a Slack note naming the meetings you're about to miss.
Every 15 minutes, forwarded phishing reports get traced back to the server that really sent them, with a verdict in Slack and the worst senders reported.
Twice every weekday, the conversations from your social inbox land on the right HubSpot contact timelines, with a Slack recap for sales.
Every weekday at 7am, sign in to the tender portals you track, filter new notices against your bid criteria, and open a deal for the ones worth chasing.
Every morning, find the addresses that hard bounced or filed a spam complaint, update the matching HubSpot contacts, and post a short Slack recap.
When a HubSpot deal hits Closed Won, the customer's plan, seats and renewal dates land in your DynamoDB accounts table, with a Slack note showing what changed.
Stop chasing payments by hand after every win.
Let every Closed Won deal send its own payment link, with the customer emailed and the record updated before anyone opens Razorpay.