Package: crypto-pay-api-sdk
@muxel/crypto-pay-api-sdkSDK for working with Crypto BotInstallationpipinstallcrypto-pay-api-sdkExplanationFirst, you need to create your application and get an API token.
Open@CryptoBotor@CryptoTestnetBot(for testnet), end a command/payto create a new app and get API Token.NetBotHostnamemainnet@CryptoBotpay.crypt.bottestnet@CryptoTestnetBottestnet-pay.crypt.botAll queries to the Crypto Pay API must be sent over HTTPSExamplesSupport for all methodsofficial APIfromcrypto_pay_api_sdkimportcryptopayCrypto=cryptopay.Crypto("TOKEN",testnet=True)#default testnet = Falseprint(Crypto.getMe())print(Crypto.createInvoice("TON","0.4",params={"description":"Test Invoice","expires_in":300}))MethodsAPIgetMecreateInvoicetransfergetInvoicesgetBalancegetExchangeRatesgetCurrenciesgetMeA simple method for testing your app's authentication token. Requires no parameters. Returns basic information about the app.Crypto.getMe()createInvoiceUse this method to create a new invoice. Returns object of created invoice.asset(string)
Currency code. Supported assets:BTC,TON,ETH(only testnet),USDT,USDC,BUSD.amount(string)
Amount of the invoice in float. For example:125.50description(string)Optional. Description of the invoice. Up to 1024 symbols.hidden_message(string)Optional. The message will show when the user pays your invoice.paid_btn_name(string) default -callbackOptional. Paid button name. This button will be shown when your invoice was paid. Supported names:viewItem- View ItemopenChannel- Open ChannelopenBot- Open Botcallback- Returnpaid_btn_url(string)Optional but requried when you use paid_btn_name. Paid button URL. You can set any payment success link (for example link on your bot). Start with https or http.payload(string, up to 4kb)Optional. Some data. User ID, payment id, or any data you want to attach to the invoice.allow_comments(boolean)Optional. Allow adding comments when paying an invoice. Default is true.allow_anonymous(boolean)Optional. Allow pay invoice as anonymous. Default is true.expires_in(number)Optional. You can set the expiration date of the invoice in seconds. Use this period: 1-2678400 seconds.Crypto.createInvoice("BTC",1,params={description:'kitten',paid_btn_name:viewItem,paid_btn_url:'http://placekitten.com/150'})transferUse this method to send coins from your app to the user. Returns object of completed transfer.user_id(number)
Telegram User ID. The user needs to have an account in our bot (send /start if no).asset(string)
Currency code. Supported assets:BTC,TON,ETH(only testnet),USDT,USDC,BUSD.amount(string)
Amount of the transfer in float. For example:125.50spend_id(string)
It is used to make your request idempotent. It's guaranteed that only one of the transfers with the same spend_id will be accepted by Crypto Pay API. This parameter is useful when the transfer should be retried (i.e. request timeout/connection reset/500 HTTP status/etc). You can use a withdrawal id or something. Up to 64 symbols.comment(string)Optional. The comment of the invoice. The comment will show in the notification about the transfer. Up to 1024 symbols.Crypto.transfer(121011054,'ETH',0.1,'ZG9uYXRl',params={comment:'donate'})getInvoicesUse this method to get invoices of your app. On success, the returns array of invoices.asset(string)Optional. Currency code. Supported assets:BTC,TON,ETH(only testnet),USDT,USDC,BUSD. Default: all assets.invoice_ids(string)Optional. Invoice IDs separated by comma.status(string)Optional. Status of invoices. Available statusses: active or paid. Default: all statusses.offset(number)Optional. Offset needed to return a specific subset of  invoices. Default 0.count(number)Optional. Number of invoices to return. Default 100, max 1000.Crypto.getInvoices(assets="TON",count=1)getBalanceUse this method to get balance of your app. Returns array of assets.Crypto.getBalance()getExchangeRatesUse this method to get exchange rates of supported currencies. Returns array of currencies.Crypto.getExchangeRates()getCurrenciesUse this method to supported currencies. Returns array of currencies.Crypto.getCurrencies()LicenseMIT