{"id":22151434,"url":"https://github.com/chainside/webpos-sdk-python","last_synced_at":"2025-03-24T13:21:56.453Z","repository":{"id":62561627,"uuid":"171940728","full_name":"chainside/webpos-sdk-python","owner":"chainside","description":null,"archived":false,"fork":false,"pushed_at":"2020-09-16T16:13:36.000Z","size":146,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-01T00:45:32.002Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chainside.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-21T20:31:43.000Z","updated_at":"2020-08-26T09:30:11.000Z","dependencies_parsed_at":"2022-11-03T15:15:31.194Z","dependency_job_id":null,"html_url":"https://github.com/chainside/webpos-sdk-python","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainside%2Fwebpos-sdk-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainside%2Fwebpos-sdk-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainside%2Fwebpos-sdk-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainside%2Fwebpos-sdk-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chainside","download_url":"https://codeload.github.com/chainside/webpos-sdk-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245276110,"owners_count":20588895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-02T00:33:08.551Z","updated_at":"2025-03-24T13:21:56.419Z","avatar_url":"https://github.com/chainside.png","language":"Python","readme":"\u003c!--\nNigiri auto-generated file\n--\u003e\n\u003cp\u003e\n\u003cimg src=\"https://www.chainside.net/wp-content/themes/chainside2018/assets/favicon//favicon-192.png\" alt=\"chainside\" width=\"80\"\u003e\n\u003cbr \\\u003e\u003cbr \\\u003e\ndeveloped with :heart: by \u003ca href=\"https://www.chainside.net\"\u003echainside\u003c/a\u003e\n\u003c/p\u003e\n\n\n\u003c!-- START doctoc --\u003e\n\u003c!-- END doctoc  --\u003e\n\n# Introduction\n\nThis project is the **official** SDK library for the integration with the [Chainside Pay]() Platform.\nIt is an extension of the [Sdk-boilerplate]() library.\n \n# Installation\n\nFollow these steps to install the SDK library into your system:\n\n```bash\npip install chainside-webpos-sdk \n```\n\nIn order to configure the redis cache backend, you must install the redis server and the python\nclient. (For further information, check the https://redis.io/ documentation)\n\nInstalling redis server:\n\nApt:\n\n```bash\napt install redis-server\n```\nBrew:\n\n```bash\nbrew install redis\n```\n\nThen, to install the python client\n```bash\npip install redis\n```\n\n# Structure\n\nThe following sections will describe the high level structure of the\nSDK library.\n\n## Configuration\n\nIn order to be able to configure your SDK client you have to set some\nconfiguration parameters. Here is the list of the configuration parameters\nused by the library:\n\n| Parameter | Type | Required | Default | Description |\n|-----------|------|----------|---------|-------------|\n| **mode** | _string_ | Yes | `live` | The SDK mode, can be `sandbox` or `live` |\n| **client_id** | _string_ | Yes | `null` | Your WebPos client id |\n| **secret** | _string_ | Yes | `null` | Your WebPos secret |\n| **http** |  |  | Http further configuration |\n \n_http_ is a further configuration for the actual sending of requests. It can be configured\n by specifying the following parameters (if not specified, a default is provided)\n \n| Parameter | Type | Required | Default | Description |\n|-----------|------|----------|---------|-------------|\n| **verify_ssl** | _string_ | No | true | Wheter to perform ssl verification  |\n| **timeout** | _integer_ | No | 10 | Timeout on sent requests (seconds) |\n\nA cache adapter can be configured aswell (if not, a default cache adapter is provided from the sdk).\nThe configuration must define the following parameters:\n\n| Parameter | Type | Required | Default | Description |\n|-----------|------|----------|---------|-------------|\n| **driver** | _string_ | No | `dict` | The cache driver to be used |\n| **options** | _dict_ | No | `null` | Cache driver further configuration |\n\nDriver can be either 'redis', 'django' or the default 'dict'.\nIf redis is configured as a driver, the options configuration parameters are the following:\n\n| Parameter | Type | Required | Default | Description |\n|-----------|------|----------|---------|-------------|\n| **hostname** | _string_ | No | localhost | Hostname of the redis server |\n| **port** | _integer_ | No | 6379 | Port of the redis server |\n| **password** | _string_ | No | `null` | Password to connect to the redis server |\n| **decode_responses** | _boolean_ | No | True | Wheter to return byte or decoded responses |\n\nFor django or dict cache adapters, no further configuration is needed.\nIf django is selected, the adapter wraps the django.core.cache cache singleton\nIf dict is selected, (or the cache driver is not specified ), the sdk instantiates a DictCacheAdapter\nobject which is a singleton in the application and uses a dictionary to store values.\n\n\n## Client\n\nThe Library exposes a _client_ object which is instantiated with the system configuration and\nprovides an high-level interface to send requests. Client's instances take care of compiling and\nsending http request and parse responses into [SdkObject](#Objects) instances. \n\n## Objects\n\nThe library defines an SdkObject class which is extended by actual objects which represent Chainside-Pay\nAPI requests and response bodies. Every json object defined in the API has a corresponding SdkObject\nclass which is either the input of a _client_ instance method (for creation) or returned (for reading)\n\n## Callbacks\n\nCallbacks are requests sent by the server to your application in order to notify about some events. \nEvery callback is sent **only to HTTPS** webhooks and will be securely signed by the server in order to be verified.\n\n# Usage\n\nThe following sections will describe how to use the SDK library and\nall the detail needed to integrate your business with Chainside Pay.\n\n## Instantiate and use the client\n\nIn order to communicate with our backend first you need to instantiate\nthe client:\n\n```python\nfrom webpos_sdk.client import Client\nfrom webpos_sdk.objects import PaymentOrder\nconf = {\n        'mode' : 'live',\n        'client_id' : '${webpos_client_id}',\n        'secret' : '${webpos_secret}',\n        ...\n        }\nclient = Client(conf)\npayment_order = PaymentOrder(\n                                amount='10.00',\n                                continue_url='https://continue.com',\n                                ...\n                            )\nresponse = client.create_payment_order(payment_order)                            \n```\n\n\nOnce the client is instantiated and configured, you can use the following\nmethods to send requests:\n\n\n| Method |\n|--------|\n| `delete_payment_order`(payment_order_uuid:uuid) : [PaymentOrderResponse](#PaymentOrderResponse)| \n| `get_payment_order`(payment_order_uuid:uuid) : [PaymentOrderRetrieval](#PaymentOrderRetrieval)| \n| `get_payment_orders`(status:string=None,page:integer=None,sort_order:string=None,page_size:integer=None,sort_by:string=None) : [PaymentOrderList](#PaymentOrderList)| \n| `create_payment_order`(payment_order:PaymentOrder) : [PaymentOrderResponse](#PaymentOrderResponse)| \n| `client_credentials_login`(client_credentials:ClientCredentials) : [ClientCredentialsLoginResponse](#ClientCredentialsLoginResponse)| \n| `get_callbacks`(payment_order_uuid:uuid) : [CallbackList](#CallbackList)| \n| `payment_reset`(payment_order_uuid:uuid) : [PaymentOrderRetrieval](#PaymentOrderRetrieval)| \n| `payment_update`(payment_order_uuid:uuid,payment_update_object:PaymentUpdateObject) : [None](#None)| \n\n\n\n## Objects\n\n### PaymentOrderDeletionResponse\n\nPayment order deletion response\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| cancel_url | _string_ | Yes | The URL where the user is redirected upon payment order expiration/cancellation |\n\n\n### PaymentOrderRetrieval\n\nPayment order retrieval data\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| expires_in | _integer_ | Yes |  Expiration time of the payment order |\n| btc_amount | _integer_ | Yes |  Bitcoin amount of the payment order |\n| resolved_at | _string_ | Yes | Time at which either the payment order has been fully paid or is expired |\n| state | _[PaymentOrderState](#paymentorderstate)_ | Yes | Current payment state of the payment order |\n| required_confirmations | _integer_ | Yes | Required confirmations for transactions paying the payment order |\n| transactions | _[[Transaction](#Transaction)]_ | Yes | Transactions paying the payment order |\n| address | _string_ | Yes | Bitcoin address of the payment order |\n| redirect_url | _string_ | No | URL where to redirect the user to perform the payment |\n| rate | _[RateRetrieval](#rateretrieval)_ | Yes | Crypto/Fiat rate of the payment order |\n| chargeback_date | _string_ | Yes | Time at which either the payment order has been fully paid or is expired |\n| created_at | _string_ | Yes | Creation date of the payment order |\n| expiration_time | _string_ | Yes | Expiration date of the payment order |\n| currency | _[CurrencyRetrieval](#currencyretrieval)_ | Yes | Fiat currency of the payment order |\n| amount | _string_ | Yes | Fiat's amount of the payment order |\n| created_by | _[PaymentOrderCreator](#paymentordercreator)_ | Yes | Data of the pos which created the payment order |\n| details | _string_ | No | Payment order's details |\n| uuid | _string_ | Yes | UUID of the payment order |\n| uri | _string_ | Yes | Bitcoin uri |\n| callback_url | _string_ | No | The URL contacted to send callbacks related to payment status changes |\n| dispute_start_date | _string_ | Yes | Time at which either the payment order has been fully paid or is expired |\n| reference | _string_ | Yes | Business' reference for the payment order |\n\n\n### PaymentOrderState\n\nData describing the current state of a payment order\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| paid | _[PaidStatus](#paidstatus)_ | Yes | Payment order's paid amount |\n| in_confirmation | _[PaidStatus](#paidstatus)_ | Yes | Payment order's paid but unconfirmed amount |\n| unpaid | _[PaidStatus](#paidstatus)_ | Yes | Payment order's unpaid amount |\n| blockchain_status | _string_ | Yes | Payment order's internal status |\n| status | _string_ | Yes | Payment order's status |\n\n\n### PaidStatus\n\nCryto and fiat paid amounts\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| crypto | _integer_ | Yes | Cryto Amount |\n| fiat | _string_ | Yes | Fiat Amount |\n\n\n### Transaction\n\nBitcoin transaction paying a payment order\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| txid | _string_ | Yes | Transaction's id |\n| normalized_txid | _string_ | Yes | Transaction's normalized id (DEPRECATED) |\n| blockchain_status | _string_ | Yes | Transaction's internal status |\n| outs_sum | _integer_ | Yes | Paying amount of the transaction |\n| status | _string_ | Yes | Transaction's status |\n| created_at | _string_ | Yes |  |\n| outs | _[[Out](#Out)]_ | Yes | Transaction's outputs |\n\n\n### Out\n\nTransaction's output\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| n | _integer_ | Yes | Transaction output's index |\n| amount | _integer_ | Yes | Output's amount |\n\n\n### RateRetrieval\n\nRate Data\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| from | _string_ | No | Starting currency for rate calculation |\n| to | _string_ | No | Target currency for rate calculation |\n| source | _string_ | Yes | Exchange providing the rate |\n| value | _string_ | Yes | Value of the rate |\n| created_at | _string_ | Yes | Creation's date of the rate |\n\n\n### CurrencyRetrieval\n\nCurrency Data\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| type | _string_ | Yes | Currency's type (fiat/crypto) |\n| uuid | _string_ | Yes | UUID of the currency |\n| name | _string_ | Yes | Name of the currency |\n\n\n### PaymentOrderCreator\n\nData of payment order's creator\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| type | _string_ | Yes | Payment order creator's type |\n| active | _bool_ | No | Wheter the creator active |\n| uuid | _string_ | Yes | Payment order creator's uuid |\n| name | _string_ | Yes | Payment order creator's name |\n| deposit_account | _[DepositAccountLite](#depositaccountlite)_ | Yes | Deposit account associated to the payment order's creator |\n\n\n### DepositAccountLite\n\nDeposit account lite object when sent nested in other api objects\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| type | _string_ | Yes | Deposit account's type |\n| uuid | _string_ | Yes | Deposit account's uuid |\n| name | _string_ | Yes | Deposit account's name |\n\n\n### PaymentOrderList\n\nList of Business' payment orders\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| total_pages | _integer_ | Yes | Total number of pages given the requested page size |\n| paymentorders | _[[PaymentOrderRetrieval](#PaymentOrderRetrieval)]_ | Yes | Business' payment orders |\n| total_items | _integer_ | Yes | Total number of items |\n\n\n### PaymentOrderCreation\n\nData required to create a new payment order\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| continue_url | _string_ | No | The URL where the user is redirected upon successful payment |\n| callback_url | _string_ | No | The URL contacted to send callbacks related to payment status changes |\n| details | _string_ | No | Payment order's details |\n| amount | _string_ | Yes | Payment order's fiat amount |\n| required_confirmations | _integer_ | No | Required confirmations for transactions paying the payment order |\n| reference | _string_ | No | Business' reference of the payment order |\n| cancel_url | _string_ | No | The URL where the user is redirected upon successful payment order expiration/cancellation |\n\n\n### PaymentOrderCreationResponse\n\nResponse data for a payment order creation request\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| expiration_time | _string_ | Yes | Expiration's date of the payment order |\n| expires_in | _integer_ | Yes | Expiration's time of the payment order |\n| uuid | _string_ | Yes | UUID of the payment order |\n| address | _string_ | Yes | Bitcoin address of the payment order |\n| uri | _string_ | Yes | Bitcoin uri according to BIP 21 (https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki) |\n| redirect_url | _string_ | Yes | URL where to redirect the user to perform the payment |\n| rate | _[RateRetrieval](#rateretrieval)_ | Yes | Crypto/Fiat rate of the payment order |\n| amount | _integer_ | Yes | Crypto amount of the payment order |\n| created_at | _string_ | No | Creation date of the payment order |\n| reference | _string_ | No | Payment Order reference |\n\n\n### ClientCredentials\n\nData required to perform a confidential client login\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| scope | _string_ | Yes | Oauth2 scope of the client's authorization |\n| grant_type | _string_ | Yes | Oauth2 Authorization's grant type |\n\n\n### ClientCredentialsLoginResponse\n\nResponse data for a login performed by a confidential client.\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| id_token | _string_ | Yes | Jwt Token containing identity's informations |\n| expires_in | _integer_ | Yes | Token's expiration time |\n| access_token | _string_ | Yes | User's access token |\n| scope | _string_ | No | Authorization's scope |\n| token_type | _string_ | Yes | Token's type |\n\n\n### CallbackList\n\nCallback list object\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| callbacks | _[[Callback](#Callback)]_ | Yes | Valid payment transitions callbacks |\n\n\n### Callback\n\nCallback Retrieval object\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| name | _string_ | Yes | Namespace of a callback sent after the related payment status' transition |\n\n\n### PaymentUpdateObject\n\nCallback's trigger request body\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| callback | _string_ | Yes | Name of the callback to be sent |\n\n\n### CallbackPaymentOrder\n\nPayment order retrieval data\n\n#### Attributes\n\n| Attribute | Type | Required | Description |\n|-----------|------|----------|-------------|\n| expires_in | _integer_ | Yes |  Expiration time of the payment order |\n| btc_amount | _integer_ | Yes |  Bitcoin amount of the payment order |\n| resolved_at | _string_ | Yes | Time at which either the payment order has been fully paid or is expired |\n| state | _[PaymentOrderState](#paymentorderstate)_ | Yes | Current payment state of the payment order |\n| required_confirmations | _integer_ | Yes | Required confirmations for transactions paying the payment order |\n| cancel_url | _string_ | Yes | The URL where the user is redirected upon payment order expiration/cancellation |\n| address | _string_ | Yes | Bitcoin address of the payment order |\n| redirect_url | _string_ | Yes | URL where to redirect the user to perform the payment |\n| transactions | _[[Transaction](#Transaction)]_ | Yes | Transactions paying the payment order |\n| chargeback_date | _string_ | Yes | Time at which either the payment order has been fully paid or is expired |\n| created_at | _string_ | Yes | Creation date of the payment order |\n| expiration_time | _string_ | Yes | Expiration date of the payment order |\n| rate | _[RateRetrieval](#rateretrieval)_ | Yes | Crypto/Fiat rate of the payment order |\n| details | _string_ | Yes | Payment order's details |\n| currency | _[CurrencyRetrieval](#currencyretrieval)_ | Yes | Fiat currency of the payment order |\n| amount | _string_ | Yes | Fiat's amount of the payment order |\n| created_by | _[PaymentOrderCreator](#paymentordercreator)_ | Yes | Data of the pos which created the payment order |\n| continue_url | _string_ | Yes | The URL where the user is redirected upon successful payment |\n| uuid | _string_ | Yes | UUID of the payment order |\n| uri | _string_ | Yes | Bitcoin uri |\n| callback_url | _string_ | Yes | The URL contacted to send callbacks related to payment status changes |\n| dispute_start_date | _string_ | Yes | Time at which either the payment order has been fully paid or is expired |\n| reference | _string_ | Yes | Business' reference for the payment order |\n\n\n\n\n## Exceptions\n\nEvery exception raised due to an error response contains debug informations.\n\n```python\nfrom webpos_sdk.exceptions import SdkHttpException\n\ntry:\n    client.create_payment_order(payment)\nexcept SdkHttpException as e:\n    print(e.debug_info)\n    print(e.request_id)\n\n```\n\nDebug Info contains general information about request and response headers, body and status code. \nRequest Id is an internal id which can be communicated to chainside in order to help debugging the problem in case this cannot be identified.\n\n## Callbacks\n\nChainside will send callbacks if some event is triggered regarding one of your assets registered on the Business Panel.\nOur server will send a request to your webhooks that you need to parse and verify. You can do this using this SDK library\nin the following way:\n\n```python\nfrom webpos_sdk.callbacks.handler import ChainsideCallbacksHandler\nfrom webpos_sdk.api_context import ChainsideApiContext\n\nconf = {\n        'mode' : 'live',\n        'client_id' : '${webpos_client_id}',\n        'secret' : '${webpos_secret}',\n        ...\n        }\ncontext = ChainsideApiContext(conf)\nhandler = ChainsideCallbacksHandler(context)\ncallback_sdk_object = handler.parse(request.headers, request.body) \n# The request body should be the raw body ( in bytes ) of the request since it's used to compute the signature\n```\n\n### Callback structure\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| event | _string_ | Yes | Event which triggered the callback |\n| created_at | _string_ | Yes | Date in which the callback was sent |\n| object_type | _string_ | Yes | Type of the object sent in the callback |\n| object | [CallbackPaymentOrder](#callbackpaymentorder) | Yes |  |\n\n\n### Triggered events\n\n| Event | Object Class |\n|------------|--------------|\n| `payment.completed` | [CallbackPaymentOrder](#callbackpaymentorder) |\n| `payment.dispute.start` | [CallbackPaymentOrder](#callbackpaymentorder) |\n| `payment.overpaid` | [CallbackPaymentOrder](#callbackpaymentorder) |\n| `payment.cancelled` | [CallbackPaymentOrder](#callbackpaymentorder) |\n| `payment.dispute.end` | [CallbackPaymentOrder](#callbackpaymentorder) |\n| `payment.expired` | [CallbackPaymentOrder](#callbackpaymentorder) |\n| `payment.chargeback` | [CallbackPaymentOrder](#callbackpaymentorder) |\n\n\n# Contributing\n\nIn order to maintain consistency between our backend and our SDKs, contributing through pull requests is highly\ndiscouraged. Consider posting an issue if you need to signal any problem with this library.\n\n# Security Issues\n\nIn case of a discovery of an actual or potential security issue please contact us at [info@chainside.net](mailto:info@chaniside.net)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainside%2Fwebpos-sdk-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchainside%2Fwebpos-sdk-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainside%2Fwebpos-sdk-python/lists"}