From c141dac54e7b41b38bf92b365717fc00e4f829cf Mon Sep 17 00:00:00 2001 From: Alpha Olomi <10551599+alphaolomi@users.noreply.github.com> Date: Sat, 21 Nov 2026 14:23:20 +0300 Subject: [PATCH 1/2] Add Python client page and finish Laravel quickstart --- app/layout.jsx | 2 +- components/landing/hero.jsx | 3 +- components/landing/index.jsx | 1 + components/landing/same-spec.jsx | 10 +++ components/site/code.jsx | 2 +- content/clients/_meta.js | 1 + content/clients/index.mdx | 1 + content/clients/laravel.mdx | 4 +- content/clients/python.mdx | 81 +++++++++++++++++++ content/community/contributing.mdx | 1 + content/getting-started/choosing-a-client.mdx | 1 + content/getting-started/index.mdx | 2 +- content/index.mdx | 2 +- content/spec/client-requirements.mdx | 4 +- 14 files changed, 106 insertions(+), 9 deletions(-) create mode 100644 content/clients/python.mdx diff --git a/app/layout.jsx b/app/layout.jsx index 1525afc..b90451a 100644 --- a/app/layout.jsx +++ b/app/layout.jsx @@ -45,7 +45,7 @@ export const metadata = { template: '%s | Selcom Developers' }, description: - 'Open-source community clients for the Selcom payment API in Java, Node.js, PHP and Laravel. Not affiliated with Selcom Paytech Ltd.' + 'Open-source community clients for the Selcom payment API in Java, Node.js, Python, PHP and Laravel. Not affiliated with Selcom Paytech Ltd.' } const navbar = ( diff --git a/components/landing/hero.jsx b/components/landing/hero.jsx index 72c8822..5da4812 100644 --- a/components/landing/hero.jsx +++ b/components/landing/hero.jsx @@ -6,6 +6,7 @@ import { Stamp } from './stamp' const clients = [ { href: '/clients/java', label: 'Java' }, { href: '/clients/node', label: 'Node.js' }, + { href: '/clients/python', label: 'Python' }, { href: '/clients/php', label: 'PHP' }, { href: '/clients/laravel', label: 'Laravel' } ] @@ -65,7 +66,7 @@ export function Hero() { Call the Selcom API without paying anyone twice.

- Open-source clients for Java, Node.js, PHP and Laravel, built from one shared spec. Every + Open-source clients for Java, Node.js, Python, PHP and Laravel, built from one shared spec. Every request is signed, every outcome has a typed status, and no payment is ever retried behind your back.

diff --git a/components/landing/index.jsx b/components/landing/index.jsx index 82bd031..8519b49 100644 --- a/components/landing/index.jsx +++ b/components/landing/index.jsx @@ -23,6 +23,7 @@ const installs = [ ` }, { value: 'node', label: 'Node.js', registry: 'npm', runtime: 'Node 20 or later', href: '/clients/node', lang: 'bash', code: 'npm i @selcom-developers/selcom' }, + { value: 'python', label: 'Python', registry: 'PyPI', runtime: 'Python 3.10 or later', href: '/clients/python', lang: 'bash', code: 'pip install selcompy' }, { value: 'php', label: 'PHP', registry: 'Packagist', runtime: 'PHP 8.2 or later', href: '/clients/php', lang: 'bash', code: 'composer require selcom-developers/selcom-php' }, { value: 'laravel', diff --git a/components/landing/same-spec.jsx b/components/landing/same-spec.jsx index 9bea8db..31baa11 100644 --- a/components/landing/same-spec.jsx +++ b/components/landing/same-spec.jsx @@ -21,6 +21,16 @@ if (status.status() == Status.SUCCESS) { /* fulfil */ }` code: `const status = await selcom.orderStatus({ orderId: "ORD-1001" }); if (status.status === "SUCCESS") { /* fulfil */ }` }, + { + name: 'Python', + href: '/clients/python', + runtime: 'Python 3.10 or later', + pkg: 'selcompy', + lang: 'python', + code: `status = client.order_status("ORD-1001") +if status.status is Status.SUCCESS: + ... # fulfil` + }, { name: 'PHP', href: '/clients/php', diff --git a/components/site/code.jsx b/components/site/code.jsx index 8443b2c..f82a8f2 100644 --- a/components/site/code.jsx +++ b/components/site/code.jsx @@ -7,7 +7,7 @@ let highlighter function getHighlighter() { highlighter ??= createHighlighter({ themes: [lightTheme, darkTheme], - langs: ['js', 'ts', 'java', 'php', 'xml', 'bash', 'http'] + langs: ['js', 'ts', 'java', 'php', 'python', 'xml', 'bash', 'http'] }) return highlighter } diff --git a/content/clients/_meta.js b/content/clients/_meta.js index 7d31918..d94c2e4 100644 --- a/content/clients/_meta.js +++ b/content/clients/_meta.js @@ -2,6 +2,7 @@ export default { index: 'Overview', java: 'Java', node: 'Node.js', + python: 'Python', php: 'PHP', laravel: 'Laravel' } diff --git a/content/clients/index.mdx b/content/clients/index.mdx index 765d049..280a273 100644 --- a/content/clients/index.mdx +++ b/content/clients/index.mdx @@ -10,6 +10,7 @@ The community clients follow the same [spec](/spec), so they sign requests and r Java 17 or later. One runtime dependency: Jackson databind. TypeScript and JavaScript on Node 20 or later. No runtime dependencies. + Python 3.10 or later. Sync and async clients on httpx. PHP 8.2 or later, any framework. PSR-18 HTTP. Laravel 12 or 13, built on the PHP client. diff --git a/content/clients/laravel.mdx b/content/clients/laravel.mdx index 856b61b..f75326e 100644 --- a/content/clients/laravel.mdx +++ b/content/clients/laravel.mdx @@ -33,8 +33,6 @@ SELCOM_VENDOR=... # the vendor (till) ID SELCOM_PIN=... # float PIN: payout operations only ``` -{/* TODO(laravel-quickstart): re-check this quickstart against the laravel-selcom main README once v1 is merged. */} - ## Quickstart The `Selcom` facade proxies the PHP client, so every operation of the [PHP client](/clients/php) is available. @@ -62,6 +60,8 @@ match ($result->status) { $status = Selcom::orderStatus(new OrderStatusRequest('ORD-1001')); ``` +You can also type-hint `SelcomDevelopers\Selcom\Client` and let the container inject it. + The [README](https://github.com/selcom-developers/laravel-selcom#readme) covers the container bindings, the webhook route, events, models, artisan commands and testing. ## How it behaves diff --git a/content/clients/python.mdx b/content/clients/python.mdx new file mode 100644 index 0000000..9b89e2b --- /dev/null +++ b/content/clients/python.mdx @@ -0,0 +1,81 @@ +--- +title: Python client +description: The community Python client for the Selcom payment API, with a synchronous and an asynchronous client on httpx. Python 3.10 or later. +--- + +# Python client + +Request signing, checkout, payouts and webhooks for Python 3.10 or later. A synchronous `Client` and an asynchronous `AsyncClient` share the same operations, built on [httpx](https://www.python-httpx.org/), the only runtime dependency. + +Repository: [selcom-developers/selcompy](https://github.com/selcom-developers/selcompy) + +## Install + +```bash +pip install selcompy +``` + +## Quickstart + +Pay a utility bill from your float account and act on the typed status. + +```python +from selcompy import ( + Client, + Config, + Credentials, + Environment, + Status, + UtilityPaymentRequest, +) + +config = Config( + environment=Environment.SANDBOX, # no default: you always choose + credentials=Credentials( + api_key="...", + api_secret="...", + vendor="TILL123", + pin="...", + ), +) + +with Client(config) as client: + result = client.utility_payment( + UtilityPaymentRequest( + transid="PAYOUT-1001", # your own deterministic ID + utilitycode="LUKU", + utilityref="54100000001", + amount=5000, # whole TZS + ) + ) + if result.status is Status.SUCCESS: + print(result.value.receipt) +``` + +The asynchronous client has the same operations, and every method is a coroutine: + +```python +from selcompy import AsyncClient + +async with AsyncClient(config) as client: + result = await client.order_status("ORD-1001") +``` + +The environment is required and has no default. Every operation returns a `Result` with one of the typed statuses: `SUCCESS`, `PENDING`, `AMBIGUOUS`, `FAILED` or `NOT_FOUND`. + +The [README](https://github.com/selcom-developers/selcompy#readme) covers configuration, every operation, results and errors, idempotency, replacing the transport, webhooks and security. + +## How it behaves + +The client follows the [shared spec](/spec). These pages explain what it does: + + + How every request is signed, with worked examples. + The typed statuses, idempotency and when to query. + Verify a delivery, then confirm it with order status. + What every client does, in every language. + + +## Help and issues + +Found a problem, or want to help? Open an issue in the [repository](https://github.com/selcom-developers/selcompy/issues), or read [Contributing](/community/contributing). For security problems, see [Security reporting](/community/security). diff --git a/content/community/contributing.mdx b/content/community/contributing.mdx index 7e7b91c..18c45a6 100644 --- a/content/community/contributing.mdx +++ b/content/community/contributing.mdx @@ -14,6 +14,7 @@ Thank you for helping. These projects are run by the community, and every fix co | Rules, test vectors, API notes | [selcom-spec](https://github.com/selcom-developers/selcom-spec) | | Java client | [selcom4j](https://github.com/selcom-developers/selcom4j) | | Node.js client | [selcom-node](https://github.com/selcom-developers/selcom-node) | +| Python client | [selcompy](https://github.com/selcom-developers/selcompy) | | PHP client | [selcom-php](https://github.com/selcom-developers/selcom-php) | | Laravel package | [laravel-selcom](https://github.com/selcom-developers/laravel-selcom) | | This site | [selcom-developers.github.io](https://github.com/selcom-developers/selcom-developers.github.io) | diff --git a/content/getting-started/choosing-a-client.mdx b/content/getting-started/choosing-a-client.mdx index aa8ec19..5b72814 100644 --- a/content/getting-started/choosing-a-client.mdx +++ b/content/getting-started/choosing-a-client.mdx @@ -11,6 +11,7 @@ Every client follows the same [spec](/spec). They sign the same way, read result |---|---|---| | Java or a JVM language | [Java](/clients/java) | Maven `io.github.selcom-developers:selcom4j` | | Node.js, TypeScript or JavaScript | [Node.js](/clients/node) | npm `@selcom-developers/selcom` | +| Python | [Python](/clients/python) | PyPI `selcompy` | | PHP without a framework, or another framework | [PHP](/clients/php) | Packagist `selcom-developers/selcom-php` | | Laravel | [Laravel](/clients/laravel) | Packagist `selcom-developers/laravel-selcom` | diff --git a/content/getting-started/index.mdx b/content/getting-started/index.mdx index 3281a95..658ef72 100644 --- a/content/getting-started/index.mdx +++ b/content/getting-started/index.mdx @@ -43,6 +43,6 @@ The clients are written to the [shared spec](/spec). They sign every request, in ## Next step - Java, Node.js, PHP or Laravel: which one fits your stack. + Java, Node.js, Python, PHP or Laravel: which one fits your stack. Read this before you send your first payment. diff --git a/content/index.mdx b/content/index.mdx index f00df64..273e305 100644 --- a/content/index.mdx +++ b/content/index.mdx @@ -1,6 +1,6 @@ --- title: Community clients for the Selcom payment API -description: Open-source clients for the Selcom payment API in Java, Node.js, PHP and Laravel, built from one shared spec. Not affiliated with Selcom Paytech Ltd. +description: Open-source clients for the Selcom payment API in Java, Node.js, Python, PHP and Laravel, built from one shared spec. Not affiliated with Selcom Paytech Ltd. --- import { Landing } from '@/components/landing' diff --git a/content/spec/client-requirements.mdx b/content/spec/client-requirements.mdx index 72d4278..435d8e5 100644 --- a/content/spec/client-requirements.mdx +++ b/content/spec/client-requirements.mdx @@ -4,7 +4,7 @@ description: What every community client must do. # What every client must do -The Java, Node/TypeScript, PHP and Laravel clients differ in idiom, not in behaviour. This is the checklist they are reviewed against. MUST, MUST NOT, SHOULD and MAY are used as in RFC 2119. +The Java, Node/TypeScript, Python, PHP and Laravel clients differ in idiom, not in behaviour. This is the checklist they are reviewed against. MUST, MUST NOT, SHOULD and MAY are used as in RFC 2119. ## Configuration and environments @@ -84,7 +84,7 @@ If the HTTP library cannot tell which case it is, the answer is `UNKNOWN_OUTCOME - One method per v1 operation, named after it (`createOrder`, `walletPayment`, `orderStatus`, `utilityPayment`, `utilityQuery`, and so on, in each language's style). - Submitting and querying are separate methods. Nothing hides a query inside a submit. - Every method returns the result object from [Results and retries](/spec/results#the-result-object): the typed status, the code and text, the HTTP status, the decoded data and the raw body. -- The HTTP transport is injectable (PSR-18 in PHP, `fetch` in Node, `java.net.http.HttpClient` or an interface over it in Java) so that tests can run without a network. +- The HTTP transport is injectable (PSR-18 in PHP, `fetch` in Node, `httpx` transports in Python, `java.net.http.HttpClient` or an interface over it in Java) so that tests can run without a network. - Webhook support: `verify(headers, rawBody)` returning the verdicts in [Webhooks](/spec/webhooks#verification), and an amount parser. The Laravel package adds a route, middleware and an event, and follows the handling steps in that page. - Clients SHOULD send a `User-Agent` naming the client and its version, for example `selcom-node/0.1.0`. From edfabae15e685e175841b5f4723ef5dd71c090f2 Mon Sep 17 00:00:00 2001 From: Alpha Olomi <10551599+alphaolomi@users.noreply.github.com> Date: Sat, 21 Nov 2026 14:25:06 +0300 Subject: [PATCH 2/2] Balance the client grid --- components/landing/same-spec.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/landing/same-spec.jsx b/components/landing/same-spec.jsx index 31baa11..4e0731b 100644 --- a/components/landing/same-spec.jsx +++ b/components/landing/same-spec.jsx @@ -55,7 +55,7 @@ if ($status->status === Status::Success) { /* fulfil */ }` export function SameSpec() { return ( -
+
{clients.map((client) => (