skipcash


Nameskipcash JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://codelounge.io
SummaryThe SkipCash SDK for Python enables developers to easily integrate SkipCash payment services into their Python applications.
upload_time2024-01-28 23:13:50
maintainer
docs_urlNone
authorMuhammad Arshad
requires_python
license
keywords skipcash python sdk skipcash skipcash-sdk skipcash-python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# SkipCash SDK for Python

The SkipCash SDK for Python enables developers to easily integrate SkipCash payment services into their Python applications. This SDK provides a convenient way to create and manage payments, handle webhooks, and interact with the SkipCash API.

## Features

- Create payments with various customization options.
- Retrieve payment information using payment IDs.
- Validate and process webhook events securely.
- Handle various exceptions and errors gracefully.

## Getting Started

### Prerequisites

- Python 3.x
- An active SkipCash account with access to API credentials.

### Installation

Currently, this SDK is provided as a Python module. Include it in your project by copying the SDK files to your project directory.

### Configuration

To use the SDK, you'll need your SkipCash API credentials. Initialize the `SkipCash` client with your credentials:

```python
from skipcash.client import SkipCash

skipcash = SkipCash(
    client_id='<your_client_id>',
    key_id='<your_client_key_id>',
    key_secret='<your_client_secret_key>',
    webhook_secret='<your_webhook_secret_key>',
    use_sandbox=True  # Set to False when moving to production
)
```

## Usage

### Creating a Payment

To create a payment, you need to prepare `PaymentInfo` with the necessary details:

```python
from decimal import Decimal
from skipcash.api_resources import Payment
from skipcash.schema import PaymentInfo
from skipcash.exceptions import PaymentResponseError, PaymentValidationError, PaymentInfoError
from skipcash.client import SkipCash

skipcash = SkipCash(
    client_id='<your_client_id>',
    key_id='<your_client_key_id>',
    key_secret='<your_client_secret_key>',
    webhook_secret='<your_webhook_secret_key>',
    use_sandbox=True  # Set to False when moving to production
)
payment_info = PaymentInfo(
    key_id=skipcash.key_id,
    amount=Decimal('100.00'),
    first_name='John',
    last_name='Doe',
    phone='+1234567890',
    email='john.doe@example.com',
    street='123 Main St',
    city='City',
    state='ST',
    country='Country',
    postal_code='00000',
    transaction_id='unique_transaction_id',
    custom_fields={'Custom1': 'value1', 'Custom2': 'value2'}  # Optional
)

payment = Payment(skipcash)

try:
    response = payment.create_payment(payment_info)
    print(f"Payment ID: {response.id}")
    print(f"Payment URL: {response.pay_url}")
except PaymentInfoError as e:
    print(f"Error: {e}")
except PaymentValidationError as e:
    print(f"Validation Error: {e}")
except PaymentResponseError as e:
    print(f"Response Error: {e}")
```

### Retrieving a Payment

To retrieve payment details using a payment ID:

```python
from skipcash.client import SkipCash
from skipcash.exceptions import PaymentRetrievalError, PaymentResponseError
from skipcash.api_resources import Payment

skipcash = SkipCash(
    client_id='<your_client_id>',
    key_id='<your_client_key_id>',
    key_secret='<your_client_secret_key>',
    webhook_secret='<your_webhook_secret_key>',
    use_sandbox=True  # Set to False when moving to production
)
payment = Payment(skipcash)
try:
    response = payment.get_payment('<payment_id>')
    print(f"Payment ID: {response.id}")
    print(f"Payment Status: {response.status}")
except PaymentRetrievalError as e:
    print(f"Retrieval Error: {e}")
except PaymentResponseError as e:
    print(f"Response Error: {e}")
```

### Handling Webhooks

To validate and process webhook events:

