Documentation Index
Fetch the complete documentation index at: https://docs.payglocal.in/llms.txt
Use this file to discover all available pages before exploring further.
What is CodeDrop?
With a standard PayCollect integration, clicking “Pay” redirects the customer away from your page to PayGlocal’s hosted checkout. CodeDrop removes that redirect entirely. Instead, the payment form opens as a modal, drawer, or inline widget directly on your page. When the payment is complete (or cancelled), the form closes itself automatically and your callback function receives the result — the customer never leaves your site.Modal
A dialog appears centered over your page. Customer’s focus is locked on payment. Most common choice.
Drawer
Slides in from the side of the screen. Cart or order summary stays visible behind it.
Inline
The payment form embeds directly within your page layout. Feels completely native to your checkout.
CodeDrop is a presentation layer on top of PayCollect — the underlying API, security, PCI rules, and supported payment methods are identical. No separate backend integration is needed.
How It Works
Backend Implementation
Before CodeDrop can launch, your backend needs to call PayGlocal’s Initiate Payment API and return theredirectUrl to your frontend.
Create an API endpoint on your server that:
- Calls PayGlocal’s
POST /gl/v1/payments/initiate/paycollect - Returns the
redirectUrlfrom the response to your frontend
redirectUrl to window.PGPay.launchPayment().
Frontend Integration
Step 1 — Get Enabled for CodeDrop
CodeDrop must be enabled for your Merchant ID by PayGlocal’s operations team. Contact your account manager to request enablement. They will provide you acdId — a unique identifier for your CodeDrop configuration.
Step 2 — Add the Script Tag
Add the following script tag to your HTML<head> or at the end of <body>:
| Environment | URL |
|---|---|
| UAT (Testing) | https://codedrop.uat.payglocal.in/simple.js |
| Production | https://codedrop.payglocal.in/simple.js |
| Value | Behaviour |
|---|---|
drawer | Slides in from the side (default & recommended) |
modal | Opens as a dialog box on top of the page |
inline | Embeds within the page (requires additional setup — see Step 3) |
<cdId> with the ID provided by PayGlocal. For example, for a modal in UAT with cdId 123456789:
Step 3 — Add Payment Container (Inline mode only)
If you choseinline display mode, add a container <div> at the exact location in your page where the payment form should appear:
id="PayGlocal_payments"is mandatory and must be exactly this valuedata-widthis optional — accepted range is350pxto450px, default is400px
modal and drawer modes.
Step 4 — Launch the Payment Form
When the customer clicks your payment button, call your backend to get theredirectUrl, then pass it to CodeDrop:
axios:
<merchantPayNowApi> with your own backend endpoint that returns the redirectUrl.
Step 5 — Handle the Payment Callback
After the payment completes, is cancelled, or is abandoned, CodeDrop invokes your callback function with the payment result. Pass the callback as the second argument tolaunchPayment():
data object passed to your callback contains:
Step 6 — Custom Pay Now Action (Inline mode only)
If you have hidden the default PayNow button inside the inline payment form, expose your own button and wire it to:onclick of your own PayNow button. The event parameter is the click event and is mandatory.
Step 7 — Pass Updated Billing & Shipping Details (Inline mode only)
If your billing and shipping forms are on the same page as the inline payment widget, the customer might update their address while interacting with the payment form. To keep the payment form in sync, call:merchantPayload format:
billingData, shippingData, or both. Any field you omit is left unchanged. Data entered directly by the customer in the payment form always takes highest priority.
For the Full Technical Reference with Code Examples
CodeDrop API Reference
Complete integration reference with annotated code examples for every step.

