PayAgency Logo

Crypto Payment Link API

This document provides a comprehensive guide to generate secure crypto payment links using Pay Agency's API. The API allows you to create encrypted payment links for crypto transactions, supporting onramp, offramp, and payin flows.

API Endpoint

POST https://backend.pay.agency/api/v1/live/crypto/payment-link

Overview

The Crypto Payment Link API allows you to generate secure, encrypted payment links for various crypto transaction types:

  • ONRAMP: Fiat to Crypto
  • OFFRAMP: Crypto to Fiat
  • PAYIN: Crypto Payment Collection

The API validates your secret key, checks the payment template, and returns a secure URL for your customer to complete the transaction.

Request Body Parameters

ParameterTypeRequiredDescription
payment_template_idStringYesID of the payment template to use for this link.
transaction_typeStringYesTransaction type: "ONRAMP", "OFFRAMP", or "PAYIN".
order_idStringNoUnique order from merchant side.
terminal_idStringNoTerminal ID to route the transaction through a specific connector.
expiry_dateStringNoExpiry date must be in yyyy-mm-dd format.
crypto_amountStringConditionalAmount in cryptocurrency (see rules below).
fiat_amountNumberConditionalAmount in fiat currency (see rules below).
crypto_currencyStringConditionalCryptocurrency code (e.g., BTC, ETH, USDT).
fiat_currencyStringConditionalFiat currency code (e.g., USD, EUR).

Transaction Type Rules

ONRAMP: crypto_amount should not be provided.

OFFRAMP: fiat_amount should not be provided.

PAYIN: crypto_amount should not be provided.

Headers

Header NameDescription
Content-TypeSet to application/json.
AuthorizationBearer token (your Secret key or Test key).

Environment Behavior

  • Test key returns a test payment link (with /test in the URL).
  • Secret key returns a live payment link (with /live in the URL).

Example Payloads

ONRAMP

{
  "payment_template_id": "TPL123456",
  "transaction_type": "ONRAMP",
  "fiat_amount": 1000,
  "fiat_currency": "USD",
  "crypto_currency": "BTC",
  "expiry_date": "2025-12-31",
}

OFFRAMP

{
  "payment_template_id": "TPL123456",
  "transaction_type": "OFFRAMP",
  "crypto_amount": 0.05,
  "crypto_currency": "ETH",
  "fiat_currency": "USD",
  "expiry_date": "2025-12-31",
}

PAYIN

{
  "payment_template_id": "TPL123456",
  "transaction_type": "PAYIN",
  "fiat_amount": 500,
  "fiat_currency": "USD",
  "crypto_currency": "USDT",
  "expiry_date": "2025-12-31",
}

Success Response

{
  "message": "Crypto payment link created successfully",
  "data": "https://portal.pay.agency/crypto-link/TPL123456/PLK7923412397/live?encrypted_config=ENCRYPTED_STRING"
}

Error Responses

{
  "message": "Invalid Payment Template ID"
}
{
  "message": "Invalid terminal ID"
}

On this page