CryptoPay
CryptoPay
CryptoPay payment system.
Source code in src/CryptoPayAPI/api.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|
__init__(api_key, testnet=False, client=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
str
|
CryptoPay API token. |
required |
testnet |
bool
|
Use Testnet? Defaults to False. |
False
|
client |
AsyncClient
|
Using custom AsyncClient. Defaults is None. |
None
|
Source code in src/CryptoPayAPI/api.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
create_invoice(asset, amount, description=None, hidden_message=None, paid_btn_name=None, paid_btn_url=None, payload=None, allow_comments=True, allow_anonymous=True, expires_in=None)
async
Create a new invoice.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
asset |
schemas.Assets
|
Currency. |
required |
amount |
float
|
Amount of invoice in float. |
required |
description |
Optional[str]
|
Description for the invoice. User will see this description when they pay the invoice. Up to 1024 characters. Defaults to None. |
None
|
hidden_message |
Optional[str]
|
Text of the message that will be shown to a user after the invoice is paid. Up to 2048 characters. Defaults to None. |
None
|
paid_btn_name |
Optional[schemas.PaidButtonNames]
|
Name of the button that will be shown to a user after the invoice is paid. Defaults to None. |
None
|
paid_btn_url |
Optional[str]
|
Required if paid_btn_name is used. URL to be opened when the button is pressed. You can set any success link (for example, a link to your bot). Starts with https or http. Defaults to None. |
None
|
payload |
Optional[str]
|
Any data you want to attach to the invoice (for example, user ID, payment ID, ect). Up to 4kb. Defaults to None. |
None
|
allow_comments |
bool
|
Allow a user to add a comment to the payment. Defaults to True. |
True
|
allow_anonymous |
bool
|
Allow a user to pay the invoice anonymously. Defaults to True. |
True
|
expires_in |
Optional[int]
|
You can set a payment time limit for the invoice in seconds. Values between 1-2678400 are accepted. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
schemas.Invoice
|
schemas.Invoice: Object of the created invoice. |
Source code in src/CryptoPayAPI/api.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
|
get_balance()
async
Use this method to get a balance of your app.
Returns:
Type | Description |
---|---|
List[schemas.Balance]
|
List[schemas.Balance]: Array of assets. |
Source code in src/CryptoPayAPI/api.py
119 120 121 122 123 124 125 126 127 |
|
get_currencies()
async
Use this method to get a list of supported currencies.
Returns:
Type | Description |
---|---|
List[schemas.Currency]
|
List[schemas.Currency]: Array of currencies. |
Source code in src/CryptoPayAPI/api.py
139 140 141 142 143 144 145 146 147 |
|
get_exchange_rates()
async
Use this method to get exchange rates of supported currencies.
Returns:
Type | Description |
---|---|
List[schemas.ExchangeRate]
|
List[schemas.ExchangeRate]: Array of currencies. |
Source code in src/CryptoPayAPI/api.py
129 130 131 132 133 134 135 136 137 |
|
get_invoices(asset=None, invoice_ids=None, status=None, offset=0, count=100)
async
Use this method to get invoices of your app.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
asset |
Optional[schemas.Assets]
|
Currency codes separated by comma. Defaults to all assets. |
None
|
invoice_ids |
Optional[str]
|
Invoice IDs separated by comma. Defaults to None. |
None
|
status |
Optional[schemas.InvoiceStatus]
|
Status of invoices to be returned. Defaults to all statuses. |
None
|
offset |
int
|
Offset needed to return a specific subset of invoices. Defaults to 0. |
0
|
count |
int
|
Number of invoices to be returned. Values between 1-1000 are accepted. Defaults to 100. |
100
|
Returns:
Type | Description |
---|---|
List[schemas.Invoice]
|
List[schemas.Invoice]: Array of invoices. |
Source code in src/CryptoPayAPI/api.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
|
get_me()
async
Returns basic information about an app.
Returns:
Type | Description |
---|---|
schemas.Application
|
schemas.Application: Basic information about an app. |
Source code in src/CryptoPayAPI/api.py
109 110 111 112 113 114 115 116 117 |
|
process_webhook_update(body, headers)
async
Process webhook update.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
body |
bytes
|
Update request body. |
required |
headers |
dict
|
Update request headers. |
required |
Returns:
Type | Description |
---|---|
schemas.Update
|
schemas.Update: Webhook update. |
Source code in src/CryptoPayAPI/api.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|
transfer(user_id, asset, amount, spend_id, comment=None, disable_send_notification=False)
async
Use this method to send coins from your app's balance to a user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id |
int
|
Telegram user_id. |
required |
asset |
schemas.Assets
|
Currency. |
required |
amount |
float
|
Amount of the transfer in float. The minimum and maximum amounts for each of the support asset roughly correspond to the limit of 0.01-25000 USD. Use |
required |
spend_id |
str
|
Unique ID to make your request idempotent and ensure that only one of the transfers with the same |
required |
comment |
Optional[str]
|
Comment for the transfer. Users will see this comment when they receive a notification about the transfer. Up to 1024 symbols. Defaults to None. |
None
|
disable_send_notification |
Optional[bool]
|
Pass |
False
|
Returns:
Type | Description |
---|---|
schemas.Transfer
|
schemas.Transfer: Object of completed |
Source code in src/CryptoPayAPI/api.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
|
Created: January 11, 2023