Documentation
Getting Started

Accept Your First Payment

A step-by-step guide to accepting your first cryptocurrency payment with CryptoPay.

Last updated: June 20, 2023

Payment Integration Options

CryptoPay offers multiple ways to accept cryptocurrency payments, depending on your business needs and technical capabilities. Let's explore each option:

Payment Buttons

The easiest way to start accepting payments. No coding required.

  • Simple copy-paste integration
  • Customizable appearance
  • Best for simple websites and blogs

Checkout Links

Generate payment links to share with customers.

  • No website integration needed
  • Share via email, messaging, or QR codes
  • Perfect for social media and remote sales

Custom Checkout

Seamless checkout integrated into your existing flow.

  • Fully customizable experience
  • Advanced integration capabilities
  • Ideal for e-commerce platforms

API Integration

Direct API calls for complete control.

  • Maximum flexibility and control
  • Backend integration capabilities
  • Best for custom applications

Option 1: Payment Button

Let's start with the easiest method: creating a payment button that you can embed on your website.
1

Navigate to Payment Buttons

From your CryptoPay dashboard, go to Payments → Payment Buttons → Create New Button.

2

Configure Button Settings

Fill in the following details:

  • Button name (for your reference)
  • Product or service name
  • Price and currency
  • Accepted cryptocurrencies
  • Button appearance (colors, text, size)
3

Copy the Button Code

After saving, you'll receive HTML code for your button. Copy this code to use on your website.

Example Payment Button Code
<script src="https://js.CryptoPay.io/v1/button.js"></script>
<div class="CryptoPay-button" 
  data-button-id="btn_1234567890"
  data-price="25.00"
  data-currency="USD"
  data-name="Premium Subscription"
  data-color="#4F46E5"
  data-text="Pay with Crypto">
</div>
4

Add to Your Website

Paste the code into your website where you want the button to appear. The script automatically handles the payment flow.

Option 2: Checkout Links

Checkout links are perfect when you don't have a website or want to send payment requests via email, messaging apps, or social media.
1

Navigate to Checkout Links: From your dashboard, go to Payments → Checkout Links → Create New Link.

2

Configure Link Settings: Enter product details, price, currency, and payment options.

3

Generate Link: Click "Create Link" to generate a unique payment URL.

4

Share Your Link: Copy and share the link with your customers via email, social media, or messaging apps. You can also download a QR code for the link.

Example Checkout Link:

https://pay.CryptoPay.io/c/ZP_checkout_123456abcdef

Option 3: Custom Checkout

For a seamless checkout experience that matches your website design, the CryptoPay Custom Checkout is the ideal solution.
Custom Checkout Integration Example
// 1. Add CryptoPay.js to your website
<script src="https://js.CryptoPay.io/v1/CryptoPay.js"></script>

// 2. Initialize CryptoPay with your API key
<script>
  const CryptoPay = new CryptoPay('pk_test_YourPublicKey');
  
  document.getElementById('payment-form').addEventListener('submit', async (e) => {
    e.preventDefault();
    
    try {
      // Create a payment session
      const session = await CryptoPay.createPaymentSession({
        amount: 50.00,
        currency: 'USD',
        product_name: 'Premium Plan',
        customer_email: document.getElementById('email').value,
        redirect_url: 'https://yourwebsite.com/thank-you'
      });
      
      // Open the checkout modal
      CryptoPay.openCheckout(session.id);
    } catch (error) {
      console.error('Error creating payment session:', error);
    }
  });
</script>

// 3. Add a form to your website
<form id="payment-form">
  <input type="email" id="email" placeholder="Your email" required />
  <button type="submit">Checkout</button>
</form>              

Option 4: API Integration

For maximum flexibility and control, you can integrate directly with our API. This is ideal for custom applications and e-commerce platforms.
Server-side API Integration Example (Node.js)
// Using the CryptoPay Node.js SDK
const CryptoPay = require('@CryptoPay/node');
const CryptoPay = new CryptoPay('sk_test_YourSecretKey');

// Create an Express route handler for payments
app.post('/create-payment', async (req, res) => {
  try {
    // Create a payment
    const payment = await CryptoPay.payments.create({
      amount: req.body.amount,
      currency: req.body.currency,
      product_name: req.body.product_name,
      customer_email: req.body.email,
      metadata: {
        order_id: req.body.order_id,
      },
      webhook_url: 'https://yourwebsite.com/webhooks/CryptoPay',
      success_url: 'https://yourwebsite.com/thank-you',
      cancel_url: 'https://yourwebsite.com/cart',
    });
    
    // Return the payment data to the client
    res.json({ 
      paymentId: payment.id,
      checkoutUrl: payment.checkout_url 
    });
  } catch (error) {
    console.error('Payment creation failed:', error);
    res.status(500).json({ error: error.message });
  }
});              

Testing Your Integration

Before accepting real payments, test your integration using CryptoPay's test mode:

Test Mode Setup

  • Toggle to Test Mode in your dashboard settings
  • Use test API keys that start with pk_test_ and sk_test_

Test Wallet Addresses

BTC
tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0g
ETH
0xb794f5ea0ba39494ce839613fffba74279579268

Monitoring Your First Payment

After setting up your payment method, you can monitor payments in real-time from your CryptoPay dashboard:
1

Payment Initiated

Customer sees checkout page.

2

Payment Pending

Status is "Pending" while waiting confirmations.

3

Payment Completed

Status changes to "Completed".

4

Settlement

Funds settled to your account.

Next steps

Now that you've set up your first payment, explore more features and tools in the CryptoPay dashboard:

Dashboard Overview

Learn how to navigate and use the CryptoPay dashboard

Payment Buttons

Explore advanced payment button configurations