Skip to Content

Call the Selcom API without paying anyone twice.

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.

GET /v1/checkout/order-status?order_id=ORD-1001

Authorization
SELCOM MjAyY2I5NjJhYzU5MDc1Yjk2NGIwNzE1MmQyMzRiNzA=
Digest-Method
HS256
Timestamp
2019-02-26T09:30:46+03:00
Signed-Fields
order_id
Digest
pR8qs83hQ34a6EoxXGOKL4yg+JDeJAtzOY6E8fTlvwk=

timestamp=2019-02-26T09:30:46+03:00&order_id=ORD-1001

The signing string and its digest, from the spec's first worked example with the sample key in Selcom's public documentation.

Install a client

Each client is one package with a small surface: configuration, a signer, a transport you can replace, typed operations and a webhook verifier.

JitPack

<repository>
  <id>jitpack.io</id>
  <url>https://jitpack.io</url>
</repository>

<dependency>
  <groupId>com.github.selcom-developers</groupId>
  <artifactId>selcom4j</artifactId>
  <version>v0.1.2</version>
</dependency>

Java 17 or later. Java quickstart

npm

npm i @selcom-developers/selcom

Node 20 or later. Node.js quickstart

PyPI

pip install selcompy

Python 3.10 or later. Python quickstart

Packagist

composer require selcom-developers/selcom-php

PHP 8.2 or later. PHP quickstart

Packagist

composer require selcom-developers/laravel-selcom

Laravel 12 or 13. Laravel quickstart

Sign a request with any HTTP client

Node.js
import {
  formatTimestamp,
  hs256Signer,
  signRequest,
} from "@selcom-developers/selcom";

const signed = signRequest({
  method: "POST",
  params: new Map([
    ["vendor", "TILL123"],
    ["order_id", "ORD-1001"],
    ["amount", 8000],
    ["billing", { firstname: "John" }],
  ]),
  timestamp: formatTimestamp(new Date()), // 2026-11-21T10:30:46+03:00
  apiKey: process.env.SELCOM_API_KEY,
  signer: hs256Signer(process.env.SELCOM_API_SECRET),
});

signed.headers; // Authorization, Digest, Timestamp, Signed-Fields, ...
signed.body;    // flat JSON with "billing.firstname"

From your app to a confirmed payment

The client signs every call and reports what the gateway said. A webhook tells you something changed; order status confirms it before you fulfil.

  1. 1

    Your app

    Calls one typed method, for example createOrder.

  2. 2

    Client

    Checks the fields and keeps them in the order you gave.

  3. 3

    Signed request

    HS256 digest over every field it sends, with a fresh timestamp.

  4. 4

    Selcom gateway

    Answers with a result code that becomes one of the typed statuses.

  5. 5

    Webhook

    Tells your app that a payment changed. A hint, not proof.

  6. 6

    Order status

    Confirms the payment and the amount before you fulfil.

What the clients do for you

The parts that cost money when they go wrong are built in, and each one is usable on its own.

Signing

Every request is signed, GET and DELETE included. The signer is a pure function with no I/O and no clock, so you can test it and use it with any HTTP client.

Signed-Fields

vendor,order_id,amount,billing.firstname

signing string

timestamp=2019-02-26T09:30:46+03:00&vendor=TILL123&order_id=ORD-1001&amount=8000&billing.firstname=John

Typed results

The result code alone decides one of the typed statuses. You also get the gateway's code, text, HTTP status and raw body.

  • SUCCESS000
  • PENDING111, 927
  • AMBIGUOUS999
  • FAILEDany other code
  • NOT_FOUND404 on a query

Safe retries

Payments and writes are never retried. A transport error says whether the request left your server.

NOT_SENT

same ID may be sent again

UNKNOWN_OUTCOME

query after 3 minutes, never resend

Webhooks

verify(headers, rawBody) returns a verdict and the HTTP status to answer with. Order status confirms every payment.

VALID200confirm, then act
UNSIGNED200confirm, then act
REPLAY200already handled
INVALID401log, redacted
STALE401log, redacted

Redaction

Helpers mask phone numbers, e-mail and names, and drop the secret, the PIN, Authorization and Digest before anything reaches a log.

buyer_phone=********0001

buyer_email=t***@example.com

buyer_name=T***

pin=[REDACTED]

Test vectors

Every client runs the spec's vectors in its own test suite, with no network calls.

signing cases
20
rejects
11
response scenarios
120
webhook samples
15

Same spec, multiple languages

The clients differ in idiom, not in behaviour. They take the same settings, return the same typed statuses and pass the same test vectors.

Java

Java 17 or later

com.github.selcom-developers:selcom4j (JitPack)

Result<Responses.OrderStatusData> status =
    client.orderStatus(new Requests.OrderStatus("ORD-1001"));
if (status.status() == Status.SUCCESS) { /* fulfil */ }

Node.js

Node 20 or later

@selcom-developers/selcom

const status = await selcom.orderStatus({ orderId: "ORD-1001" });
if (status.status === "SUCCESS") { /* fulfil */ }

Python

Python 3.10 or later

selcompy

status = client.order_status("ORD-1001")
if status.status is Status.SUCCESS:
    ...  # fulfil

PHP

PHP 8.2 or later

selcom-developers/selcom-php

<?php
$status = $client->orderStatus(new OrderStatusRequest('ORD-1001'));
if ($status->status === Status::Success) { /* fulfil */ }

Laravel

Laravel 12 or 13

selcom-developers/laravel-selcom

<?php
$status = Selcom::orderStatus(new OrderStatusRequest('ORD-1001'));
if ($status->status === Status::Success) { /* fulfil */ }

Community and security

An independent project, built in the open under the Apache License 2.0.

  • Contribute

    Fix a bug, improve a page, or bring the spec to another language. Every repository takes pull requests.

    How to contribute
  • Report a security problem

    Report privately through GitHub on the affected repository. Never in a public issue.

    Security reporting
  • Credentials and support

    API access, contracts and support come from Selcom, not from this community. Start at their developer portal.

    Official Selcom links