WhiteLabelName Python SDK
Python SDK to access WhiteLabelName web services API.
Library facilitates your interaction with various services such as transactions, accounts, and subscriptions.
API documentation
WhiteLabelName Web Service API
Requirements
- Python 3.7+
Installation
pip3 install (recommended)
pip3 install --upgrade whitelabelmachinename
pip3 install from source via github
pip3 install git+http://github.com/WhiteLabelGithubOwnerName/python-sdk.git
(you may need to run pip3 with root permission: sudo pip3 install git+http://github.com/WhiteLabelGithubOwnerName/python-sdk.git )
install from source via Setuptools
Install via Setuptools.
pip3 install setuptools
python setup.py install
(or sudo python setup.py install to install the package for all users)
Usage
The library needs to be configured with your account's space id, user id, and secret key which are available in your WhiteLabelName
account dashboard. Set space_id, user_id, and api_secret to their values.
You can also optionally set default_headers to set some headers that will be sent to all requests
Configuring a Service
from whitelabelmachinename import Configuration
from whitelabelmachinename.api import TransactionServiceApi, TransactionPaymentPageServiceApi
from whitelabelmachinename.models import LineItem, LineItemType, TransactionCreate
space_id = 405
# default_headers is an optional param, that represents headers sent to all requests
config = Configuration(
user_id=512,
api_secret='FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=',
default_headers={'x-meta-custom-header': 'value-1', 'x-meta-custom-header-2': 'value-2'},
# set a custom request timeout if needed. (If not set, then the default value is: 25 seconds)
request_timeout = 30
)
transaction_service = TransactionServiceApi(configuration=config)
transaction_payment_page_service = TransactionPaymentPageServiceApi(configuration=config)
To get started with sending transactions, please review the example below:
from whitelabelmachinename import Configuration
from whitelabelmachinename.api import TransactionServiceApi, TransactionPaymentPageServiceApi
from whitelabelmachinename.models import LineItem, LineItemType, TransactionCreate
space_id = 405
config = Configuration(
user_id=512,
api_secret='FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=',
# set a custom request timeout if needed. (If not set, then the default value is: 25 seconds)
request_timeout = 30
)
transaction_service = TransactionServiceApi(configuration=config)
transaction_payment_page_service = TransactionPaymentPageServiceApi(configuration=config)
# create line item
line_item = LineItem(
name='Red T-Shirt',
unique_id='5412',
sku='red-t-shirt-123',
quantity=1,
amount_including_tax=29.95,
type=LineItemType.PRODUCT
)
# create transaction model
transaction = TransactionCreate(
line_items=[line_item],
auto_confirmation_enabled=True,
currency='EUR',
)
transaction_create = transaction_service.create(space_id=space_id, transaction=transaction)
payment_page_url = transaction_payment_page_service.payment_page_url(space_id=space_id, id=transaction_create.id)
# redirect your customer to this payment_page_url
License
Please see the license file for more information.
Release files for whitelabelmachinename 4.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| whitelabelmachinename-4.1.0.tar.gz | 341.5 kB | Details |
Release files / whitelabelmachinename-4.1.0.tar.gz
| Download URL | whitelabelmachinename-4.1.0.tar.gz |
|---|---|
| Size | 341.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b15a17950c0dbf632b65aecc93710ec38d627196d5eab55d29db8207073f8ba5
|
|
BLAKE2b-256 checksum How to use checksums |
7239ade6d79b6a993e1c58c70a688e8fabb972f0180946f753ab2f399c50850e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|