This release is a pre-release and may not be stable for production use.
ᴘʏᴛʜᴏɴ sᴅᴋ | ᴜɴᴏғғɪᴄɪᴀʟ
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
Installation
Option 1: Using PyPI
pip install yenepay
Option 2: Directly from GitHub
- Clone package into local folder and change director
git clone git@github.com:backostech/yenepay.sdk.python.git
cd yenepay.sdk.python/
- Install using python
setuptools
python setup.py .
Basic Usage
Creating client
- Inorder to use any feature from this package, first you have to create a client instance.
from yenepay import Client
MERCHANT_ID = "0000"
client = Client(MERCHANT_ID) # Return client instance
Creating express checkout
- Inorder to process a single item you can checkout using express checkout
from yenepay import Client, Item
client = 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 one
from yenepay import Client, Item, ExpressCheckot
client = 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 checkout
- Cart checkout are used for multiple items checkout.
from yenepay import Client, Item, Cart
MERCHANT_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 price
cart_checkout = client.get_cart_checkout(items=cart)
checkout_url = cart_checkout.get_url() # Return link for payment, if success
print(checkout_url)
Or you can use CartCheckout class
from yenepay import Client, Item, Cart, CartCheckout
MERCHANT_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 success
print(checkout_url)
You can send list of items into a class if you want
items = [
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)
PDT
- You can check your payment order status using PDT class
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))
If you have an instance of checkout, that create a link you can use
from yenepay import Client, Item
client = 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 documation readthedocs.
Contact
Don't hesitate to contact us, either in person or through our call centers.
+251910900879
𝔹𝕒𝕔𝕜𝕠𝕤 𝕋𝕖𝕔𝕙𝕟𝕠𝕝𝕠𝕘𝕚𝕖𝕤
ᴀ ᴛᴇᴄʜ ʏᴏᴜ ᴄᴀɴ ᴛʀᴜsᴛ
© Copyright Backos Technologies. All Rights Reserved
Metadata
Release files for yenepay 0.5.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yenepay-0.5.0a0.tar.gz | 17.1 kB | Without provenance | Details for yenepay-0.5.0a0.tar.gz |
Release files / yenepay-0.5.0a0.tar.gz
| Download URL | yenepay-0.5.0a0.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5df30226f408cf493c1fb516ea20aecc379889004c8cc8eebc819cfe46dc01d6
|
|
BLAKE2b-256 checksum How to use checksums |
2a8b78f3e65123c5c149ea66c6e104200daa97254126842658dc1a2fba817839
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Security for yenepay 0.5.0a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.