Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save hanbule/076bef20ca34bccf548b7d356a32e9b2 to your computer and use it in GitHub Desktop.

Select an option

Save hanbule/076bef20ca34bccf548b7d356a32e9b2 to your computer and use it in GitHub Desktop.

Revisions

  1. @trialan trialan created this gist May 21, 2022.
    9 changes: 9 additions & 0 deletions inserting_transaction_in_db.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    def successful_payment_callback(update: Update, context):
    col = get_collection()
    receipt = update.message.successful_payment
    col.insert_one({"telegram_uid": update.message.chat.username,
    "donated_amount": receipt.total_amount,
    "currency": receipt.currency,
    "datetime": str(datetime.datetime.now())})
    print_col(col)
    update.message.reply_text("Thank you for your purchase!")