pip install lazerpay-python-sdk
fromlazerpay.resourceimportLazerPayClientlazerpay=LazerPayClient(pubKey=LAZER_PUBLIC_KEY, secretKey=LAZER_SECRET_KEY)For staging, Use TEST API Keys and for production, use LIVE API KEYS. You can get your LAZER_PUBLIC_KEYS from the Lazerpay dashboard.
1. PAYMENT
* Initialize Payment
* Confirm Payments
This describes to allow your customers to initiate a crypto payment transfer.
fromlazerpay.resourceimportLazerPayClientlazerpay=LazerPayClient(pubKey=LAZER_PUBLIC_KEY, secretKey=LAZER_SECRET_KEY)
try:
response=lazerpay.initTransaction( reference="YOUR_REFERENCE", # Replace with a reference you generatedamount="10", customer_name="Njoku Emmanuel", customer_email="kalunjoku123@gmail.com", coin="USDC", currency="NGN", accept_partial_payment=True# By default, it's false
)
exceptExceptionase:
raiseeThis describes to allow you confirm your customers transaction after payment has been made.
fromlazerpay.resourceimportLazerPayClientlazerpay=LazerPayClient(pubKey=LAZER_PUBLIC_KEY, secretKey=LAZER_SECRET_KEY)
try:
response=lazerpay.confirmPayment(
identifier="address generated or the reference generated by you from initializing payment"
)
exceptExceptionase: raiseeThis gets the list of accepted cryptocurrencies on Lazerpay
fromlazerpay.resourceimportLazerPayClientlazerpay=LazerPayClient(pubKey=LAZER_PUBLIC_KEY, secretKey=LAZER_SECRET_KEY)
try:
response=lazerpay.getAcceptedCoins()
exceptExceptionase: raiseePayout funds to an address
fromlazerpay.resourceimportLazerPayClientlazerpay=LazerPayClient(pubKey=LAZER_PUBLIC_KEY, secretKey=LAZER_SECRET_KEY)
try:
response=lazerpay.payout(amount=1,
recipient="0x0B4d358D349809037003F96A3593ff9015E89efA", coin="BUSD", blockchain="Binance Smart Chain"
)
exceptExceptionase: raisee