How do I add a custom “Pay with Crypto” button that dynamically grabs the price and redirects

Hi everyone,

I’m trying to add a custom “Pay with Crypto” button to both my product page and cart page that:

  1. Matches the current design and placement of the existing payment buttons (just below “Add to Cart” or “Checkout”).

  2. Dynamically grabs the product or cart total price (in USD).

  3. Redirects the customer to a NOWPayments crypto checkout page using their API.

Here’s what I need help with:

How can I reliably target the product price and cart total using JavaScript in the Rebel theme?

Where exactly should I insert the button and script to avoid Shopify’s form submission errors (especially when an item is sold out)?

Any tips on keeping the styling consistent and Shopify-safe while triggering the external payment redirect?

I’ve tried adding the button to main-product.liquid and calling the NOWPayments API via JS, but I get a “Payment creation failed” error — likely because the script isn’t reading the price correctly.

Any help or sample code would be hugely appreciated!

Thanks in advance.

Best,

Rowan

Hi there,

Thank you for your message.

It’s quite frustrating trying to get this button to work. I’ve never done any type of coding. Would it be possible to tell me where exactly to paste the code and what code I should use for it to work please? I’ve been using ChatGPT to write the code. I’ve been pasting this code at line 477 of the sections/main-product.liquid (with API key omitted of course):

Pay with Crypto

Thank you for all your help!

Best,

Rowan