Skip to main content

payments.sendStarsForm

Make a payment using Telegram Stars, see here » for more info.

func (c *Client) PaymentsSendStarsForm(ctx context.Context, request *PaymentsSendStarsFormRequest) (PaymentsPaymentResultClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.PaymentsSendStarsForm(ctx, &tg.PaymentsSendStarsFormRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // PaymentsPaymentResultClass
return nil
})

Parameters

NameTypeRequiredDescription
FormIDint64yesPayment form ID
InvoiceInputInvoiceClassyesInvoice

Returns

PaymentsPaymentResultClass

Possible errors

CodeTypeDescription
406API_GIFT_RESTRICTED_UPDATE_APPPlease update the app to access the gift API.
400BALANCE_TOO_LOWThe transaction cannot be completed because the current Telegram Stars balance is too low.
403BOT_ACCESS_FORBIDDENThe specified method can be used over a business connection for some operations, but the specified query attempted an operation that is not allowed over a business connection.
400BOT_INVOICE_INVALIDThe specified invoice is invalid.
400BUSINESS_CONNECTION_INVALIDThe connection_id passed to the wrapping invokeWithBusinessConnection call is invalid.
400FORM_EXPIREDThe form was generated more than 10 minutes ago and has expired, please re-generate it using payments.getPaymentForm and pass the new form_id.
400FORM_ID_EMPTYThe specified form ID is empty.
400FORM_SUBMIT_DUPLICATEThe same payment form was already submitted. .
400FORM_UNSUPPORTEDPlease update your client.
400GIFT_STARS_INVALIDThe specified amount of stars is invalid.
400MEDIA_ALREADY_PAIDYou already paid for the specified media.
400MONTH_INVALIDThe number of months specified in inputInvoicePremiumGiftStars.months is invalid.
400PEER_ID_INVALIDThe provided peer id is invalid.
406PRECHECKOUT_FAILEDPrecheckout failed, a detailed and localized description for the error will be emitted via an updateServiceNotification as specified here ».
400PURPOSE_INVALIDThe specified payment purpose is invalid.
400STARGIFT_ALREADY_UPGRADEDThe specified gift was already upgraded to a collectible gift.
400STARGIFT_NOT_FOUNDThe specified gift was not found.
400STARGIFT_OWNER_INVALIDYou cannot transfer or sell a gift owned by another user.
400STARGIFT_SLUG_INVALIDThe specified gift slug is invalid.
400STARGIFT_USAGE_LIMITEDThe gift is sold out.
400STARGIFT_USER_USAGE_LIMITEDYou've reached the starGift.limited_per_user limit, you can't buy any more gifts of this type.
406STARS_FORM_AMOUNT_MISMATCHThe form amount has changed, please fetch the new form using payments.getPaymentForm and restart the process.
400TO_ID_INVALIDThe specified to_id of the passed inputInvoiceStarGiftResale or inputInvoiceStarGiftTransfer is invalid.
400USER_ID_INVALIDThe provided user ID is invalid.

References