Wrapper arround YouCanPay gateway
Project description
youcanpay_python
Python wrapper arround YouCanPay gateway
Installation
Install youcanpay-python using pip:
pip install youcanpay-python
Usage Example
The following example demonstrates how to use youcanpay to create a payment token:
from youcanpay.youcan_pay import YouCanPay
from youcanpay.models.token import TokenData
from youcanpay.models.data import Customer
# Enable sandbox mode for testing
YouCanPay.enable_sandbox_mode()
# Initialize YouCanPay with your private and public keys
youcan_pay = YouCanPay.instance().use_keys(
"your_private_key",
"your_public_key",
)
# Set up customer information
customer_info = Customer(
name="Younes",
address="123 street",
zip_code="999",
country_code="MA",
phone="+212600000000",
email="example@example.com",
)
# Define metadata for the transaction
metadata = {"item_id": "A123", "campaign": "Summer Sale"}
# Configure order details
token_params = TokenData(
order_id="OR238472",
amount="2000",
currency="MAD",
customer_ip="123.123.123.123",
success_url="https://example.com/success",
error_url="https://example.com/error",
customer_info=customer_info,
metadata=metadata,
)
# Create the token and get the payment URL
token = youcan_pay.token.create_from(token_params)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
youcanpay-0.1.0.tar.gz
(5.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file youcanpay-0.1.0.tar.gz.
File metadata
- Download URL: youcanpay-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.10.12 Linux/6.2.0-36-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f9eab56f89f1767b6b40ae5746bd5795ee21310ecb710aacd7d75c6f10c6bc8
|
|
| MD5 |
c2f3aa93fb4d4f401316706dda749e0b
|
|
| BLAKE2b-256 |
212eba04a73ec6fb0db93d7ce24fb3f87d2c0d832f334d9e281349c09d1074eb
|
File details
Details for the file youcanpay-0.1.0-py3-none-any.whl.
File metadata
- Download URL: youcanpay-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.10.12 Linux/6.2.0-36-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa54bf66dcbecf6d782dcaf1e924d0f2e58cd56601d68b6d538c6ebc8a4dd1ec
|
|
| MD5 |
e652310642a1e3626480a330e2d86f82
|
|
| BLAKE2b-256 |
d2f3ab1c401d5de919128d634d990d0e63ce04770555f08fb21b42a3f24e2fbe
|