DirectCryptoPay Docs

Choose Your Integration Method

DirectCryptoPay offers two fundamentally different approaches to accept crypto payments. Pick the one that fits your use case.

At a Glance#

Payment Tool (No-Code) Integration Snippet (Developer)
Audience Merchants, freelancers, non-technical users Developers, SaaS platforms, custom apps
Identifier linkId (e.g., pt_7K8mN9oPqRsT) integrationId (e.g., int_xyz123)
Pricing Fixed -- set once in the dashboard Dynamic -- passed via JavaScript at runtime
Setup Copy-paste a link or embed code Load script + write JavaScript
Callbacks Redirect URL (optional) Full JS callbacks (onSuccess, onError, onClose)
Best for Invoices, donations, quick sales E-commerce checkouts, SaaS billing, custom flows

Method 1: Payment Tool (No-Code)#

The ready-made approach. Create a Payment Tool in the dashboard, get a shareable link or embed code, and start accepting payments immediately. No coding required.

How It Works#

  1. Go to Dashboard > Payment Tools
  2. Click Create and configure amount, currency, and description
  3. Select an Integration (defines accepted chains/tokens and payout wallet)
  4. Click Get Code to see your embed options
  5. Copy-paste into your site, email, or social media

What You Get#

Each Payment Tool generates a unique linkId and three embed formats:

Simple Link -- Share anywhere (email, social media, messaging):

<a href="https://pay.directcryptopay.com/pay/pt_7K8mN9oPqRsT">
  Pay $49.99 with Crypto
</a>

Styled Button -- Drop into any webpage:

<a href="https://pay.directcryptopay.com/pay/pt_7K8mN9oPqRsT"
   class="dcp-pay-button"
   style="display:inline-block;padding:12px 24px;background:#2563eb;color:white;text-decoration:none;border-radius:8px;font-weight:500;">
  Pay $49.99 USD
</a>

Embedded Widget Button -- Load the widget and trigger payment programmatically:

<script src="https://api.directcryptopay.com/widget/dcp-widget.umd.js"></script>
<button id="pay-btn">Pay Now</button>
<script>
  DCP.init({ baseURL: 'https://api.directcryptopay.com' });
  document.getElementById('pay-btn').addEventListener('click', function() {
    DCP.payWithTool({
      toolId: 'pt_7K8mN9oPqRsT',
      onTxSubmitted: function(txHash) { console.log('TX:', txHash); },
      onStatus: function(status) {
        if (status.type === 'confirmed') window.location.href = '/thank-you';
      }
    });
  });
</script>

When to Use#

  • Sending invoices to clients
  • Accepting donations on a blog or social media
  • Quick one-off product sales
  • Freelance payment collection
  • Any situation where the price is known in advance
Price is fixed at creation time. If you need dynamic pricing (e.g., cart totals that vary per customer), use the Integration Snippet instead.

Read the full guide: Payment Tools


Method 2: Integration Snippet (Developer)#

The fully programmable approach. Load the DCP widget script, initialize it with your Integration ID, and trigger payments dynamically from JavaScript with full control over amount, metadata, and callbacks.

How It Works#

  1. Go to Dashboard > Integrations and create an Integration
  2. Copy the Integration ID
  3. Load the widget script on your page
  4. Call DCP.Payment() with your Integration ID, amount, chain, and callbacks

What You Get#

Full programmatic control over the payment flow:

<script src="https://api.directcryptopay.com/widget/dcp-widget.umd.js"></script>

<button id="pay-btn">Pay with Crypto</button>

<script>
  document.getElementById('pay-btn').addEventListener('click', function() {
    DCP.Payment({
      integrationId: 'YOUR_INTEGRATION_ID',
      amount_usd: '49.99',
      currency: 'USDC',
      chainId: 137,  // Polygon
      metadata: {
        orderId: 'ORD-12345',
        customerEmail: '[email protected]'
      },
      onTxSubmitted: function(txHash) {
        console.log('TX submitted:', txHash);
      },
      onStatus: function(status) {
        if (status.type === 'confirmed') {
          window.location.href = '/order-confirmation';
        }
      },
      onError: function(error) {
        console.error('Payment failed:', error);
      }
    });
  });
</script>
The global variable is window.DCP (not DirectCryptoPay). DCP.Payment() auto-initializes the widget -- no separate init() call needed for integration payments.

When to Use#

  • E-commerce sites with dynamic cart totals
  • SaaS platforms with subscription billing
  • Marketplaces where prices vary
  • Any app that needs programmatic payment control
  • Custom checkout flows with specific callbacks
onSuccess does not mean the payment is confirmed. It means the customer signed the transaction and it was submitted to the blockchain. Final confirmation comes via webhooks. Never fulfill orders based solely on the onSuccess callback.

Read the full guide: Widget Integration


Which Should I Use?#

Use Payment Tools if...#

  • You have a fixed price (e.g., $49.99 for a service)
  • You don't want to write any code
  • You need to share a payment link via email or messaging
  • You want to embed a simple pay button on a static site

Use Integration Snippet if...#

  • Your prices are dynamic (e.g., shopping cart totals)
  • You need JavaScript callbacks to update your UI
  • You want to pass custom metadata (order ID, customer info)
  • You're building a custom checkout experience
  • You need to programmatically trigger payments

Use Both Together#

Many merchants use both methods in the same account:

  • Payment Tools for invoicing clients and collecting donations
  • Integration Snippet for their e-commerce checkout flow

Both methods use the same Integration configuration (accepted chains, tokens, payout wallet) and deliver webhooks to the same endpoint. They work seamlessly together.

Next Step: Ready to start? Follow the Getting Started guide to create your account and configure your first integration.