pallapay-python-sdk


Namepallapay-python-sdk JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/pallapay/pallapay-python-sdk
SummaryPallapay Python SDK to accept crypto currency payments.
upload_time2024-09-07 09:18:46
maintainerNone
docs_urlNone
authorPallapay
requires_python>=3.6
licenseMIT
keywords pallapay bitcoin crypto payment gateway client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Pallapay crypto payment gateway SDK

Easy to use SDK for pallapay crypto payment gateway, accept crypto in your website and get paid in cash.


#### Installation
```
pip install pallapay-python-sdk
```

#### Easy to use

First signup and [create your API Key in pallapay website](https://www.pallapay.com)

Then you can create a payment link:

```python
from pallapay.client import PallapayClient

api_key = "TEST_API_KEY"
secret_key = "TEST_API_KEY"

# Create payment link
pallapay_client = PallapayClient(apiKey=api_key, secret_key=secret_key)
created_payment = pallapay_client.create_payment(
    symbol="AED",
    amount="10",
    ipn_success_url="https://my_website.com/payment/success",
    ipn_failed_url="https://my_website.com/payment/failed",
    payer_email_address="johndoe@gmail.com",
    webhook_url="https://my_website.com/webhook",  # Optional
    payer_first_name="John",  # Optional
    payer_last_name="Doe",  # Optional
    note="YOUR CUSTOM NOTE",  # Optional
    order_id="YOUR_UNIQUE_ORDER_ID",  # Optional
)

print(created_payment.payment_link)
# Now you can redirect user to payment_link.
```

#### Handle Webhook

After user payment was done, we will call your WEBHOOK_URL. then you can validate the request and check if transaction was paid. 

```python
from pallapay.client import PallapayClient

def handle_webhook(request_body: dict):
    # Checking webhook request that pallapay will send to your WEBHOOK_URL

    api_key = "TEST_API_KEY"
    secret_key = "TEST_API_KEY"

    pallapay_client = PallapayClient(apiKey=api_key, secret_key=secret_key)
    webhook_data = pallapay_client.get_webhook_data(request_body=request_body)
    
    is_valid_webhook: bool = pallapay_client.is_valid_webhook_data(webhook_data=webhook_data)
    if is_valid_webhook:
        raise Exception("Invalid webhook data")
    
    is_paid = pallapay_client.is_paid_webhook_data(webhook_data=webhook_data)
    
    if is_paid:
        print('Successful Payment')
    else:
        print('Failed Payment')
```


#### Contribution

Contributions are highly appreciated either in the form of pull requests for new features, bug fixes or just bug reports.

----------------------------------------------

[Pallapay Website](https://www.pallapay.com)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pallapay/pallapay-python-sdk",
    "name": "pallapay-python-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "pallapay bitcoin crypto payment gateway client",
    "author": "Pallapay",
    "author_email": "info@pallapay.com",
    "download_url": "https://files.pythonhosted.org/packages/da/d4/b029108c1b8a85cdcc9d6644ef2845987a2311cb4ea66f86fa4810524943/pallapay_python_sdk-1.0.0.tar.gz",
    "platform": null,
    "description": "## Pallapay crypto payment gateway SDK\n\nEasy to use SDK for pallapay crypto payment gateway, accept crypto in your website and get paid in cash.\n\n\n#### Installation\n```\npip install pallapay-python-sdk\n```\n\n#### Easy to use\n\nFirst signup and [create your API Key in pallapay website](https://www.pallapay.com)\n\nThen you can create a payment link:\n\n```python\nfrom pallapay.client import PallapayClient\n\napi_key = \"TEST_API_KEY\"\nsecret_key = \"TEST_API_KEY\"\n\n# Create payment link\npallapay_client = PallapayClient(apiKey=api_key, secret_key=secret_key)\ncreated_payment = pallapay_client.create_payment(\n    symbol=\"AED\",\n    amount=\"10\",\n    ipn_success_url=\"https://my_website.com/payment/success\",\n    ipn_failed_url=\"https://my_website.com/payment/failed\",\n    payer_email_address=\"johndoe@gmail.com\",\n    webhook_url=\"https://my_website.com/webhook\",  # Optional\n    payer_first_name=\"John\",  # Optional\n    payer_last_name=\"Doe\",  # Optional\n    note=\"YOUR CUSTOM NOTE\",  # Optional\n    order_id=\"YOUR_UNIQUE_ORDER_ID\",  # Optional\n)\n\nprint(created_payment.payment_link)\n# Now you can redirect user to payment_link.\n```\n\n#### Handle Webhook\n\nAfter user payment was done, we will call your WEBHOOK_URL. then you can validate the request and check if transaction was paid. \n\n```python\nfrom pallapay.client import PallapayClient\n\ndef handle_webhook(request_body: dict):\n    # Checking webhook request that pallapay will send to your WEBHOOK_URL\n\n    api_key = \"TEST_API_KEY\"\n    secret_key = \"TEST_API_KEY\"\n\n    pallapay_client = PallapayClient(apiKey=api_key, secret_key=secret_key)\n    webhook_data = pallapay_client.get_webhook_data(request_body=request_body)\n    \n    is_valid_webhook: bool = pallapay_client.is_valid_webhook_data(webhook_data=webhook_data)\n    if is_valid_webhook:\n        raise Exception(\"Invalid webhook data\")\n    \n    is_paid = pallapay_client.is_paid_webhook_data(webhook_data=webhook_data)\n    \n    if is_paid:\n        print('Successful Payment')\n    else:\n        print('Failed Payment')\n```\n\n\n#### Contribution\n\nContributions are highly appreciated either in the form of pull requests for new features, bug fixes or just bug reports.\n\n----------------------------------------------\n\n[Pallapay Website](https://www.pallapay.com)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Pallapay Python SDK to accept crypto currency payments.",
    "version": "1.0.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/pallapay/pallapay-python-sdk/issues",
        "Documentation": "https://github.com/pallapay/pallapay-python-sdk",
        "Homepage": "https://github.com/pallapay/pallapay-python-sdk",
        "repository": "https://github.com/pallapay/pallapay-python-sdk"
    },
    "split_keywords": [
        "pallapay",
        "bitcoin",
        "crypto",
        "payment",
        "gateway",
        "client"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4af37a373ca6ac597948082b18ced3e3ab875cc442223e5651b850e34256c315",
                "md5": "262ce4b2b2efcc32c65589cbaad5e466",
                "sha256": "a54d2cb1e8bc9e264b3b1d578aafdab24f4f6781fa831ee1e3fe622f5ea65432"
            },
            "downloads": -1,
            "filename": "pallapay_python_sdk-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "262ce4b2b2efcc32c65589cbaad5e466",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6893,
            "upload_time": "2024-09-07T09:18:44",
            "upload_time_iso_8601": "2024-09-07T09:18:44.278859Z",
            "url": "https://files.pythonhosted.org/packages/4a/f3/7a373ca6ac597948082b18ced3e3ab875cc442223e5651b850e34256c315/pallapay_python_sdk-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dad4b029108c1b8a85cdcc9d6644ef2845987a2311cb4ea66f86fa4810524943",
                "md5": "ddd284f2a793cfcd0072fa8ee4939c0c",
                "sha256": "34b218558d732f4d54c3d20e75c4bde2adad4ab6405ba93dd56e01d9ce1b81f3"
            },
            "downloads": -1,
            "filename": "pallapay_python_sdk-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ddd284f2a793cfcd0072fa8ee4939c0c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 7111,
            "upload_time": "2024-09-07T09:18:46",
            "upload_time_iso_8601": "2024-09-07T09:18:46.169995Z",
            "url": "https://files.pythonhosted.org/packages/da/d4/b029108c1b8a85cdcc9d6644ef2845987a2311cb4ea66f86fa4810524943/pallapay_python_sdk-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-07 09:18:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pallapay",
    "github_project": "pallapay-python-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pallapay-python-sdk"
}
        
Elapsed time: 0.32751s