Skip to content

export Class

InvoicesManager ​

extends ​

CachedManager<string, Invoice>

Constructor ​

ts
new InvoicesManager( client )
ParameterTypeDescription
clientClient

Properties ​

get cache : Collection<CachedManager.K, CachedManager.V> ​

readonly client : Client ​

readonly default? : any ​

readonly options : any ​

provider_token? : string ​

The token provided by your payment provider for payments.

Methods ​

_add( data, cache, param2 ) ​

Add data with cache check to the current manager.

ParameterTypeDescription
dataanyThe data to add to the cache manager.
cache = truebooleanPass True to cache the data.
param2 = {}anyAdditional data to pass.

Returns: any

create( id, invoice ) ​

Creates an invoice and store it in the manger.

ParameterTypeDescription
idstringThe id of the invoices to store as.
invoiceInvoiceThe payload of the invoice.

Returns: any

Creates an invoice link and store it in the manager.

ParameterTypeDescription
idstringThe id of the invoices to store as.
payloadCreateInvoiceLinkPayloadThe payload of the invoice link.

Returns: Promise<string | boolean>

generate( id ) ​

Returns an invoice link or an invoice with complete details such as payment_provider, but excluding chat ids.

ParameterTypeDescription
idstringThe id of the invoice.

Returns: String | Boolean | Partial<SendInvoicePayload>

asyncsend( id, chat_id ) ​

This will only work with invoices and not link invoices!

ParameterTypeDescription
idstringThe id of the invoice.
chat_idnumberThe target chat to send the invoice to.

Returns: Promise<void | Message>

setToken( token ) ​

Sets the token for the invoices generated.

ParameterTypeDescription
tokenstringThe token provided by your payment provider for payments.

Returns: void