Payment Flow

This document describes how to create a new payment for an existing invoice in the Asterium Crypto Acquiring flow using a single HTTP endpoint. The response returns all details required to render a payment QR code and guide the customer through the blockchain transfer.


📘

API Reference

Create Invoice Payment

Token Usage: All requests require a valid access token.

Authorization: Bearer <access_token>
Content-Type: application/json

Path Parameters

NameTypeRequiredDescription
terminalIdstringUnique identifier of the terminal
invoiceIdstringUnique identifier of the invoice

Request Body Parameters

🚧

Important

You must provide either fromAmount or toAmount depending on the chosen rateDirection.
The rate signature (signedRate) is required when rate verification is enabled.

NameTypeRequiredDescription
fromAmountstring≥ 0. Payment amount of source currency
toAmountstring≥ 0. Payment amount of target currency
currencystringCurrency in which the payment was made
invoiceIdstringUnique internal identifier of the invoice
typestring (enum)Type of invoice payment provider. Allowed: ASTERIUM, CRYPTO
signedRateobjectSigned rate information
rateDirectionstring (enum)Direction of rate in payment. Allowed: DIRECT, INVERTED
signedRate Object
NameTypeRequiredDescription
rateRequestobjectOriginal parameters used to obtain the rate
ratestringExchange rate value used for conversion
signaturestringDigital signature returned by Get Rate
validUntildate-timeExpiration timestamp of the signed rate
feeConfigobjectFee configuration parameters

rateRequest object:

NameTypeRequiredDescription
fromCurrencystringSource currency for the exchange
toCurrencystringTarget currency for the exchange
amountstring≥ 0. Amount to be exchanged
accountstringAccount identifier for special rate conditions
partnerstringPartner identifier for rate calculations

feeConfig object:

NameTypeRequiredDescription
feePercentnumberFee percentage
feeFixednumberFixed fee
feeMinnumberMinimum fee
feeMaxnumberMaximum fee

Rate Direction Logic

The rate is applied from fromAmount to toAmount. The calculation depends on the chosen rateDirection.

Use when: the payer defines how much they send (fromAmount).

toAmount = (fromAmount × requestedRate)
  .setScale(invoiceCurrency.decimals, RoundingMode.DOWN)

toAmount is calculated by applying the requestedRate directly and rounding DOWN to the number of decimals of the invoice currency.


Example

Request (JSON)
{
  "rateDirection": "INVERTED",
  "toAmount": "116.40682",
  "fromAmount": "116.40682",
  "currency": "usdt",
  "blockchain": "tron",
  "email": "[email protected]",
  "invoiceId": "4fa3a26d-09b4-49be-94ac-b2231528e7f7",
  "type": "CRYPTO",
  "signedRate": {
    "rateRequest": {
      "fromCurrency": "usdt",
      "toCurrency": "usdt",
      "amount": "0",
      "partner": "default"
    },
    "rate": "1.0000000000",
    "feeConfig": {
      "feePercent": 0.03
    },
    "signature": "v9y/9tK8gz1H+UXx4EKp...Z/sjQ==",
    "validUntil": "2025-11-12T07:20:16.645Z"
  }
}
Response (JSON)
{
  "type": "CRYPTO",
  "id": "a0570107-bba8-447e-b591-980d36c45d34",
  "status": "INIT",
  "address": "TKM5PxycJq6JpTfsz6PYhQYTThr7FAEqTK",
  "amount": "116.406820",
  "amountInInvoiceCurrency": "116.40682",
  "blockchain": "tron",
  "currency": "usdt",
  "description": "Invoice crypto payment",
  "feeAmount": "1.266136",
  "totalAmount": "117.672956",
  "statusDescription": "Payment initialized, amount validation passed",
  "created_date": "2025-11-12T07:19:52.216Z",
  "updatedDate": "2025-11-12T07:19:52.434Z",
  "estimationTime": "2025-11-12T07:34:52.108Z"
}
👍

Use the following fields to render a payment QR code:

address, amount, currency, blockchain


