Sample Integration Codes

import requests
import hashlib



merchantId = "123" 
secret = "xyz"


def getHash(Amount):
    """
    Join input parameter and hash them
    """
    Join_string = Amount+merchantId+secret
    name = hashlib.sha256(Join_string.encode('utf-8')).hexdigest()
    return name

def Query(A1PayReference,Amount):
    hash_code = getHash(Amount)
    request = requests.get("https://a1pay.net/api/Query/Status/?transactionRef="+A1PayReference, headers={"Hash":hash_code})
    return request

def QueryWithMyReference(MyTransactionReference,Amount):
    hash_code = getHash(Amount)
    request = requests.get("https://a1pay.net/api/Query/StatusWithMyReference/?transactionRef="+MyTransactionReference+"&merchantId="+merchantId, headers={"Hash":hash_code})
    return request
    

reference = "xyz"
query = Query(reference,"2000.00") 
print(query.content)
    

Last updated