🛠️ Integration Guide
This guide will help you seamlessly integrate Paytring Quick Checkout into your Shopify/Other store, replacing platform’s default checkout buttons & keeping the user experience smooth.1️⃣ Add Paytring CDN scripts to theme.liquid
Paste these lines inside your theme.liquid
file, ideally before the closing </body>
tag:
Parameter | Values | Purpose |
---|---|---|
env | prod | uat | local | Choose your environment |
iframe | true | false | Whether to render checkout in an iframe |
style | phone | Apply preset button styling whether it’s mobile view or not |
2️⃣ Create a Shopify App with required permissions
✅ Admin API access scopes (32 total)
🌐 Storefront API access scopes
📦 Step 2.1: Store and share app credentials
Once the app is created, securely store the following four parameters:Parameter | Purpose |
---|---|
Admin API access token | Use your access token to request data from the Admin API |
API key | Public key for your Shopify app |
API secret key | Private secret used for app authentication |
Storefront API access token | Use your access token to request data from Storefront API |
3️⃣ Replace the default checkout button
🔍 Step 1: Locate your checkout buttons
Shopify usually has two main places with checkout buttons:- Main cart page
Files:
cart.liquid
,cart-template.liquid
, or sections likemain-cart-footer.liquid
- Cart drawer / mini cart
Files:
cart-drawer.liquid
,sections/cart-drawer.liquid
,snippets/cart-drawer-footer.liquid
checkout
btn--checkout
name="checkout"
✏ Step 2: Identify the button code
The button could look like:⚙ Step 3: Replace it with your custom button
If it’s an <a>
tag → replace with <button>
:
If it’s already a <button>
:
- Keep it a
<button>
- Change
type
to"button"
- Add
id="magic-checkout-button"
- Add
onclick="TRIGGER_QUICK_CHECKOUT()"
if your id is not triggering checkout
⚠ Step 4: Do this for both:
- The main cart page (
cart.liquid
or similar) - The cart drawer (
cart-drawer.liquid
or similar)
✅ Checklist
- Find checkout buttons
- Replace
<a>
with<button>
(or adjust<button>
) - Add
id="magic-checkout-button"
andtype="button"
- Add
onclick="TRIGGER_QUICK_CHECKOUT()"
if needed
4️⃣ Add Buy Now button (Product Page)
Let your customers buy directly from the product page, skipping the cart.🔍 Step 1: Find Shopify’s dynamic checkout button
Typically:product.liquid
, sections/main-product.liquid
, or similar.
✏ Step 2: Remove or comment out Shopify’s default button
📦 Step 3: Add the placeholder for Paytring button
⚙ Step 4: Render your Buy Now button
Right after including the Paytring CDN scripts, add:We have multiple styling options for this buy button
Option | Example | Notes |
---|---|---|
backgroundColor | "#003c23" (hex code) | Button background color |
borderRadius | "1rem" | CSS border radius property |
padding | "0px 0px 0px 0px" | CSS padding; usually in px |
fontSize | "16px" | Button font size |
width | "100%" | Width in percentage |
gap | "8px" | Space between internal elements, if any |
✅ Quick summary:
- Find and remove Shopify’s default payment button
- Add
<div id="quick-checkout-div"></div>
- Include CDN scripts
- Add JS to render your Buy Now button
5️⃣ Notify business team & set webhook into paytring dashboard
- Notify the business team after each shop integration
- Set webhook URL to:
6️⃣ Pass your shopify logged-in customer data to Paytring
Above your CDN scripts, add below js snipet intheme.liquid
:
7️⃣ Restrict Paytring checkout to certain countries
Also intheme.liquid
, add:
8️⃣ Listen to detected country and add custom logic
If your store already uses a geo‑detection script or service, it may automatically dispatch a custom event named:✏ How to add the listener
Add this script after your Paytring CDN scripts (for example, intheme.liquid
):
📍 Why add this
This lets your shop:- React dynamically whenever the visitor’s country is detected or changes
- Add custom UX behavior per country
- Keep your checkout flow flexible and localized for different regions
⚠ Important: You do not need to dispatch or emit the event yourself. Your geo‑detection system or script will already emit it automatically.
✅ Tip:
-
You can combine this listener with Paytring’s built‑in method:
to:
- Automatically limit Paytring checkout to specific countries
- And add extra client‑side behaviors — like showing custom messages, changing styling, or falling back to Shopify’s native checkout when the detected country isn’t supported
- You can add your custom script to update the button visibility
9️⃣ Handle dynamic or shadow DOM checkout buttons (advanced)
In some Shopify themes or custom storefronts, checkout buttons may:- Be added dynamically after page load
- Appear inside shadow DOM elements
- Or change based on product or cart updates
⚙ Solution: Run a script at custom intervals
You can add a script that runs every few milliseconds to repeatedly check for the target button and update it when it appears. Here’s an example:📍 Why add this
- Handles buttons rendered after initial page load
- Works even when elements are created dynamically by JavaScript
- Useful when you don’t have direct access to edit theme code deeply
⚠ Important: Keep the interval reasonably short (e.g., 100–500 ms) to avoid performance issues. Optionally, stop the interval once your changes succeed (using
clearInterval
).
✅ Tip: This method is especially useful for:
- Custom themes with heavy JavaScript
- Themes using shadow DOM or dynamic cart drawers
- When default liquid template changes alone aren’t enough