Welcome to YenePay’s Python SDK (ᴜɴᴏғғɪᴄɪᴀʟ) documentation!#

Important

This project is under active development.

YenePay Test Linters Publication PyPi Package Version PyPi status Downloads Supported python versions Documentation Status Github issues MIT License

This library allows you to quickly and easily add YenePay as a payment method using Python

We 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 Started#

These 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-requisite#

To 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 from https://www.yenepay.com/merchant

Quick Start#

Install yenepay using pip

pip install yenepay

Creating basic express checkout

"""
Create checkout url for express process from client.
"""
from yenepay import Client, Item

client = Client(merchant_id="0000")

item = Item("PC", 42_000.00, 1)

express_checkout = client.get_cart_checkout(items=item)

checkout_url = express_checkout.get_url()

print(checkout_url)

Creating basic cart checkout

"""
Create checkout url for cart process using cart instance.
"""
from yenepay import Cart, Client, Item

client = Client(merchant_id="0000")

# 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 = client.get_cart_checkout(items=cart)

checkout_url = cart_checkout.get_url()  # Return link for payment, if success

print(checkout_url)

Checking PDT Status

"""
Check payment order status from client instance.
"""
from yenepay import Client

client = Client(merchant_id="0000", token="abcd")

merchant_order_id = "0000"  # Give when you create checkout url

transaction_id = "abcd"  # Send from yenepay when payment is successfull

response = client.check_pdt_status(merchant_order_id, transaction_id)

if response.result == "SUCCESS" and response.status == "Paid":
    print("Payment Completed By: {}".format(response.buyer_id))

Read Usage for more detail

Contents#