Documentation

INVOICES


This section includes methods for issuing invoices, viewing the history and current status of issued invoices.
All information about invoices is also available in the personal account.


CREATE INVOICE

The method creates an invoice with the specified parameters and returns the details of the newly created invoice. Our service offers flexible tools for customizing invoices.

You can create an invoice by specifying the amount in either fiat or cryptocurrency. If you enter an amount in fiat currency, the invoice total in cryptocurrency will be calculated based on the current exchange rate between that fiat currency and the selected cryptocurrency. You can also use a percentage markup (percent) for each invoice, allowing the cryptocurrency amount to reflect your preferred rate with a markup or discount.
When issuing an invoice, you can set the required number of network confirmations for the payment to be considered complete.

For security, we highly recommend using a secret key (secret_key) during invoice creation. This key will be used to verify responses from our server regarding any changes in the invoice status, ensuring the response is authentic and from us.

Our service employs a carousel system for managing addresses when issuing invoices. If no invoice is associated with a specific address, that address can be reused for the next invoice (this helps reduce network fees on certain blockchains, such as Ethereum). If you prefer to use a new address for each invoice or want to pause reuse of an address for a period (e.g., a day or a year), you can use the -pause- parameter. For example, if this parameter is set to one month, the address used in an invoice will not receive a new invoice for a month.
Request
HTTP Method: POST
Content Type: application/json
URL: https://api.apiforcrypto.com/api/v1/wallets/{wallet id}/invoices

Parameter Type Description Required
wallet id string Wallet ID yes
blockchain string Blockchain yes
symbol string Cryptocurrency or token symbol yes
value int The invoice amount in cryptocurrency. Use this parameter if you are issuing an invoice in cryptocurrency. In this case, you can either omit the "fiatCurrency" array entirely or specify only one parameter in it: "currency."

If you create an invoice in cryptocurrency and include the "fiatCurrency" array with the "currency" parameter, the invoice will be issued in cryptocurrency. Additionally, the response will include an extra field where the invoice amount will also be converted into the currency specified in the “currency” field at the market exchange rate.
no
fiatCurrency array Fiat currency data array. no
currency string Select fiat currency if the invoice is issued in fiat currency. The invoice will be issued in the selected cryptocurrency, based on the current exchange rate of this fiat currency to the cryptocurrency. no
value int Invoice amount in fiat currency. no
percent int Invoice markup percentage. If the invoice is issued in fiat currency and the user wants to receive funds in cryptocurrency with an additional percentage, it can be specified here. no
expiry int Waiting time for invoice payment in minutes. After this time elapses, the invoice will be considered unpaid, and the address can be used to issue another invoice.
The allowed time is from 15 to 40 minutes inclusive.
yes
confirmations int Number of network confirmations after which the invoice will be considered paid. yes
pause int Pause the use of a specific invoice address, in minutes. During this period, the address generated in this invoice will not be reused (i.e., subsequent invoices will not use this address for the specified time). The pause countdown starts from the "expiry" value - the invoice expiration time. Minimum value: 10 no
secret_key string User's secret key. Used to enhance the confidentiality of the invoice status. The user can use any personal secret key for each invoice, for one invoice, or not use it at all. The secret key is transmitted only in the notification to the "url_callback" resource. no
data array User information. no
order_id string User Invoice ID no
title string Invoice name no
description string invoice description. no
url_callback string User's address for notification of invoice status changes. no
attempts_callback int If our server does not receive an "OK" (200) response to the sent webhook, the server will retry sending the webhook every minute until an "OK" response is received. The number of possible retries ranges from 0 to 20. no
url_success string User address to which the payer will be redirected after paying the invoice.
Always add "http://" or "https://" before the resource where the redirection is required after the invoice activity is completed.
no
url_failed string User address to which the payer will be redirected if the invoice payment fails.
Always add "http://" or "https://" before the resource where the redirection is required after the invoice activity is completed.
no
user_data string Any user information. no
Request example (for an invoice in fiat currency.)
Request example (for an invoice in cryptocurrency.)
Success Response Reference
HTTP Status Code: 200

Parameter Type Description
id string Unique number of the issued invoice.
blockchain string Blockchain
symbol string Cryptocurrency or token symbol
address string Address for paying the invoice.
contract_address string Contract address, if the invoice was issued in a token.
active boolean Whether the invoice is active or not
value int The final amount for payment in the blockchain currency or token currency, if there is a contract address.
created string Invoice creation date
expiry string Time until which the invoice is valid. If no payment is made to the specified address within the specified time, the invoice becomes invalid.
status string Invoice status. Can take the values "PAID", "NOT_PAID", "IN_MEMPOOL", "PARTIALLY_PAID", "IN_BLOCK".
confirmations int Number of transaction confirmations on the network.
fiat_currency array Invoice data in fiat currency
txs string Hash of each transaction for this invoice
data array User information.
url_pay string You can redirect your client to this link for invoice payment.
Response example
Error response
HTTP Status Code:
403 - Currency is not active / Create invoice forbidden
404 - Wallet not found
500 - Internal Server Error
Content Type: - application/json

Example of a request to the client's server via the "url_callback" link:

Create Invoice Parameter
Wallet ID *
Blockchain *
Symbol *
Value (for Crypto)
Currency
Value (for Fiat)
Percent (for Fiat)
Expiry (minute)
Confirmation
Pause
Secret Key
Your Order ID
Title
Description
URL Callback
Attempts_callback
URL Success
URL Failed
User data


GET INVOICE

The method returns information about an invoice based on its UUID number. The method provides public information about the invoice; it does not include the wallet ID, secret key, or server response URL (url_callback).
Request
HTTP Method: GET
Content Type: -
URL: https://api.apiforcrypto.com/api/v1/wallets/invoices/{UUID}

Parameter Type Description Required
UUID string Invoice UUID yes
Request example
curl -X GET "https://api.apiforcrypto.com/api/v1/wallets/invoices/f4ae3bd1-a031-4b4c-84cb-96a425aab4c8"
Success Response Reference
HTTP Status Code: 200

Parameter Type Description
id string Unique number of the issued invoice.
blockchain string Blockchain
symbol string Cryptocurrency or token symbol
address string Address for paying the invoice.
contract_address string Contract address, if the invoice was issued in a token.
active boolean Whether the invoice is active or not
value int The final amount for payment in the blockchain currency or token currency, if there is a contract address.
created string Invoice creation date
expiry string Time until which the invoice is valid. If no payment is made to the specified address within the specified time, the invoice becomes invalid.
status string Invoice status. Can take the values "PAID", "NOT_PAID", "IN_MEMPOOL", "PARTIALLY_PAID", "IN_BLOCK".
confirmations int Number of transaction confirmations on the network.
fiat_currency array Invoice data in fiat currency
txs string Hash of each transaction for this invoice
data array User information.
Response example
Error response
HTTP Status Code:
404 - Invoice not found
500 - Internal Server Error
Content Type: - application/json


GET INVOICE Parameter
UUID