Module telegram-bot-lua.methods.payments

payments API methods.

Functions

api.answer_pre_checkout_query(pre_checkout_query_id, ok, opts) respond to a pre-checkout query confirming or rejecting the order.
api.answer_shipping_query(shipping_query_id, ok, opts) reply to shipping queries with available shipping options or an error.
api.create_invoice_link(title, description, payload, currency, prices, opts) create a link for an invoice.
api.edit_user_star_subscription(user_id, telegram_payment_charge_id, is_canceled) edit a user's star subscription status (cancel or re-enable).
api.get_star_transactions(opts) get the bot's telegram star transactions.
api.refund_star_payment(user_id, telegram_payment_charge_id) refund a successful payment in telegram stars.
api.send_invoice(chat_id, title, description, payload, currency, prices, opts) send an invoice to a chat.


Functions

api.answer_pre_checkout_query(pre_checkout_query_id, ok, opts)
respond to a pre-checkout query confirming or rejecting the order.

Parameters:

  • pre_checkout_query_id string unique identifier for the query to be answered
  • ok boolean whether the bot is ready to proceed with the order
  • opts table optional parameters (error_message)

Returns:

  1. table|false true on success, or false on failure
  2. string|table the HTTP status or error details
api.answer_shipping_query(shipping_query_id, ok, opts)
reply to shipping queries with available shipping options or an error.

Parameters:

  • shipping_query_id string unique identifier for the query to be answered
  • ok boolean whether delivery to the specified address is possible
  • opts table optional parameters (shippingoptions, errormessage)

Returns:

  1. table|false true on success, or false on failure
  2. string|table the HTTP status or error details
api.create_invoice_link(title, description, payload, currency, prices, opts)
create a link for an invoice.

Parameters:

  • title string product name
  • description string product description
  • payload string bot-defined invoice payload
  • currency string three-letter ISO 4217 currency code
  • prices string|table JSON-serialised array of LabeledPrice or a table thereof
  • opts table optional parameters (providertoken, maxtipamount, suggestedtip_amounts, etc.)

Returns:

  1. table|false the created invoice link as a string, or false on failure
  2. string|table the HTTP status or error details
api.edit_user_star_subscription(user_id, telegram_payment_charge_id, is_canceled)
edit a user's star subscription status (cancel or re-enable).

Parameters:

  • user_id number identifier of the user whose subscription will be edited
  • telegram_payment_charge_id string telegram payment identifier for the subscription
  • is_canceled boolean whether the subscription should be cancelled

Returns:

  1. table|false true on success, or false on failure
  2. string|table the HTTP status or error details
api.get_star_transactions(opts)
get the bot's telegram star transactions.

Parameters:

  • opts table optional parameters (offset, limit)

Returns:

  1. table|false the star transactions object, or false on failure
  2. string|table the HTTP status or error details
api.refund_star_payment(user_id, telegram_payment_charge_id)
refund a successful payment in telegram stars.

Parameters:

  • user_id number identifier of the user whose payment will be refunded
  • telegram_payment_charge_id string telegram payment identifier

Returns:

  1. table|false true on success, or false on failure
  2. string|table the HTTP status or error details
api.send_invoice(chat_id, title, description, payload, currency, prices, opts)
send an invoice to a chat.

Parameters:

  • chat_id string|number unique identifier for the target chat
  • title string product name
  • description string product description
  • payload string bot-defined invoice payload
  • currency string three-letter ISO 4217 currency code
  • prices string|table JSON-serialised array of LabeledPrice or a table thereof
  • opts table optional parameters (providertoken, maxtipamount, suggestedtipamounts, replymarkup, etc.)

Returns:

  1. table|false the sent message, or false on failure
  2. string|table the HTTP status or error details
generated by LDoc 1.5.0 Last updated 2026-04-07 21:37:15