API Documentation
English
English
  • Authorization
  • Request signing
  • List of error codes
  • Webhooks
  • IFrame order
  • Payment acceptance widget
  • Telegram MiniApp
  • API Reference
    • Base actions
      • Check x-api-signature
      • Fetch available currencies
      • Current price request
      • Search for operations by TX hash
      • Check address format
      • Get transaction history
    • Advanced account
      • Get advanced balances of user
      • Get advanced balance by id
      • Get payment address for advanced balance top-up
    • Blockchain addresses
      • Search by id
      • Transactions tracking
      • Search by address
      • Meta-data
      • Address Transactions
      • Last transaction of the address
      • Getting a list of PayIn addresses
      • Getting a list of business addresses
      • Get recurrent addresses
      • Getting a list of PayOut addresses
      • Creating a new business wallet address
      • Creating a new PayOut wallet address
    • Personal addresses
      • User creation
      • Getting an address
      • Getting a list of addresses
      • Get user
      • Adding a trusted address
      • Getting a list of trusted addresses
      • Deleting a trusted address
    • Orders
      • Creating an order
      • Getting information about an order
      • Getting a list of orders
    • Withdraws
      • Getting a commission for making a withdrawal
      • Sync withdraw
      • Async withdrawal
      • Receiving withdrawal information
    • Invoices
      • Create an invoice for payment
      • Invoice information request
      • Getting a list of invoices
    • Auto swaps
      • Create auto-swap
      • Find auto-swap by ID
    • Withdrawals 2.0
      • Create auto-withdrawal
      • Find auto-withdrawal by ID
      • Additional confirmation of the withdrawal
    • Bridge
      • Getting limits for cross-chain transfer
      • Getting information about cross-chain transfer
      • Commission token formation
      • Creating a cross-chain translation
    • Swaps
      • Getting limits for cross-chain exchange
      • Getting information about cross-chain exchange
      • Commission token formation
      • Creation of a cross-chain exchange
    • Recurring payments
      • Creating a payment link
      • Get a payment link
      • Get payment links by user
      • Disabling the payment link
      • Create a subscription
      • Getting a subscription
      • Cancel Subscription
      • Creating a payment
    • KYT
      • Check transaction risks
      • Check withdrawal risks
      • Check withdrawal risks for provided address
    • Partners API
      • Create user
      • Get user
      • Get all users
      • Creating an organization
      • Getting a list of organizations
      • Getting the user's advance balances
      • Replenishment of the user's advance balance
      • Get general tariffs
      • Create/update individual tariff
      • Get individual tariffs
      • Create API key
      • Get API keys
      • Delete API key
    • Webhooks
      • Get webhook
      • Get webhook (extended)
    • Orphan transactions
      • Get a transaction
      • Get a list of transactions
      • Get a commission token
      • Withdrawal
    • Address book
      • Add an address
      • Delete an address
      • Update the address
      • Get a list of addresses
Powered by GitBook
On this page
  • Parameters
  • Integration
  • 1. Payment Button via Script
  • Payment Button Parameters
  • 2. Direct Link

Telegram MiniApp

Now you can accept cryptocurrency payments via the TON network in Telegram using our mini-app. It’s easy to integrate, allows seamless interaction with customers directly in Telegram, and opens new opportunities for businesses in the TON ecosystem.


Parameters

The following parameters are available to manage payment creation:

Parameter
Required
Description

apiKey

NO

Public part of the API key (used to sign payment webhooks)

orderId

YES

Payment identifier

description

NO

Payment description

organizationId

YES

Organization ID

amount

NO

Payment amount

payerEmail

NO

Payer’s email address

returnUrl

NO

Return URL after successful payment

You can get the API key in your personal account under the "Integrations" section.


Integration

Two convenient methods are available to integrate our mini-app for receiving cryptocurrency payments.

1. Payment Button via Script

You can integrate the payment system into your service or mini-app by adding a pre-built button script. This is a quick and easy way to set up the payment process via the TON network in widely used wallets.

Script Integration

To enable the payment button, add the script to your service:

<script src="https://cdn.onchainpay.io/images/PaymentButtonMiniApp.js"></script>

Example of a payment button tag with required parameters:

<payment-button
    data-orderid="test"
    data-organizationid="your_organization_id"
    data-description="test"
    data-payeremail="email@test.mail"
    data-apikey="your_public_api_key"
    data-label="Pay"
    data-accentcolor="red"
    data-returnurl="https://example.com/success"
>
</payment-button>

Note! data- attributes must be written in lowercase.


Payment Button Parameters

data-label

The text displayed on the button.

Example: data-label="Pay"

data-accentcolor

Button color. Available values: purple, orange, green, red, yellow, blue

2. Direct Link

Alternatively, you can use a direct link that you can embed into your service or mini-app. This link redirects the user to our payment app within Telegram.

To open the payment mini-app, you need to generate a base64 string from the parameters and insert it into the startapp query parameter.

Example of Generating a Base64 String in JavaScript:

const encodeObjectToUrlString = (obj) => { 
  const jsonString = JSON.stringify(obj); // Convert object to JSON string 
  return encodeURIComponent(btoa(jsonString)); // Encode to Base64 and make URL-safe 
};

// Example usage:
const params = {
  apiKey: "apiKey",
  orderId: "Payment#1234",
  description: "Some payment description",
  organizationId: "organizationId",
  payerEmail: "email@mail.ru",
  returnUrl: "https://example.com/success"
};

const base64Params = encodeObjectToUrlString(params);

Example of a Link:

https://t.me/Onchainapay_app_bot/onchainpay?startapp=${base64Params}

You can open the link using the window.open function:

window.open(`https://t.me/Onchainapay_app_bot/onchainpay?startapp=${base64Params}`);

Insert the result from the base64Params function into the URL string.


Supported currencies for payment: USDT (TON), TON (TON)

Note! When opening the payment mini-app, your mini-app will close.

PreviousPayment acceptance widgetNextBase actions

Last updated 5 months ago