Auto gcash payment api? :) [python]

Results 1 to 6 of 6
  1. #1
    Proficient Member masterband1427 is offline
    MemberRank
    Mar 2011 Join Date
    Los Angeles, CaLocation
    152Posts

    Auto gcash payment api? :) [python]

    Im using TELERIVET as GATEWAY to Get SMS From Mobile


    THIS IS INCOMPLETE YOU MUST HAVE A KNOWLEDGE IN CODING IN ORDER TO FINISH THIS :D

    Things to do :

    1.) make it run 24/7 just like discord bot :D
    2.) add sql module for auto add topup code in RanDatabase :D
    3.) modify the code so it will be beautiful :D

    ITS UP TO YOU NOW IF YOU WANT TO SHARE IT OR KEEP IT FOR YOUR SELF :D

    Code:
    import requests
    
    class gcashpayments:
        def check_message():
    
            keywords = ["You have received PHP "," of GCash from ","Ref. No. "]
    
            url = "https://api.telerivet.com/v1/projects/<project_id_here>/messages"
            header = {"Content-Type": "application/json","Authorization":"Basic <api_key_here>"}
    
            r = requests.get(url,headers=header)
    
            data = r.json()
            
            if len(data['data']) == 0:
                print("No Messages yet")
            else:
                for donate in data['data']:
                    content = donate['content']
                    sender = donate['from_number']
    
                    if sender == 'GCash':
                        amount_index = content.find(keywords[0])
                        amount_end_index = content.find(keywords[1])
                        reference_index = content.find(keywords[2])
    
                        amount = content[amount_index+len(keywords[0]):amount_end_index]
                        reference_no = content[reference_index+len(keywords[2]):reference_index+len(keywords[2])+13]
                        print("Amount : {} - Reference : {}".format(amount,reference_no))
                        gcashpayments.insert_topup(amount,reference_no)
                        gcashpayments.delete_message(donate['id'])
    
        def delete_message(message_id):
            url = "https://api.telerivet.com/v1/projects/<project_id_here>/messages/{}".format(message_id)
            header = {"Content-Type": "application/json","Authorization":"Basic <api_key_here>"}
            r = requests.delete(url,headers=header)
    
        def insert_topup(amount,reference):
            print("Insert toup -> Amount = {} / Reference : {}".format(amount,reference))
    
    
    gcashpayments.check_message()
    SCREENSHOT :

    Spoiler:
    Last edited by masterband1427; 04-10-22 at 09:44 AM. Reason: ADD SCREENSHOTS


  2. #2
    Enthusiast jongski09 is offline
    MemberRank
    Oct 2009 Join Date
    48Posts
    This is written in Python, you must connect it using Pyobdc module to be able to integrate it into your SQL Server.

    Additionally, you can create a discord bot in Python and have this run 24/7.

    Hope this additional clues will ease your coding life :D
    Last edited by jongski09; 05-10-22 at 10:41 AM.

  3. #3
    Proficient Member masterband1427 is offline
    MemberRank
    Mar 2011 Join Date
    Los Angeles, CaLocation
    152Posts
    Not many people visit this section :D I'm glad there's someone interested in this idea :D

  4. #4
    Apprentice YeXiuPH is offline
    MemberRank
    Aug 2020 Join Date
    7Posts
    Cool, would it be alright if I remake this into .Net with MSSQL Connection so everyone can use this by just changing something on appsetting.json :)

  5. #5
    Proficient Member masterband1427 is offline
    MemberRank
    Mar 2011 Join Date
    Los Angeles, CaLocation
    152Posts
    Quote Originally Posted by YeXiuPH View Post
    Cool, would it be alright if I remake this into .Net with MSSQL Connection so everyone can use this by just changing something on appsetting.json :)
    feel free to do anything that you like :)

  6. #6
    Enthusiast janzs420 is offline
    MemberRank
    Mar 2021 Join Date
    IndoLocation
    41Posts
    thanks sharing
    Last edited by janzs420; 28-11-22 at 05:41 PM.



Advertisement