Send a Razorpay payment link the moment a deal is won

By General Input

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.

Integrations

  • Razorpay
  • HubSpot
  • Gmail
  • Slack

Type

Agentic Task

Categories

  • Sales
  • Finance

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.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentWin back LiveChat visitors whose chats went unansweredTurn Mailjet email clicks into ranked HubSpot follow-upsiMessage campaign console with pre-flight checks and delivery boardChat quality review board for LiveChat support leadsA searchable RFP answer library your bid team drafts fromSee which target accounts just started advertising on LinkedInAccount health board that puts product usage next to your CRMLook up a customer's full chat history mid conversationChase the paperwork every new client and vendor still owes