Razorpay URL Generator

Live builder that appends product_name to your Razorpay Payment Page link as you type.

Example: https://pages.razorpay.com/pl_OJxmdxxlQBQghh/view

This will be added as product_name in the URL query parameters.

Generated URL
Your generated URL will appear here as you type.

About This Tool

This tool instantly creates a shareable Razorpay Payment Page link that includes a product_name query parameter. As you type, the final link updates live so you can copy or open it immediately.

How to Use

  1. Paste your Razorpay Payment Page URL in the first field.
  2. Enter the Product Name you want to prefill.
  3. Use Copy to copy the generated link, or Open to test it in a new tab.
Sample Input
URL: https://pages.razorpay.com/pl_OJxmdxxlQBQghh/view
Product Name: Wireless Mouse
Sample Output
https://pages.razorpay.com/pl_OJxmdxxlQBQghh/view?product_name=Wireless%20Mouse

If your base URL already has a query string, the tool will append &product_name=… automatically.

Introduction to Dynamic URL Building and Payment Prefilling

In the highly competitive world of digital commerce, reducing friction during the checkout phase is the key to maximizing sales conversions. Every additional field a customer must fill out, and every extra click they have to make, directly correlates with an increased rate of abandoned shopping carts. Payment gateway platforms like Razorpay provide robust solutions (such as Razorpay Payment Pages) that allow merchants to set up hosted payment forms in minutes. However, a common challenge emerges when a seller has a single, main payment page but wants to sell multiple different variations of a product or dynamically track which specific item led to a purchase. Creating dozens of individual payment pages manually is highly inefficient and creates an administrative burden. Fortunately, Razorpay supports query parameter pre-filling, specifically via the product_name parameter.

By injecting a customized value into the URL query string, merchants can automatically set the product name field on the hosted payment form when the customer lands on the page. This prefilled name remains locked or visible during payment, ensuring that the receipt shows the exact product the customer intended to purchase. Generating these prefilled payment links manually requires a solid understanding of URL query syntax, delimiter characters, and browser-safe character encoding. An automated client-side URL builder simplifies this process, generating clean, ready-to-share links instantly as the user types. Because the tool operates entirely locally in the browser using client-side JavaScript, the merchant's customer-facing links and product names remain completely private, ensuring safe operational security at all times.

Dynamic link pre-filling is particularly useful for email marketing campaigns, social media advertisements, and automated PDF invoice generation. For example, if a merchant sends out an email offering a special discount on a "Premium Leather Wallet", they can generate a direct payment link with product_name=Premium%20Leather%20Wallet. When the recipient clicks the button in the email, the payment page opens with the product details already populated. This seamless transition significantly improves buyer experience and reduces the likelihood of purchase drop-offs, making it a critical strategy for modern digital entrepreneurs.

The History and Evolution of Razorpay and Online Payments in India

To understand the context of Razorpay's data exports and page query features, it is helpful to look at the history of the payment gateway market. Founded in 2014 by Harshil Mathur and Shashank Kumar, Razorpay was established at a time when integrating online payments in India was a complex, multi-week process requiring extensive paperwork, physical server configurations, and unstable merchant APIs. By introducing a developer-centric platform with clean API documentations, easy onboarding, and instant sandbox environments, Razorpay transformed how startups and digital businesses collected money online.

Following the demonetization drive in 2016 and the explosive growth of the Unified Payments Interface (UPI) developed by the National Payments Corporation of India (NPCI), online transactions in India grew exponentially. To manage this massive transaction volume, payment processors evolved from single-payment forms to complex subscription models, payment links, and customizable checkout buttons. During these checkout processes, customers can add multiple separate items to a cart. Because classical relational databases require complex table associations to store multi-item checkouts, payment interfaces often pack the list of items into a single text metadata field. This legacy convenience is why developers today must deal with parsing comma-separated lists when downloading transaction logs, and why prefilled checkout links are highly sought after to streamline customer acquisition.

The Mechanics of URL Structure and Percent-Encoding Standards

To construct dynamic web links programmatically, developers must follow the standards set by the Internet Engineering Task Force (IETF) in Request for Comments (RFC) 3986. A Uniform Resource Identifier (URI) is structured into distinct segments, including the scheme (such as https), the authority or domain (such as pages.razorpay.com), the path (such as /pl_XXXXXX/view), and the query string. The query string begins with a question mark (?) and contains key-value pairs separated by the ampersand (&) symbol.