```python
from skipcash.client import SkipCash
from skipcash.api_resources import Webhook
from skipcash.exceptions import WebhookValidationError, WebhookSignatureError

request_data = {}  # Your webhook payload here
signature = ''  # Signature from the 'HTTP_AUTHORIZATION' header
skipcash = SkipCash(
    client_id='<your_client_id>',
    key_id='<your_client_key_id>',
    key_secret='<your_client_secret_key>',
    webhook_secret='<your_webhook_secret_key>',
    use_sandbox=True  # Set to False when moving to production
)
webhook = Webhook(client=skipcash)

try:
    webhook.validate(payload=request_data, signature=signature)
    webhook_response = webhook.process_event(request_data)
    print(f"Payment ID: {webhook_response.payment_id}")
    print(f"Payment Status: {webhook_response.status}")
except WebhookValidationError as e:
    print(f"Webhook Validation Error: {e}")
except WebhookSignatureError as e:
    print(f"Webhook Signature Error: {e}")
```

## Error Handling

The SDK raises specific exceptions to help you handle errors gracefully. These exceptions include `PaymentResponseError`, `PaymentValidationError`, `PaymentInfoError`, `PaymentRetrievalError`, `WebhookValidationError`, and `WebhookSignatureError`.


            

Raw data

            {
    "_id": null,
    "home_page": "https://codelounge.io",
    "name": "skipcash",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "SkipCash Python SDK,skipcash,skipcash-sdk,skipcash-python",
    "author": "Muhammad Arshad",
    "author_email": "arshad@codelounge.io",
    "download_url": "https://files.pythonhosted.org/packages/42/39/f86a722ef0d86e718fed71f8be41bc842c7be0046b6b306b9a0ad4b7e07c/skipcash-0.0.3.tar.gz",
    "platform": null,
    "description": "\n# SkipCash SDK for Python\n\nThe SkipCash SDK for Python enables developers to easily integrate SkipCash payment services into their Python applications. This SDK provides a convenient way to create and manage payments, handle webhooks, and interact with the SkipCash API.\n\n## Features\n\n- Create payments with various customization options.\n- Retrieve payment information using payment IDs.\n- Validate and process webhook events securely.\n- Handle various exceptions and errors gracefully.\n\n## Getting Started\n\n### Prerequisites\n\n- Python 3.x\n- An active SkipCash account with access to API credentials.\n\n### Installation\n\nCurrently, this SDK is provided as a Python module. Include it in your project by copying the SDK files to your project directory.\n\n### Configuration\n\nTo use the SDK, you'll need your SkipCash API credentials. Initialize the `SkipCash` client with your credentials:\n\n```python\nfrom skipcash.client import SkipCash\n\nskipcash = SkipCash(\n    client_id='<your_client_id>',\n    key_id='<your_client_key_id>',\n    key_secret='<your_client_secret_key>',\n    webhook_secret='<your_webhook_secret_key>',\n    use_sandbox=True  # Set to False when moving to production\n)\n```\n\n## Usage\n\n### Creating a Payment\n\nTo create a payment, you need to prepare `PaymentInfo` with the necessary details:\n\n```python\nfrom decimal import Decimal\nfrom skipcash.api_resources import Payment\nfrom skipcash.schema import PaymentInfo\nfrom skipcash.exceptions import PaymentResponseError, PaymentValidationError, PaymentInfoError\nfrom skipcash.client import SkipCash\n\nskipcash = SkipCash(\n    client_id='<your_client_id>',\n    key_id='<your_client_key_id>',\n    key_secret='<your_client_secret_key>',\n    webhook_secret='<your_webhook_secret_key>',\n    use_sandbox=True  # Set to False when moving to production\n)\npayment_info = PaymentInfo(\n    key_id=skipcash.key_id,\n    amount=Decimal('100.00'),\n    first_name='John',\n    last_name='Doe',\n    phone='+1234567890',\n    email='john.doe@example.com',\n    street='123 Main St',\n    city='City',\n    state='ST',\n    country='Country',\n    postal_code='00000',\n    transaction_id='unique_transaction_id',\n    custom_fields={'Custom1': 'value1', 'Custom2': 'value2'}  # Optional\n)\n\npayment = Payment(skipcash)\n\ntry:\n    response = payment.create_payment(payment_info)\n    print(f\"Payment ID: {response.id}\")\n    print(f\"Payment URL: {response.pay_url}\")\nexcept PaymentInfoError as e:\n    print(f\"Error: {e}\")\nexcept PaymentValidationError as e:\n    print(f\"Validation Error: {e}\")\nexcept PaymentResponseError as e:\n    print(f\"Response Error: {e}\")\n```\n\n### Retrieving a Payment\n\nTo retrieve payment details using a payment ID:\n\n```python\nfrom skipcash.client import SkipCash\nfrom skipcash.exceptions import PaymentRetrievalError, PaymentResponseError\nfrom skipcash.api_resources import Payment\n\nskipcash = SkipCash(\n    client_id='<your_client_id>',\n    key_id='<your_client_key_id>',\n    key_secret='<your_client_secret_key>',\n    webhook_secret='<your_webhook_secret_key>',\n    use_sandbox=True  # Set to False when moving to production\n)\npayment = Payment(skipcash)\ntry:\n    response = payment.get_payment('<payment_id>')\n    print(f\"Payment ID: {response.id}\")\n    print(f\"Payment Status: {response.status}\")\nexcept PaymentRetrievalError as e:\n    print(f\"Retrieval Error: {e}\")\nexcept PaymentResponseError as e:\n    print(f\"Response Error: {e}\")\n```\n\n### Handling Webhooks\n\nTo validate and process webhook events:\n\n```python\nfrom skipcash.client import SkipCash\nfrom skipcash.api_resources import Webhook\nfrom skipcash.exceptions import WebhookValidationError, WebhookSignatureError\n\nrequest_data = {}  # Your webhook payload here\nsignature = ''  # Signature from the 'HTTP_AUTHORIZATION' header\nskipcash = SkipCash(\n    client_id='<your_client_id>',\n    key_id='<your_client_key_id>',\n    key_secret='<your_client_secret_key>',\n    webhook_secret='<your_webhook_secret_key>',\n    use_sandbox=True  # Set to False when moving to production\n)\nwebhook = Webhook(client=skipcash)\n\ntry:\n    webhook.validate(payload=request_data, signature=signature)\n    webhook_response = webhook.process_event(request_data)\n    print(f\"Payment ID: {webhook_response.payment_id}\")\n    print(f\"Payment Status: {webhook_response.status}\")\nexcept WebhookValidationError as e:\n    print(f\"Webhook Validation Error: {e}\")\nexcept WebhookSignatureError as e:\n    print(f\"Webhook Signature Error: {e}\")\n```\n\n## Error Handling\n\nThe SDK raises specific exceptions to help you handle errors gracefully. These exceptions include `PaymentResponseError`, `PaymentValidationError`, `PaymentInfoError`, `PaymentRetrievalError`, `WebhookValidationError`, and `WebhookSignatureError`.\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "The SkipCash SDK for Python enables developers to easily integrate SkipCash payment services into their Python applications.",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://codelounge.io"
    },
    "split_keywords": [
        "skipcash python sdk",
        "skipcash",
        "skipcash-sdk",
        "skipcash-python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f29b5f043347bb6de04c04f75e95d6440eb91dc1cc0bef334d424af3949ef6a8",
                "md5": "775d458a7ddc20734dfbbd8174f66961",
                "sha256": "4434981cdcb09f786610aaafd45dcec0268b68f8ecb5226ace7b33cb84e02215"
            },
            "downloads": -1,
            "filename": "skipcash-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "775d458a7ddc20734dfbbd8174f66961",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 23116,
            "upload_time": "2024-01-28T23:13:48",
            "upload_time_iso_8601": "2024-01-28T23:13:48.797224Z",
            "url": "https://files.pythonhosted.org/packages/f2/9b/5f043347bb6de04c04f75e95d6440eb91dc1cc0bef334d424af3949ef6a8/skipcash-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4239f86a722ef0d86e718fed71f8be41bc842c7be0046b6b306b9a0ad4b7e07c",
                "md5": "b8b89d36042023a7de758199566536ee",
                "sha256": "c14715a36aefffb8608ea9b0874fc062afc08b9265fd9976e88d0518f76d503f"
            },
            "downloads": -1,
            "filename": "skipcash-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "b8b89d36042023a7de758199566536ee",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17379,
            "upload_time": "2024-01-28T23:13:50",
            "upload_time_iso_8601": "2024-01-28T23:13:50.409922Z",
            "url": "https://files.pythonhosted.org/packages/42/39/f86a722ef0d86e718fed71f8be41bc842c7be0046b6b306b9a0ad4b7e07c/skipcash-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-28 23:13:50",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "skipcash"
}
        
Elapsed time: 0.34395s