wallee


Namewallee JSON
Version 5.1.0 PyPI version JSON
download
home_pageNone
SummarySDK that allows you to access wallee
upload_time2024-04-08 10:13:40
maintainerNone
docs_urlNone
authorWallee AG
requires_python>=3.7
licenseApache-2.0
keywords wallee payment payment integration
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Build Status](https://travis-ci.org/wallee-payment/python-sdk.svg?branch=master)](https://travis-ci.org/wallee-payment/python-sdk)

# wallee Python SDK

Python SDK to access wallee web services API.

Library facilitates your interaction with various services such as transactions, accounts, and subscriptions.

## API documentation

[wallee Web Service API](https://app-wallee.com/doc/api/web-service)

## Requirements

- Python 3.7+

## Installation

### pip3 install (recommended)
```sh
pip3 install --upgrade wallee
```

### pip3 install from source via GitHub

```sh
pip3 install git+http://github.com/wallee-payment/python-sdk.git
```
(you may need to run `pip3` with root permission: `sudo pip3 install git+http://github.com/wallee-payment/python-sdk.git` )

### install from source via Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
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 [wallee
account dashboard](https://app-wallee.com/account/select). 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

```python
from wallee import Configuration
from wallee.api import TransactionServiceApi, TransactionPaymentPageServiceApi

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:

```python
from wallee import Configuration
from wallee.api import TransactionServiceApi, TransactionPaymentPageServiceApi
from wallee.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
```

### Integrating Webhook Payload Signing Mechanism into webhook callback handler

The HTTP request which is sent for a state change of an entity now includes an additional field `state`, which provides information about the update of the monitored entity's state. This enhancement is a result of the implementation of our webhook encryption mechanism.

Payload field `state` provides direct information about the state update of the entity, making additional API calls to retrieve the entity state redundant.

#### ⚠️ Warning: Generic Pseudocode

> **The provided pseudocode is intentionally generic and serves to illustrate the process of enhancing your API to leverage webhook payload signing. It is not a complete implementation.**
>
> Please ensure that you adapt and extend this code to meet the specific needs of your application, including appropriate security measures and error handling.
For a detailed webhook payload signing mechanism understanding we highly recommend referring to our comprehensive
[Webhook Payload Signing Documentation](https://app-wallee.com/doc/webhooks#_webhook_payload_signing_mechanism).

```python
@app.route('/webhook/callback', methods=['POST'])
def handle_webhook():
    request_payload = request.data.decode('utf-8')
    signature = request.headers.get('x-signature')

    if not signature:
        # Make additional API call to retrieve the entity state
        # ...
    else:
        if webhook_encryption_service().is_content_valid(signature_header=signature, content_to_verify=request_payload):
            # Parse request_payload to extract 'state' value
            # Process entity's state change
            # ...

    # Process the received webhook data
    # ...

```

## License

Please see the [license file](https://github.com/wallee-payment/python-sdk/blob/master/LICENSE) for more information.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "wallee",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "wallee, Payment, Payment Integration",
    "author": "Wallee AG",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c3/94/e6165b0481f40302905b8a10c9a448987601857889a5d71fcf4b926c4ae2/wallee-5.1.0.tar.gz",
    "platform": null,
    "description": "[![Build Status](https://travis-ci.org/wallee-payment/python-sdk.svg?branch=master)](https://travis-ci.org/wallee-payment/python-sdk)\n\n# wallee Python SDK\n\nPython SDK to access wallee web services API.\n\nLibrary facilitates your interaction with various services such as transactions, accounts, and subscriptions.\n\n## API documentation\n\n[wallee Web Service API](https://app-wallee.com/doc/api/web-service)\n\n## Requirements\n\n- Python 3.7+\n\n## Installation\n\n### pip3 install (recommended)\n```sh\npip3 install --upgrade wallee\n```\n\n### pip3 install from source via GitHub\n\n```sh\npip3 install git+http://github.com/wallee-payment/python-sdk.git\n```\n(you may need to run `pip3` with root permission: `sudo pip3 install git+http://github.com/wallee-payment/python-sdk.git` )\n\n### install from source via Setuptools\n\nInstall via [Setuptools](http://pypi.python.org/pypi/setuptools).\n\n```sh\npip3 install setuptools\n\npython setup.py install\n```\n(or `sudo python setup.py install` to install the package for all users)\n\n## Usage\nThe library needs to be configured with your account's space id, user id, and secret key which are available in your [wallee\naccount dashboard](https://app-wallee.com/account/select). Set `space_id`, `user_id`, and `api_secret` to their values.\nYou can also optionally set `default_headers` to set some headers that will be sent to all requests\n\n### Configuring a Service\n\n```python\nfrom wallee import Configuration\nfrom wallee.api import TransactionServiceApi, TransactionPaymentPageServiceApi\n\nspace_id = 405\n\n# default_headers is an optional param, that represents headers sent to all requests\nconfig = Configuration(\n    user_id=512,\n    api_secret='FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=',\n    default_headers={'x-meta-custom-header': 'value-1', 'x-meta-custom-header-2': 'value-2'},\n    # set a custom request timeout if needed. (If not set, then the default value is: 25 seconds)\n    request_timeout = 30\n)\n\ntransaction_service = TransactionServiceApi(configuration=config)\ntransaction_payment_page_service = TransactionPaymentPageServiceApi(configuration=config)\n\n```\n\nTo get started with sending transactions, please review the example below:\n\n```python\nfrom wallee import Configuration\nfrom wallee.api import TransactionServiceApi, TransactionPaymentPageServiceApi\nfrom wallee.models import LineItem, LineItemType, TransactionCreate\n\nspace_id = 405\n\nconfig = Configuration(\n    user_id=512,\n    api_secret='FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=',\n    # set a custom request timeout if needed. (If not set, then the default value is: 25 seconds)\n    request_timeout = 30\n)\n\ntransaction_service = TransactionServiceApi(configuration=config)\ntransaction_payment_page_service = TransactionPaymentPageServiceApi(configuration=config)\n\n# create line item\nline_item = LineItem(\n    name='Red T-Shirt',\n    unique_id='5412',\n    sku='red-t-shirt-123',\n    quantity=1,\n    amount_including_tax=29.95,\n    type=LineItemType.PRODUCT\n)\n\n# create transaction model\ntransaction = TransactionCreate(\n    line_items=[line_item],\n    auto_confirmation_enabled=True,\n    currency='EUR',\n)\n\ntransaction_create = transaction_service.create(space_id=space_id, transaction=transaction)\npayment_page_url = transaction_payment_page_service.payment_page_url(space_id=space_id, id=transaction_create.id)\n# redirect your customer to this payment_page_url\n```\n\n### Integrating Webhook Payload Signing Mechanism into webhook callback handler\n\nThe HTTP request which is sent for a state change of an entity now includes an additional field `state`, which provides information about the update of the monitored entity's state. This enhancement is a result of the implementation of our webhook encryption mechanism.\n\nPayload field `state` provides direct information about the state update of the entity, making additional API calls to retrieve the entity state redundant.\n\n#### \u26a0\ufe0f Warning: Generic Pseudocode\n\n> **The provided pseudocode is intentionally generic and serves to illustrate the process of enhancing your API to leverage webhook payload signing. It is not a complete implementation.**\n>\n> Please ensure that you adapt and extend this code to meet the specific needs of your application, including appropriate security measures and error handling.\nFor a detailed webhook payload signing mechanism understanding we highly recommend referring to our comprehensive\n[Webhook Payload Signing Documentation](https://app-wallee.com/doc/webhooks#_webhook_payload_signing_mechanism).\n\n```python\n@app.route('/webhook/callback', methods=['POST'])\ndef handle_webhook():\n    request_payload = request.data.decode('utf-8')\n    signature = request.headers.get('x-signature')\n\n    if not signature:\n        # Make additional API call to retrieve the entity state\n        # ...\n    else:\n        if webhook_encryption_service().is_content_valid(signature_header=signature, content_to_verify=request_payload):\n            # Parse request_payload to extract 'state' value\n            # Process entity's state change\n            # ...\n\n    # Process the received webhook data\n    # ...\n\n```\n\n## License\n\nPlease see the [license file](https://github.com/wallee-payment/python-sdk/blob/master/LICENSE) for more information.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "SDK that allows you to access wallee",
    "version": "5.1.0",
    "project_urls": null,
    "split_keywords": [
        "wallee",
        " payment",
        " payment integration"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c394e6165b0481f40302905b8a10c9a448987601857889a5d71fcf4b926c4ae2",
                "md5": "37caf12cd9b9a6cdceaebd27ad14f9e6",
                "sha256": "0291d1d5373f92cf0c142b252c9e8c0d73819b8dbd3f1edaa3c9856d90ae60be"
            },
            "downloads": -1,
            "filename": "wallee-5.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "37caf12cd9b9a6cdceaebd27ad14f9e6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 344091,
            "upload_time": "2024-04-08T10:13:40",
            "upload_time_iso_8601": "2024-04-08T10:13:40.047654Z",
            "url": "https://files.pythonhosted.org/packages/c3/94/e6165b0481f40302905b8a10c9a448987601857889a5d71fcf4b926c4ae2/wallee-5.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-08 10:13:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "wallee"
}
        
Elapsed time: 0.23515s