A key requirement of URI standards is that certain characters are classified as reserved because they serve as syntactic delimiters. These include characters like the forward slash (/), question mark (?), colon (:), and ampersand (&). If a key-value parameter contains these reserved characters—or other non-ASCII characters such as spaces, accented letters, or emojis—they must be converted into a browser-safe format. This process is known as URL encoding or percent-encoding. Under percent-encoding rules, a space is converted to %20, a colon becomes %3A, and a forward slash becomes %2F. By using percent-encoding, the browser guarantees that the query string does not break the standard parsing routines of web servers or intermediate routing nodes.

For instance, if you try to pass the raw string "Premium Coffee & Mug" without encoding, the ampersand (&) will be interpreted as a query parameter separator, causing the parser to think that product_name=Premium Coffee and that there is a new, separate parameter named Mug with no value. This leads to complete truncation of your product title on the checkout form, demonstrating why percent-encoding is mathematically mandatory.

A JavaScript Code Block to Generate Prefilled Payment Links

For software developers building automated billing engines, inventory portals, or custom CRM workflows, generating prefilled URLs programmatically is a frequent task. The following JavaScript code demonstrates a robust function that validates a base payment page URL, handles query string delimiter rules (checking if a question mark already exists in the base link), percent-encodes the product name, and returns the optimized shareable URL:

function buildRazorpayPrefilledUrl(basePaymentUrl, productName) {
  // 1. Validate the base URL format
  let sanitizedUrl = basePaymentUrl.trim();
  if (!sanitizedUrl.startsWith("http://") && !sanitizedUrl.startsWith("https://")) {
    throw new Error("Invalid URL: Must start with http:// or https://");
  }
  
  // 2. Validate and sanitize the product name
  const cleanProduct = productName.trim();
  if (!cleanProduct) {
    throw new Error("Product name cannot be empty.");
  }
  
  // 3. Percent-encode the product name for URI safety
  const encodedProduct = encodeURIComponent(cleanProduct);
  
  // 4. Determine appropriate query parameter delimiter (? or &)
  const hasQuerySymbol = sanitizedUrl.includes("?");
  const separator = hasQuerySymbol ? "&" : "?";
  
  // 5. Construct and return the final prefilled URL
  return `${sanitizedUrl}${separator}product_name=${encodedProduct}`;
}

// Example evaluation
try {
  const baseLink1 = "https://pages.razorpay.com/pl_OJxmdxxlQ/view";
  const productA = "Gourmet Coffee Blend";
  const finalLink1 = buildRazorpayPrefilledUrl(baseLink1, productA);
  console.log("Prefilled Link 1:", finalLink1);
  
  // Case with pre-existing query parameter
  const baseLink2 = "https://pages.razorpay.com/pl_OJxmdxxlQ/view?referrer=email";
  const productB = "Special Edition Mug & Spoon";
  const finalLink2 = buildRazorpayPrefilledUrl(baseLink2, productB);
  console.log("Prefilled Link 2:", finalLink2);
  
  // Output:
  // Prefilled Link 1: https://pages.razorpay.com/pl_OJxmdxxlQ/view?product_name=Gourmet%20Coffee%20Blend
  // Prefilled Link 2: https://pages.razorpay.com/pl_OJxmdxxlQ/view?referrer=email&product_name=Special%20Edition%20Mug%20%26%20Spoon
} catch (error) {
  console.error("URL Generation Failed:", error.message);
}

In this programming code, the built-in JavaScript method encodeURIComponent() is utilized to handle the conversion of the product name. Unlike encodeURI(), which leaves characters like the ampersand (&) unchanged because they are valid URL characters, encodeURIComponent() encodes all delimiters. This is crucial for parameters, as an unencoded ampersand inside a product name (such as "Mug & Spoon") would otherwise be interpreted by the payment gateway as the start of a new, separate parameter field, breaking the input payload.

Furthermore, developers should pay attention to link length limits. While modern browsers can handle URLs containing up to 2,000 characters, legacy systems or social media chat interfaces can occasionally truncate very long query strings. Keeping product names concise ensures that your links remain compatible across all digital messaging platforms.

Strategic Comparison of URL Building Methodologies

To help choose the right link generation strategy for your business operations, the table below compares the differences between manual editing, dedicated builder tools, and automated backend scripts:

