Package: yenepay
ᴘʏᴛʜᴏɴ sᴅᴋ | ᴜɴᴏғғɪᴄɪᴀʟThis library allows you to quickly and easily add YenePay as a payment method using PythonWe encourage you to read through this document to get the most our of what this library has to offer. We want this library to be community driven and we really appreciate any support we can get from the community.Getting StartedThese instructions will guide you on how to develop and test YenePay's payment method integration with your Python application. YenePay have setup a sandbox environment for you to test and play around the integration process. To learn more about this, please visit yenepay community site:https://community.yenepay.com/Pre-requisiteTo add YenePay to your application and start collecting payments, you will first need to register on YenePay as a merchant and get your seller code. You can do that fromhttps://www.yenepay.com/merchantInstallationOption 1: UsingPyPIpipinstallyenepayOption 2: Directly fromGitHubClone package into local folder and change directorgitclonegit@github.com:backostech/yenepay.sdk.python.gitcdyenepay.sdk.python/Install using pythonsetuptoolspythonsetup.py.Basic UsageCreating clientInorder to use any feature from this package, first you have to create a client instance.fromyenepayimportClientMERCHANT_ID="0000"client=Client(MERCHANT_ID)# Return client instanceCreating express checkoutInorder to process a single item you can checkout using express checkoutfromyenepayimportClient,Itemclient=Client(merchant_id="0000",token="abcd")item=Item("PC",42_000.00,1)express_checkout=client.get_cart_checkout(items=[item],use_sandbox=True,)checkout_url=express_checkout.get_url()print(checkout_url)This is the same as the above onefromyenepayimportClient,Item,ExpressCheckotclient=Client(merchant_id="0000",token="abcd")item=Item("PC",42_000.00,1)express_checkout=ExpressCheckot(client,item,use_sandbox=True,)checkout_url=express_checkout.get_url()print(checkout_url)Creating cart checkoutCart checkout are used for multiple items checkout.fromyenepayimportClient,Item,CartMERCHANT_ID="0000"client=Client(MERCHANT_ID)# Create carts to store items.cart=Cart(Item("PC_1",50_000.00,1),Item("PC_2",20_000.00,3),Item("PC_3",10_000.00,4),Item("PC_4",150_000.00,2),)print(cart.total_price)# returns total of cart items unit pricecart_checkout=client.get_cart_checkout(items=cart)checkout_url=cart_checkout.get_url()# Return link for payment, if successprint(checkout_url)Or you can use CartCheckout classfromyenepayimportClient,Item,Cart,CartCheckoutMERCHANT_ID="0000"client=Client(MERCHANT_ID)# Create carts to store items.cart=Cart(Item("PC_1",50_000.00,1),Item("PC_2",20_000.00,3),Item("PC_3",10_000.00,4),Item("PC_4",150_000.00,2),)cart_checkout=CartCheckout(client,cart)checkout_url=cart_checkout.get_url()# Return link for payment, if successprint(checkout_url)You can send list of items into a class if you wantitems=[Item("PC_1",50_000.00,1),Item("PC_2",20_000.00,3),Item("PC_3",10_000.00,4),Item("PC_4",150_000.00,2),]cart_checkout=client.get_cart_checkout(items=items)PDTYou can check your payment order status using PDT classfromyenepayimportClientclient=Client(merchant_id="0000",token="abcd")merchant_order_id="0000"# Give when you create checkout urltransaction_id="abcd"# Send from yenepay when payment is successfullresponse=client.check_pdt_status(merchant_order_id,transaction_id)ifresponse.result=="SUCCESS"andresponse.status=="Paid":print("Payment Completed By:{}".format(response.buyer_id))If you have an instance of checkout, that create a link you can usefromyenepayimportClient,Itemclient=Client(merchant_id="0000",token="abcd")merchant_order_id="0000"transaction_id="abcd"express_checkout=client.get_express_checkout(client,Item("PC-1",50_000.00,1),merchant_order_id=merchant_order_id,success_url="localhost:8000",# Url, transaction id will be sent,)pdt_response=express_checkout.check_pdt_status(transaction_id)# The rest of you process can run here....Read more from our documationreadthedocs.ContactDon't hesitate to contact us, either in person or through our call centers.info@backostech.comBackos Technologies+251910900879𝔹𝕒𝕔𝕜𝕠𝕤 𝕋𝕖𝕔𝕙𝕟𝕠𝕝𝕠𝕘𝕚𝕖𝕤ᴀ ᴛᴇᴄʜ ʏᴏᴜ ᴄᴀɴ ᴛʀᴜsᴛ© CopyrightBackos Technologies. All Rights Reserved