Payment Statuses

StatusDescriptionCategory
INITPayment created but not yet processed. Awaiting transfer from payer.⏳ Pending
PROCESSINGTransaction detected but not yet confirmed on blockchain or by gateway.⏳ Pending
SUCCESSPayment successfully completed. Funds credited to merchant or escrow account.✅ Final
CAPTUREDPayment fully captured and transferred to merchant's final account (two-step flow).✅ Final
OVERPAIDPayer sent more than the required amount. Excess funds need to be handled.⚠️ Review
UNDERPAIDPayer sent less than the required amount. Additional payment or action needed.⚠️ Review
REJECTEDPayment rejected — invalid amount, signature, or failed validation.❌ Final
REFUNDINGRefund initiated and in progress. Awaiting execution.🔄 In Progress
PARTIALLY_REFUNDEDPart of the payment amount has been refunded to the payer.🔄 Partial
REFUNDEDFull payment amount has been refunded to the payer.🔄 Final
REVERSINGReversal transaction started. Pending blockchain confirmation.🔄 In Progress
REVERSEDReversal completed successfully. Funds returned to the payer.🔄 Final
REVERSED_DECLINEDReversal attempt declined by payment network or failed due to system issue.❌ Final
EXCHANGE_FAILEDPayment's linked currency exchange failed during processing.❌ Final
DIRTY_MONEYPayment flagged as suspicious (AML/blacklist trigger). Manual compliance review required.⚠️ Review
FAILEDPayment failed due to gateway or internal processing error.❌ Final
CANCELLEDPayment cancelled by user or system before completion.❌ Final

Status Flow Diagram

                       ┌──────────┐
                       │   INIT   │───────────────────┐
                       └────┬─────┘                   │
                            │                    ┌────▼──────┐
                       ┌────▼──────────┐         │ CANCELLED │
                       │  PROCESSING   │         └───────────┘
                       └────┬──────────┘
                            │
        ┌───────┬───────┬───┼────────┬──────────┬──────────┐
        │       │       │            │          │          │
   ┌────▼──┐ ┌─▼────┐ ┌─▼─────┐  ┌───▼───┐  ┌───▼────┐ ┌───▼──────────┐
   │SUCCESS│ │OVERPD│ │UNDERPD│  │REJECT │  │DIRTY_$ │ │EXCHANGE_FAIL │
   └───┬───┘ └──┬───┘ └──┬────┘  └───────┘  └────────┘ └──────────────┘
       │        │        │
       ├────────┴────────┘
       │
  ┌────▼─────┐
  │ CAPTURED │
  └────┬─────┘
       │
       ├─────────────────────────────┐
       │                             │
  ┌────▼──────┐                 ┌────▼──────┐
  │ REFUNDING │                 │ REVERSING │
  └────┬──────┘                 └────┬──────┘
       │                             │
  ┌────┼──────┐                 ┌────┼──────────────────┐
  │           │                 │                       │
┌─▼──────┐ ┌──▼──────────┐    ┌─▼────────┐  ┌───────────▼──────┐
│REFUNDED│ │PART_REFUNDED│    │ REVERSED │  │REVERSED_DECLINED │
└────────┘ └─────────────┘    └──────────┘  └──────────────────┘
                            
                            
                            

Error Handling

HTTP CodeDescription
400Invalid parameters or inconsistent amounts
401Unauthorized (missing or invalid token)
404Terminal or invoice not found
409Rate signature expired (validUntil) or reused
500Internal server error

📘

Tips

  • Obtain signature from the Get Rate endpoint before creating the payment.
  • Ensure the current time is before validUntil to avoid a 409 error.
  • Use address, amount, currency, and blockchain to render a payment QR code for the customer.

Related Endpoints

EndpointMethodDescription
Create Invoice PaymentPOSTCreate a new payment
Get Invoice PaymentGETRetrieve payment details
Get Merchant PaymentsGETList all payments
Get Exchange RateGETObtain signed rate for payment
Create RefundPOSTInitiate a payment refund