Add crypto payments to any website in minutes. Works with Shopify, WooCommerce, custom sites, or any platform.
Copy and paste this single script tag into any website. It creates a "Pay with Crypto" button that opens the GroundedPay checkout modal.
<script src="https://groundedpay.com/embed.js"
data-merchant-id="YOUR_MERCHANT_ID"
data-amount="49.99"
data-currency="USD"
data-order-id="order-123"></script>
The button renders right where you place the script tag. When clicked, it opens a checkout modal overlay.
Add data-button-style="floating" to show a fixed-position button in the bottom-right corner of the page:
<script src="https://groundedpay.com/embed.js"
data-merchant-id="YOUR_MERCHANT_ID"
data-amount="49.99"
data-button-style="floating"
data-button-text="Pay with Crypto"></script>
Use data-button-position with a CSS selector to inject the button into a specific element:
<div id="crypto-pay-container"></div>
<script src="https://groundedpay.com/embed.js"
data-merchant-id="YOUR_MERCHANT_ID"
data-amount="49.99"
data-button-position="#crypto-pay-container"></script>
| Attribute | Default | Description |
|---|---|---|
data-merchant-id | Required | Your GroundedPay merchant ID |
data-amount | Required | Payment amount (e.g., "49.99") |
data-currency | USD | Currency code |
data-order-id | -- | Your order/invoice ID for tracking |
data-callback-url | -- | Webhook URL to call when payment confirms |
data-success-url | -- | Redirect URL after successful payment |
data-button-text | Pay with Crypto | Button label |
data-button-style | inline | inline or floating |
data-button-color | #6366f1 | Button background color |
data-button-text-color | #ffffff | Button text color |
data-button-position | -- | CSS selector to inject button into |
data-gateway-url | https://groundedpay.com | Override for self-hosted gateways |
After the embed script loads, you can use the window.GroundedPay object for programmatic control:
// Trigger a payment programmatically
GroundedPay.pay({
amount: 49.99,
currency: 'USD',
orderId: 'order-456',
callbackUrl: 'https://yoursite.com/webhook',
successUrl: 'https://yoursite.com/thank-you',
onCreated: function(data) { console.log('Payment created:', data.payment_id); },
onError: function(err) { console.error('Error:', err.message); }
});
// Render a button into a specific container
GroundedPay.renderButton(document.getElementById('pay-here'), {
amount: 29.99,
buttonText: 'Buy Now with Crypto',
buttonColor: '#22c55e'
});
// Close the checkout modal
GroundedPay.close();
// Listen for confirmed payments
window.addEventListener('groundedpay:confirmed', function(e) {
console.log('Payment confirmed:', e.detail.payment_id);
});
Override button styles with CSS using the .groundedpay-btn class:
.groundedpay-btn {
border-radius: 4px !important;
font-size: 14px !important;
padding: 12px 20px !important;
}
For Shopify stores, use the dedicated Shopify embed that automatically detects cart totals and injects the button next to your checkout button.
<script src="https://groundedpay.com/embed-shopify.js"
data-merchant-id="YOUR_MERCHANT_ID"></script>
The script automatically:
| Attribute | Default | Description |
|---|---|---|
data-merchant-id | Required | Your GroundedPay merchant ID |
data-button-text | Pay with Crypto | Button label |
data-button-color | #6366f1 | Button background color |
data-button-text-color | #ffffff | Button text color |
data-button-position | after-checkout | after-checkout, before-checkout, or custom:#selector |
Add crypto payments to your WooCommerce store by embedding the universal snippet in your theme.
<script src="https://groundedpay.com/embed.js"
data-merchant-id="YOUR_MERCHANT_ID"
data-button-style="floating"
data-button-text="Pay with Crypto"></script>
<!-- Set amount dynamically from WooCommerce cart -->
<script>
document.addEventListener('DOMContentLoaded', function() {
// Read cart total from WooCommerce checkout page
var totalEl = document.querySelector('.order-total .amount') ||
document.querySelector('.cart-subtotal .amount');
if (totalEl) {
var amount = parseFloat(totalEl.textContent.replace(/[^0-9.]/g, ''));
if (amount > 0 && window.GroundedPay) {
// Remove the auto-generated floating button
var autoBtn = document.querySelector('.groundedpay-btn');
if (autoBtn) autoBtn.remove();
// Render button with correct amount next to checkout
var target = document.querySelector('.wc-proceed-to-checkout') ||
document.querySelector('#place_order').parentElement;
if (target) {
GroundedPay.renderButton(target, {
amount: amount,
orderId: document.querySelector('input[name="order_id"]')?.value
});
}
}
}
});
</script>
Add this to your theme's functions.php for cleaner integration:
// Add GroundedPay crypto payments
add_action('wp_footer', function() {
if (is_checkout() || is_cart()) {
$total = WC()->cart->get_total('edit');
echo '<script src="https://groundedpay.com/embed.js"
data-merchant-id="YOUR_MERCHANT_ID"
data-amount="' . esc_attr($total) . '"
data-button-position=".wc-proceed-to-checkout"
data-button-text="Pay with Crypto"></script>';
}
});
For any custom-built website or web app, you have full flexibility.
If you know the amount at page load (e.g., a product page with a fixed price):
<!-- Place this where you want the button -->
<div id="pay-button"></div>
<script src="https://groundedpay.com/embed.js"
data-merchant-id="YOUR_MERCHANT_ID"
data-amount="99.99"
data-order-id="INV-2024-001"
data-callback-url="https://yoursite.com/api/payment-webhook"
data-success-url="https://yoursite.com/thank-you"
data-button-position="#pay-button"></script>
Calculate the amount at runtime (e.g., shopping cart, dynamic pricing):
<!-- Load the embed (no data-amount = no auto-button) -->
<script src="https://groundedpay.com/embed.js"
data-merchant-id="YOUR_MERCHANT_ID"></script>
<div id="checkout-area"></div>
<script>
// Calculate amount from your cart/order
var cartTotal = calculateCartTotal(); // your function
// Render button with dynamic amount
GroundedPay.renderButton(document.getElementById('checkout-area'), {
amount: cartTotal,
orderId: 'order-' + Date.now(),
callbackUrl: 'https://yoursite.com/api/payment-webhook',
successUrl: 'https://yoursite.com/thank-you',
buttonText: 'Pay $' + cartTotal.toFixed(2) + ' with Crypto'
});
// Or trigger payment directly from your own button:
document.getElementById('my-pay-btn').addEventListener('click', function() {
GroundedPay.pay({
amount: cartTotal,
orderId: 'order-' + Date.now(),
callbackUrl: 'https://yoursite.com/api/payment-webhook',
successUrl: 'https://yoursite.com/thank-you'
});
});
</script>
// Express webhook handler
app.post('/api/payment-webhook', (req, res) => {
const { event, payment_id, status, amount, order_id, tx_hash } = req.body;
if (event === 'payment.confirmed') {
// Mark order as paid in your database
db.markOrderPaid(order_id, {
paymentId: payment_id,
txHash: tx_hash,
amount: amount
});
// Send confirmation email, fulfill order, etc.
sendConfirmationEmail(order_id);
}
res.json({ received: true });
});
For headless / server-to-server integrations, use the REST API directly. No JavaScript embed needed.
Base URL: https://groundedpay.com
Create a new crypto payment.
{
"amount": 49.99,
"currency": "USD",
"merchant_id": "YOUR_MERCHANT_ID",
"order_id": "order-123",
"callback_url": "https://yoursite.com/webhook",
"coin": "usdc"
}
| Field | Type | Description |
|---|---|---|
amount | number | Required Payment amount |
currency | string | Currency code (default: "USD") |
merchant_id | string | Required Your merchant ID |
order_id | string | Your order/invoice ID |
callback_url | string | Webhook URL for payment confirmation |
coin | string | Crypto: "usdc" (default), "usdt", "eth", "btc" |
{
"payment_id": "a1b2c3d4-...",
"status": "pending",
"coin": "usdc",
"chain": "base",
"amount": 49.99,
"currency": "USD",
"amount_crypto": "49.99",
"payment_address": "0x...",
"qr_code": "data:image/png;base64,...",
"qr_uri": "ethereum:0x...@8453?value=49.99",
"expires_at": "2026-04-12T12:00:00.000Z",
"checkout_url": "https://groundedpay.com/checkout.html?payment=a1b2c3d4-..."
}
Check the status of a payment.
{
"payment_id": "a1b2c3d4-...",
"status": "confirmed",
"coin": "usdc",
"chain": "base",
"amount": 49.99,
"currency": "USD",
"amount_crypto": "49.99",
"payment_address": "0x...",
"order_id": "order-123",
"tx_hash": "0xabc...",
"confirmations": 12,
"confirmed_at": "2026-04-12T11:35:00.000Z"
}
| Status | Description |
|---|---|
pending | Awaiting payment |
detected | Transaction seen on chain, awaiting confirmations |
confirmed | Payment confirmed on blockchain |
expired | Payment window expired (no transaction received) |
When a payment is confirmed, GroundedPay sends a POST request to your callback_url:
POST https://yoursite.com/webhook
Content-Type: application/json
{
"event": "payment.confirmed",
"payment_id": "a1b2c3d4-...",
"status": "confirmed",
"amount": 49.99,
"currency": "USD",
"coin": "usdc",
"chain": "base",
"amount_crypto": "49.99",
"tx_hash": "0xabc...",
"order_id": "order-123",
"confirmed_at": "2026-04-12T11:35:00.000Z",
"timestamp": "2026-04-12T11:35:01.000Z"
}
curl -X POST https://groundedpay.com/api/payments/create \
-H "Content-Type: application/json" \
-d '{
"amount": 49.99,
"merchant_id": "YOUR_MERCHANT_ID",
"order_id": "order-123",
"callback_url": "https://yoursite.com/webhook"
}'
curl https://groundedpay.com/api/payments/PAYMENT_ID/status
The original Shopify-specific endpoints remain available for backward compatibility:
/api/checkout/create -- Create payment (Shopify format)/api/checkout/:paymentId -- Get payment statusUse your dashboard to monitor incoming payments in real time. Payments auto-refresh every 30 seconds.