Skip to main content

Welcome to the InventPay API

The InventPay API allows you to integrate cryptocurrency payment processing into your applications. Our RESTful API is designed to be simple, predictable, and easy to integrate.

RESTful Design

Standard HTTP methods and status codes

JSON Format

All requests and responses use JSON

Comprehensive SDKs

Official libraries for JavaScript and Python

Real-time Webhooks

Instant notifications for all events

Base URL

All API requests should be made to:
https://api.inventpay.io

Authentication

The InventPay API uses API keys for authentication. Include your API key in the X-API-Key header of every request.

Get Your API Key

  1. Sign up at inventpay.io
  2. Navigate to Dashboard → Settings → API Keys
  3. Click “Generate New API Key”
  4. Copy and securely store your API key
Never expose your API key in client-side code or public repositories. Always use environment variables to store sensitive credentials.

Example Authentication

curl https://api.inventpay.io/v1/merchant/balance \
  -H "X-API-Key: cmfnz7jei0005p54eekx4e6mb"

Request Format

HTTP Methods

The API uses standard HTTP methods:
MethodUsage
GETRetrieve resources
POSTCreate new resources
PUTUpdate existing resources
DELETERemove resources

Content Type

All requests with a body must include the Content-Type: application/json header.

Example Request

curl -X POST https://api.inventpay.io/v1/create_payment \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 29.99,
    "amountCurrency": "USD",
    "currency": "USDT_BEP20",
    "orderId": "order-12345"
  }'

Response Format

All API responses are returned in JSON format with a consistent structure.

Successful Response

{
  "success": true,
  "data": {
    // Response data here
  },
  "message": "Operation completed successfully",
  "statusCode": 200
}

Error Response

{
  "success": false,
  "error": "Error message",
  "details": {
    // Additional error details
  },
  "statusCode": 400
}

HTTP Status Codes

The API uses standard HTTP status codes:
CodeMeaningDescription
200OKRequest successful
201CreatedResource created successfully
400Bad RequestInvalid request parameters
401UnauthorizedInvalid or missing API key
404Not FoundResource not found
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer error occurred

Error Handling

Error Response Structure

{
  "success": false,
  "error": "Validation failed",
  "details": {
    "currency": "Invalid currency. Must be one of: BTC, ETH, LTC, USDT_ERC20, USDT_BEP20"
  },
  "statusCode": 400
}

Common Errors

Cause: Invalid or missing API keySolution: Verify your API key is correct and included in the X-API-Key header
{
  "success": false,
  "error": "Invalid API key",
  "statusCode": 401
}
Cause: Invalid request parametersSolution: Check the details field for specific validation errors
{
  "success": false,
  "error": "Validation failed",
  "details": {
    "amount": "Amount must be greater than 0"
  },
  "statusCode": 400
}
Cause: Too many requests in a short timeSolution: Implement exponential backoff and respect rate limits
{
  "success": false,
  "error": "Rate limit exceeded",
  "retryAfter": 60,
  "statusCode": 429
}
Cause: Resource doesn’t existSolution: Verify the resource ID is correct
{
  "success": false,
  "error": "Payment not found",
  "statusCode": 404
}

Rate Limits

To ensure fair usage and system stability, the API implements rate limiting:
Endpoint TypeLimitWindow
Payment Creation100 requestsPer minute
Status Checks300 requestsPer minute
Withdrawals10 requestsPer minute
Other Endpoints60 requestsPer minute

Rate Limit Headers

All responses include rate limit information:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1640000000

Handling Rate Limits

async function makeRequest(url, options) {
  const response = await fetch(url, options);

  if (response.status === 429) {
    const retryAfter = response.headers.get("X-RateLimit-Reset");
    const waitTime = retryAfter - Date.now();

    await new Promise((resolve) => setTimeout(resolve, waitTime));
    return makeRequest(url, options); // Retry
  }

  return response;
}

Pagination

Endpoints that return lists support pagination using query parameters:
ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger10Items per page (max 100)

Example

GET /v1/payments?page=2&limit=20

Response

{
  "success": true,
  "data": {
    "items": [...],
    "pagination": {
      "page": 2,
      "limit": 20,
      "total": 150,
      "pages": 8
    }
  }
}

Idempotency

To safely retry requests without performing the same operation twice, use idempotency keys:
curl -X POST https://api.inventpay.io/v1/create_payment \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "X-Idempotency-Key: unique-key-123" \
  -H "Content-Type: application/json" \
  -d '{...}'
Idempotency keys are stored for 24 hours. Use a unique key for each unique request.

Versioning

The API version is included in the URL path:
https://api.inventpay.io/v1/...
Current Version: v1 We maintain backwards compatibility within a major version. Breaking changes will result in a new major version (v2, v3, etc.).

SDKs and Libraries

Webhooks

For real-time event notifications, configure webhooks:
1

Configure Webhook URL

Set your endpoint in the dashboard or via API
2

Verify Signatures

Always verify webhook signatures for security
3

Handle Events

Process payment and withdrawal events
4

Return 200 OK

Respond quickly to acknowledge receipt

Webhook Documentation

Learn how to set up and secure webhooks

Testing

Test Mode

Use separate test API keys for development and testing:
  • Test payments don’t process real cryptocurrency
  • Test all integration flows safely
  • Generate test API keys in dashboard

Test Data

Use these test values for development:
FieldTest Value
AmountAny positive number
CurrencyAll supported currencies
Order IDAny string
Never use production API keys in test environments or public repositories.

Best Practices

  • Store keys in environment variables
  • Never commit keys to version control
  • Rotate keys periodically
  • Use separate keys for different environments
  • Always check response status codes - Parse error messages for details - Implement retry logic with exponential backoff - Log errors for debugging
  • Don’t poll for status changes - Implement webhook signature verification - Handle duplicate deliveries - Return 200 OK quickly
  • Use idempotency keys for critical operations - Store request IDs to prevent duplicates - Handle retries safely
  • Track API response times
  • Monitor error rates
  • Set up alerts for failures
  • Review webhook delivery success rates

API Endpoints

Payments

Balances

Withdrawals

Support

Next Steps

1

Get Your API Key

Sign up and generate your API key
2

Try the Quickstart

Create your first payment in 5 minutes
3

Install an SDK

Choose JavaScript or Python SDK
4

Set Up Webhooks

Configure real-time notifications
5

Go Live

Switch to production API keys

Quickstart Guide

Get started in under 5 minutes