Approach Type Operation Methodology Speed of Setup Risk of Encoding Errors Best Use Case Scenario
Manual URL Editing Manually typing query parameters in a text document Very Slow (requires manual character escaping) High (easy to forget %20 for spaces or break separators) One-off quick tests by advanced developers
Dedicated Web Tool Copying inputs into a browser form with live output rendering Instant (fully automated clientside script) Zero (script handles validation and percent-encoding) Marketing teams creating links for campaign campaigns
Backend SDK Scripts Automated functions triggering inside app code blocks Requires code deployment (setup overhead) Low (validated by automated test suites) Dynamic invoices, order receipts, database pipelines

As indicated in the table, using a dedicated clientside web tool provides the ideal balance of speed and safety for marketing and non-technical staff. By automating the validation and character escaping, the risk of breaking links is eliminated. In contrast, manual typing is prone to errors that can lead to broken checkout buttons and lost sales, while backend scripts require programming overhead and deployment schedules.

Frequently Asked Questions (FAQs)

1. What is the Razorpay Payment Page URL Builder?

This builder is a clientside tool that takes a Razorpay Payment Page URL and appends the "product_name" query parameter, encoding spaces and special characters automatically. It generates a clean, ready-to-share link instantly as you type, ensuring that you do not need to manually escape characters or calculate separator configurations yourself.

2. How does the live-updating feature work on this page?

The page uses input event listeners. Every time you paste, type, or delete characters in the URL or Product Name inputs, the JavaScript engine validates the inputs, compiles the query string, and updates the output box instantly without latency, providing immediate feedback on whether your inputs form a valid link.

3. What is the product_name parameter used for in Razorpay?

The "product_name" parameter allows merchants to dynamically set the name of the product being purchased on a hosted payment page. When the customer lands on the page, the payment form reads this parameter and displays the prefilled details, eliminating the need to create hundreds of individual payment pages manually.

4. Why is percent-encoding necessary for product names in URLs?

URLs can only contain specific ASCII characters. Characters like spaces, ampersands, or slashes serve as syntax delimiters. Percent-encoding (like converting a space to "%20") ensures the browser parses the product name correctly without breaking the URL structure, preventing page load failures or parameter truncations.

5. Can this tool handle URLs that already contain query parameters?

Yes. The tool checks if the base URL already contains a question mark (?). If it does, the tool appends the product name parameter using an ampersand (&) delimiter. If not, it starts the query string using a question mark (?), ensuring that your links remain syntactically correct in all situations.

6. Does this URL generator store my payment links on a server?

No. We prioritize your privacy. All processing, validation, and link construction are performed locally inside your browser using client-side JavaScript. No URL paths, product names, or transactional data are uploaded to any external server, keeping your commercial data completely confidential.

7. What happens if I paste an invalid web address in the input field?

The tool includes URL format validation. If you paste a string that does not start with http or https, or fails standard URL structural checks, the tool displays an error warning in the input field and disables the Copy and Open buttons, preventing you from generating broken links.

8. How do I quickly test the generated payment link?

Once you input a valid URL and product name, the "Open" button becomes active. Clicking this button opens the generated link in a new browser tab, allowing you to instantly preview how the payment page looks to a customer and check that the product name is populated correctly.

9. How do I copy the generated URL to my clipboard?

Click the "Copy" button below the output box. The tool uses the modern navigator.clipboard API to copy the link. The button text will temporarily change to "Copied" to confirm that the URL is successfully saved to your device's clipboard, ready to be pasted in chat messages or emails.

10. What does the "Clear" button do?

The "Clear" button resets both input fields, clears out any validation error labels, resets the output box to its placeholder state, disables the action buttons, and returns the cursor focus back inside the URL input field so you can begin generating the next payment link immediately.

11. Can I use this URL builder tool offline?

Yes. Once this webpage is fully loaded in your browser, all processing scripts are stored locally. You can continue to construct and encode prefilled payment links offline without an active internet connection or mobile data coverage, making it highly practical for offline admin work.

12. What is the difference between encodeURI and encodeURIComponent?

encodeURI leaves structural characters like slashes, question marks, and colons intact to preserve a full URL structure. encodeURIComponent encodes all characters, making it perfect for formatting query parameter values like product names where any slash or colon is part of the text.

13. Does this tool support adding other custom parameters?

This specific tool targets the "product_name" parameter. To add other custom parameters, you can append them manually to the end of the generated link using standard query syntax, such as adding "&amount=500" or "&[email protected]" for customer details prefilling.

14. Why are the Copy and Open buttons disabled at first?

The buttons are disabled to prevent users from copying incomplete or invalid links. They only become active once the tool validates that a structurally correct URL and a non-empty product name are present in the input fields, ensuring quality control in your marketing links.