-
-
Notifications
You must be signed in to change notification settings - Fork 120
/
Copy pathsendInvoice2.json
1 lines (1 loc) · 5.01 KB
/
sendInvoice2.json
1
[{"id":"147ec1f1de43e1dd","type":"telegram command","z":"5c2564baa1f544ec","name":"","command":"/buy","description":"","registercommand":false,"language":"","bot":"3b6bfbc0.423a04","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":210,"y":320,"wires":[["a716035a2c1abd5a"],[]]},{"id":"a716035a2c1abd5a","type":"function","z":"5c2564baa1f544ec","name":"send invoice","func":"// Invoice Information see https://core.telegram.org/bots/api#sendinvoice\nmsg.payload.type = \"sendInvoice\";\n\nmsg.payload.content = {\n title : \"Super Toy\",\n description : \"The best toy you can buy\",\n payload : \"secret token\",\n providerToken : \"the token from your bank\",\n currency : \"EUR\", // see https://core.telegram.org/bots/payments#supported-currencies\n prices : [ {\n label : \"price\",\n amount : 15000 } ], // this is 150.00EUR\n}\n\n// Optional\n// msg.payload.options\n// provider_data\n// photo_url\n// photo_size\n// photo_width\n// photo_height\n// need_name\n// need_phone_number\n// need_email\n// need_shipping_address\n// send_phone_number_to_provider\n// send_email_to_provider\n// is_flexible\n// disable_notification\n// reply_to_message_id\n// reply_markup\n\nmsg.payload.options = {\n reply_to_message_id : msg.payload.messageId,\n need_name : true,\n need_phone_number : true,\n need_email : true,\n is_flexible : true\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":433,"y":315,"wires":[["7c2e9864f8dec2e2"]]},{"id":"7c2e9864f8dec2e2","type":"telegram sender","z":"5c2564baa1f544ec","name":"","bot":"3b6bfbc0.423a04","haserroroutput":false,"outputs":1,"x":773,"y":435,"wires":[["9e8f4f0d501588d8"]]},{"id":"3210b28f7015a16d","type":"telegram event","z":"5c2564baa1f544ec","name":"","bot":"3b6bfbc0.423a04","event":"pre_checkout_query","autoanswer":false,"x":173,"y":475,"wires":[["5b30dcc6d2644982"]]},{"id":"5b30dcc6d2644982","type":"function","z":"5c2564baa1f544ec","name":"answer checkout","func":"// Invoice Information see https://core.telegram.org/bots/api#answerprecheckoutquery\nmsg.payload.type = \"answerPreCheckoutQuery\";\nmsg.payload.ok = true;\n\nmsg.payload.options = {\n error_message : \"Product not available anymore!\"\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":453,"y":475,"wires":[["7c2e9864f8dec2e2"]]},{"id":"9e8f4f0d501588d8","type":"debug","z":"5c2564baa1f544ec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":973,"y":435,"wires":[]},{"id":"fe805bc20926906b","type":"function","z":"5c2564baa1f544ec","name":"thank you","func":"// see https://core.telegram.org/bots/api#successfulpayment\nif (msg.payload.type === \"successful_payment\") {\n msg.payload.type = \"message\";\n msg.payload.content = \"Thank you for your purchase!\";\n return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":423,"y":555,"wires":[["7c2e9864f8dec2e2"]]},{"id":"0a522589bdacc2ca","type":"telegram receiver","z":"5c2564baa1f544ec","name":"","bot":"3b6bfbc0.423a04","saveDataDir":"","filterCommands":false,"x":171,"y":562,"wires":[["fe805bc20926906b"],[]]},{"id":"74ebbb35041a3d28","type":"telegram event","z":"5c2564baa1f544ec","name":"","bot":"3b6bfbc0.423a04","event":"shipping_query","autoanswer":false,"x":183,"y":395,"wires":[["60f6230b559b70fd"]]},{"id":"60f6230b559b70fd","type":"function","z":"5c2564baa1f544ec","name":"answer shipping","func":"// Invoice Information see https://core.telegram.org/bots/api#answershippingquery\nmsg.payload.type = \"answerShippingQuery\";\nmsg.payload.ok = true;\n\nmsg.payload.options = {\n error_message : \"We cannot deliver to your address\",\n shipping_options: [\n {\n id: \"shipping\",\n title: \"Shipping by seller\",\n prices: [\n { label: \"Shipping by seller 1\", amount: 500 },\n { label: \"Shipping by seller 2\", amount: 500 }\n ]\n },\n {\n id: \"takeaway\",\n title: \"Take away\",\n prices: [{ label: \"-Take away\", amount: 0 }]\n }\n ]\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":443,"y":395,"wires":[["7c2e9864f8dec2e2"]]},{"id":"f30f2b26304282dc","type":"comment","z":"5c2564baa1f544ec","name":"Payment Example","info":"In order to be able to run the example you must set the providerToken in the \"send invoice\" node.\nsee also https://core.telegram.org/bots/api#sendinvoice","x":180,"y":260,"wires":[]},{"id":"3b6bfbc0.423a04","type":"telegram bot","botname":"smarthomesolutions_bot","usernames":"","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":false}]