Skip to main content

🛠️ 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:
Optional query parameters:

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: After saving, share these securely with the Paytring team so they can complete the integration on your behalf.

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 like main-cart-footer.liquid
  • Cart drawer / mini cart Files: cart-drawer.liquid, sections/cart-drawer.liquid, snippets/cart-drawer-footer.liquid
Use Shopify’s code search to look for:
  • checkout
  • btn--checkout
  • name="checkout"

✏ Step 2: Identify the button code

The button could look like:
or
etc …

⚙ Step 3: Replace it with your custom button

If it’s an <a> tag → replace with <button>:

Optionally add:
to trigger Paytring checkout.

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
Example final button:

⚠ 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" and type="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:
or sometimes:
Files are usually 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

Place it exactly where the removed button was.

⚙ Step 4: Render your Buy Now button

Right after including the Paytring CDN scripts, add:

We have multiple styling options for this buy button


✅ 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 in theme.liquid:

7️⃣ Restrict Paytring checkout to certain countries

Also in theme.liquid, add:
Replace with your target country codes. This ensures: ✅ Only users from allowed countries see Paytring checkout ✅ Others see Shopify’s default checkout

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:
with the visitor’s detected country code. You only need to add a listener to react when this happens.

How to add the listener

Add this script after your Paytring CDN scripts (for example, in theme.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
In these cases, your initial DOM updates (like replacing or hiding the button) might not work immediately, because the elements don’t yet exist in the HTML.

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