CryptoPay API Documentation

Overview

Welcome to the CryptoPay API documentation. This guide will help you integrate the CryptoPay API to accept cryptocurrency payments for your products or services. With our API, you can easily create payment links, check order status, and manage transactions with crypto.

1. Create Payment Link

This API endpoint allows you to create a payment link for a product or service, enabling your customers to pay with cryptocurrency.

Request

$apiKey = "YOUR_API_KEY";  // Your unique API key
$productName = "30 days premium";  // Product name
$buyerEmail = "[email protected]";  // Buyer's email
$price = 13.50;  // Product price in USD
$notificationURL = "https://yourwebsite.com/notification";  // URL to receive notifications on payment status
$successfulURL = "https://yourwebsite.com/success";  // URL to redirect user on successful payment

// Prepare post data
$postData = "apikey=".$apiKey;
$postData .= "&productName=".$productName;
$postData .= "&buyerEmail=".$buyerEmail;
$postData .= "&price=".$price;
$postData .= "¬ificationURL=".$notificationURL;
$postData .= "&successfulURL=".$successfulURL;

// Call API
$data = cURL("https://cryptopayapi.com/api/create", null, $postData);

// Decode response
$json = json_decode($data, true);		

// Get payment link
$payLink = $json["payLink"];

// Display payment link
echo $payLink;
        

Parameters

  • apikey: Your unique API key (required)
  • productName: The name of the product being sold (required)
  • buyerEmail: Email address of the buyer (required)
  • price: The price of the product in USD (required)
  • notificationURL: URL where payment status notifications will be sent (required)
  • successfulURL: URL to redirect the user after a successful payment (required)

Response Example

{
    "payLink": "https://cryptopayapi.com/pay/123456"
}
            

2. Check Payment Status

This API endpoint allows you to check the payment status of an order by its order ID.

Request

$orderid = "ainr2Z900o";  // Order ID
$apiKey = "YOUR_API_KEY";  // Your unique API key

// Call API
$data = file_get_contents("https://cryptopayapi.com/api/orderinfo?apikey={$apiKey}&id={$orderid}");

// Decode response
$json = json_decode($data, true);

// Get payment status
$status = $json["status"];
        

Parameters

  • apikey: Your unique API key (required)
  • id: The order ID (required)

Response Example

{
    "status": "paid",
    "orderid": "ainr2Z900o",
    "product": "30 days premium",
    "cryptoReceived": "0.00114",
    "cryptoAddress": "bc1q96xh067q3cccs36xgs98ywzk7ted9s7yex6lq3",
    "cryptoAmount": "0.00114",
    "cryptoSymbol": "BTC",
    "cryptoTxID": "68b12214b1d35dd51277bcec64ebfe3f91d9a314f1bd657adb3c1020df0aa080",
    "buyerIP": "100.200.170.10",
    "buyerEmail": "[email protected]",
    "priceUSD": "95.3",
    "paidDate": "2025-03-04 09:09:23"
}
            

Status Values

  • paid: The payment has been successfully completed.
  • unpaid: The payment has not been made yet.
  • expired: The payment window has expired.

Error Handling

The CryptoPay API will return standard HTTP status codes to indicate the result of a request.

Common HTTP Status Codes

  • 200 OK: The request was successful.
  • 400 Bad Request: The request was malformed or missing required parameters.
  • 401 Unauthorized: Authentication failed (invalid API key).
  • 500 Internal Server Error: Something went wrong on the server side.

Error Response Example

{
  "error": "Invalid API key"
}