Getting Started

RecentPay is a self-hosted, non-custodial cryptocurrency payment gateway that allows you to accept payments in various cryptocurrencies directly to your wallet.

Quick Start

The fastest way to get started with RecentPay is to add our JavaScript snippet to your website:

<script async src="https://pay.recentcoders.xyz/me/now.js"></script>
<button onclick="payNow({ currency: 'ETH', amount: 19.95, merchantId: 'YOUR_MERCHANT_ID' })">
  Pay with Crypto
</button>

Replace YOUR_MERCHANT_ID with your actual merchant ID from the dashboard.

Integration Options

RecentPay offers multiple integration options to fit your needs:

The JavaScript integration is the simplest way to add RecentPay to your website. Just add the script tag and call the payNow() function:

<script async src="https://pay.recentcoders.xyz/me/now.js"></script>

<!-- Basic payment button -->
<button onclick="payNow({ 
  currency: 'ETH', 
  amount: 19.95, 
  merchantId: 'YOUR_MERCHANT_ID' 
})">
  Pay with Crypto
</button>

<!-- Advanced options -->
<button onclick="payNow({ 
  currency: 'BTC', 
  amount: 0.001, 
  merchantId: 'YOUR_MERCHANT_ID',
  description: 'Premium Subscription',
  metadata: {
    orderId: '12345',
    customer: 'john@example.com'
  },
  onSuccess: function(payment) {
    console.log('Payment successful!', payment);
  },
  onCancel: function() {
    console.log('Payment cancelled');
  }
})">
  Pay with Bitcoin
</button>

Recurring Payments

RecentPay is proud to be the first crypto payment gateway to offer a safe and fully automated recurring crypto payments solution, using our proprietary Timed Allowance technology.

With RecentPay, your users need to sign up for service only once and authorize subscription billing. From then on, RecentPay smart contract pulls funds from users' wallets at regular intervals automatically.

// Create a recurring payment subscription
fetch('https://pay.recentcoders.xyz/api/recurring', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
  },
  body: JSON.stringify({
    currency: 'ETH',
    amount: 0.01,
    interval: 2592000, // 30 days in seconds
    userAddress: '0x71C7656EC7ab88b098defB751B7401B5f6d8976F'
  })
})
.then(response => response.json())
.then(subscription => {
  console.log('Subscription created:', subscription);
})
.catch(error => console.error('Error:', error));

Invoicing

RecentPay allows you to create and send professional invoices to your customers:

// Create an invoice
fetch('https://pay.recentcoders.xyz/api/invoices', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
  },
  body: JSON.stringify({
    customerEmail: 'customer@example.com',
    items: [
      { description: 'Web Development', amount: 500 },
      { description: 'Hosting (1 year)', amount: 120 }
    ],
    currency: 'ETH',
    dueDate: '2023-12-31',
    metadata: {
      projectId: 'project-123'
    }
  })
})
.then(response => response.json())
.then(invoice => {
  console.log('Invoice created:', invoice);
  // Send invoice to customer
  // window.location.href = `https://pay.recentcoders.xyz/invoice/${invoice.id}`;
})
.catch(error => console.error('Error:', error));

Webhooks

RecentPay can notify your server when payment events occur:

  1. Log in to your RecentPay dashboard
  2. Go to the "Settings" tab and click "Webhooks"
  3. Add a new webhook URL for your server
  4. Select the events you want to receive notifications for

When a payment event occurs, RecentPay will send a POST request to your webhook URL with the event details:

// Example webhook payload
{
  "event": "payment.confirmed",
  "data": {
    "id": "pay_123456",
    "currency": "ETH",
    "amount": 0.05,
    "status": "confirmed",
    "txHash": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
    "metadata": {
      "orderId": "12345",
      "customer": "john@example.com"
    },
    "createdAt": "2023-06-01T12:00:00Z",
    "confirmedAt": "2023-06-01T12:05:30Z"
  }
}

API Reference

For detailed API documentation, please visit our API Reference page.

Self-Hosting Guide

RecentPay is designed to be self-hosted on your own infrastructure. Follow these steps to set up your own instance:

  1. Clone the RecentPay repository from GitHub
  2. Install the required dependencies
  3. Configure your environment variables
  4. Set up MongoDB for transaction logging
  5. Set up Supabase for authentication
  6. Deploy the application to your server

For detailed instructions, please visit our Self-Hosting Guide page.