SofizPay Logo

SofizPay

SofizPay Logo
SofizPay
Technical Documentation
Bill Payment API

Bill Payment API

Pay your Algerian public utility bills (Sonelgaz, Algérie Télécom, ADE, SEAAL) quickly and securely through our unified API

Standard 3-Phase Bill Payment Workflow

Phase 1: Fetch Live Bill Details

Retrieve pending bill amounts, customer verification, and server identifiers before proceeding.

POST /api/operations/fetch/{service}/
Phase 2: Pre-Save Tracking Metadata

Save essential metadata into the server (Sonelgaz EBB key, ADE payment code, AT number, SEAAL ref).

POST /api/operations/facture-data/
Phase 3: Submit Payment Settlement

Execute the final financial settlement using your encrypted secret key (encrypted_sk).

POST /services/operation_post

RSA Encryption & SofizPay Authentication (RSA-OAEP)

SofizPay Secret Key Encryption (encrypted_sk)

RSA-OAEP SHA-256Base64 (344 chars)Location: JSON Body

To protect the SofizPay Secret Key and prevent transmitting plain secrets across the network, all bill fetching and payment endpoints strictly require the secret key to be encrypted using the official SofizPay RSA Public Key (RSA-OAEP SHA-256) and provided as Base64 in the request body as encrypted_sk.

Official RSA 2048-bit Public Key

bash
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv9toBr7vZ4XIkVzlzdGR
vNVaKw7A9Z3/Vnq3bK8fLaaUTmoweL3CEKSbz1lxYUjzuRzY/nmDuCpPS/7t0i5c
kWRifPaPgIoiUFr1fGLzjN+cttxtvbPQof2Zuxllbq5ox+XyZpc1eo8PjwhRobCB
djDZ1iSV1VkhOWanrnNXeXFzUnRYHQUZmQ8FWOFQ8D9vUZanmq/ZJ6nJ4SZoj2lV
dKrLBbh/MWtn9MmyrPrywoJYCnc7c+ylJIWnAhNv4jTafB5bqDTd6oSElV9lQqPf
diO93j+Q/uBoAZQZ2EqWY0E4Ooz4Dd9dHl7EiNiAh19G9VTcBFN/QfXOdyCGajwC
WwIDAQAB
-----END PUBLIC KEY-----
You can embed this public key or query it live via GET https://epay.sofizpay.com/api/operations/public-key/

Encryption Code Examples

python
1import base64
2from cryptography.hazmat.primitives.asymmetric import padding
3from cryptography.hazmat.primitives import serialization, hashes
4from cryptography.hazmat.backends import default_backend
5
6SOFIZ_PUBLIC_KEY_PEM = """-----BEGIN PUBLIC KEY-----
7MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv9toBr7vZ4XIkVzlzdGR
8vNVaKw7A9Z3/Vnq3bK8fLaaUTmoweL3CEKSbz1lxYUjzuRzY/nmDuCpPS/7t0i5c
9kWRifPaPgIoiUFr1fGLzjN+cttxtvbPQof2Zuxllbq5ox+XyZpc1eo8PjwhRobCB
10djDZ1iSV1VkhOWanrnNXeXFzUnRYHQUZmQ8FWOFQ8D9vUZanmq/ZJ6nJ4SZoj2lV
11dKrLBbh/MWtn9MmyrPrywoJYCnc7c+ylJIWnAhNv4jTafB5bqDTd6oSElV9lQqPf
12diO93j+Q/uBoAZQZ2EqWY0E4Ooz4Dd9dHl7EiNiAh19G9VTcBFN/QfXOdyCGajwC
13WwIDAQAB
14-----END PUBLIC KEY-----"""
15
16def encrypt_sofizpay_sk(secret_key: str, public_key_pem: str = SOFIZ_PUBLIC_KEY_PEM) -> str:
17    """Encrypts SofizPay Secret Key (S...) using RSA-OAEP SHA-256 for encrypted_sk"""
18    pub_key = serialization.load_pem_public_key(
19        public_key_pem.strip().encode('utf-8'),
20        backend=default_backend()
21    )
22    ciphertext = pub_key.encrypt(
23        secret_key.strip().encode('utf-8'),
24        padding.OAEP(
25            mgf=padding.MGF1(algorithm=hashes.SHA256()),
26            algorithm=hashes.SHA256(),
27            label=None
28        )
29    )
30    return base64.b64encode(ciphertext).decode('utf-8')
31
32# Example usage in API request body:
33# payload = {"encrypted_sk": encrypt_sofizpay_sk("S..."), "customer_num": "00000000000"}

Phase 1: Fetch Live Bills API

POST https://epay.sofizpay.com/api/operations/fetch/{service}/

This endpoint allows real-time querying of outstanding unpaid bills directly from Algerian public utility systems, verifying the exact due amount and metadata before proceeding to settlement.

POSThttps://epay.sofizpay.com/api/operations/fetch/sonelgaz/
Content-Type: application/jsonAuth: encrypted_sk (JSON Body)

Fetch Request

cURL
bash
curl --location 'https://epay.sofizpay.com/api/operations/fetch/sonelgaz/' --header 'Content-Type: application/json' --data '{
    "encrypted_sk": "YOUR_ENCRYPTED_SECRET_KEY",
    "customer_num": "00000000000"
}'

Fetch Response (Live Bills)

200 OK
json
{
  "bills": [
    {
      "value": "000000000000",
      "label": "[1500.00 DZD] [000000000000]",
      "amount": 1500.00,
      "bill_number": "000000000000",
      "customer_num": "00000000000",
      "ebb": "000",
      "isIdoom": false
    }
  ],
  "customer_num": "00000000000"
}
Note: The response returns a bills array containing the pending invoice details and exact amount in DZD, used in subsequent phases for saving metadata and executing payment.

Fetch API Parameters

ParameterLocationTypeDescriptionRequired For
encrypted_skBodystringEncrypted SofizPay/merchant secret key for authenticationAll Services
customer_numBodystringSonelgaz 11-character customer ID (e.g. 00000000000) from bill or Data Matrix codeSonelgaz
bill_numberBodystringSonelgaz bill number (optional for direct bill matching)Sonelgaz (Optional)
ebbBodystringEBB verification key from Sonelgaz bill barcode (optional)Sonelgaz (Optional)
ndBodystringLandline phone number / Idoom designation number (ND e.g. 021000000)Algérie Télécom
c_paiementBodystringElectronic payment code (Code de Paiement) printed on the ADE water invoiceADE
customer_numBodystringCustomer or contract reference number for SEAAL (Algiers & Tipaza water)SEAAL

Phase 2: Pre-Save Tracking Metadata — POST /api/operations/facture-data/

Save essential metadata into the server (Sonelgaz EBB key, ADE payment code, AT number, SEAAL ref).

bash
curl --location 'https://epay.sofizpay.com/api/operations/facture-data/' --header 'Content-Type: application/json' --data '{
    "encrypted_sk": "YOUR_ENCRYPTED_SECRET_KEY",
    "facture_number": "000000000000",
    "bill_number": "000000000000",
    "ebb": "000",
    "customer_number": "00000000000"
}'

Phase 3: Submit Payment Settlement — POST /services/operation_post

Sonelgaz

Sonelgaz

Société Nationale de l'Électricité et du Gaz

Payment Request Example

bash
curl --location 'https://sofizpay.com/services/operation_post' --header 'Content-Type: application/json' --data '{      
    "encrypted_sk": "YOUR_ENCRYPTED_SECRET_KEY",
    "amount": 1500.00,
    "operator": "sonelgaz",
    "offer": "sonelgaz",
    "bill": "000000000000",
    "customerId": "",
    "customernumber": " ",
    "ebb": " "
}'
Service Operator
"sonelgaz"
Required Fields
encrypted_skamountoperator: "sonelgaz"offer: "sonelgaz"billebbcustomerId
Algérie Télécom

Algérie Télécom

Algérie Télécom (Idoom Fixe & 4G)

Payment Request Example

bash
curl --location 'https://sofizpay.com/services/operation_post' --header 'Content-Type: application/json' --data '{      
    "encrypted_sk": "YOUR_ENCRYPTED_SECRET_KEY",
    "amount": 645.00,
    "montant": 645.00,
    "operator": "AT",
    "offer": "AT",
    "phone": "021000000",
    "bill": "021000000",
    "bill_number": "021000000",
    "memo": "00:021000000"
}'
Service Operator
"AT"
Required Fields
encrypted_skamountmontantoperator: "AT"offer: "AT"phonebillmemo: "00:nd"
ADE

ADE

Algérienne Des Eaux

Payment Request Example

bash
curl --location 'https://sofizpay.com/services/operation_post' --header 'Content-Type: application/json' --data '{      
    "encrypted_sk": "YOUR_ENCRYPTED_SECRET_KEY",
    "amount": 2500,
    "operator": "ade",
    "offer": "ade",
    "bill": "0000000000",
    "c_paiement": "0000000000",
    "customerId": "0000000000"
}'
Service Operator
"ade"
Required Fields
encrypted_skamountoperator: "ade"offer: "ade"billc_paiementcustomerId
SEAAL

SEAAL

Société des Eaux et de l'Assainissement d'Alger

Payment Request Example

bash
curl --location 'https://sofizpay.com/services/operation_post' --header 'Content-Type: application/json' --data '{      
    "encrypted_sk": "YOUR_ENCRYPTED_SECRET_KEY",
    "amount": 1800,
    "operator": "seaal",
    "offer": "SEAAL",
    "phone": "00000000",
    "bill": "00000000",
    "memo": "00:00000000"
}'
Service Operator
"seaal"
Required Fields
encrypted_skamountoperator: "seaal"offer: "SEAAL"phonebillmemo: "00:num"

Payment Request Parameters

ParameterTypeDescriptionRequired For
encrypted_skstringEncrypted SofizPay/merchant secret key for authenticationAll Services
amountnumberPayment amount in DZDAll Services
operatorstringService provider: sonelgaz, AT, ade, or seaalAll Services
offerstringService offer type: sonelgaz, AT, ade, or SEAALAll Services
billstringBill number, customer ID, or payment referenceAll Services
ebbstringEBB verification key (Clé EBB) from Sonelgaz paper bill barcodeSonelgaz
c_paiementstringElectronic payment code from ADE water bill (c_paiement)ADE
phonestringCustomer phone number or landline (Algérie Télécom, SEAAL)AT / SEAAL
memostringPayment memo in format 00:{number} (Algérie Télécom, SEAAL)AT / SEAAL
montantnumberAmount in DZD specifically passed for Algérie Télécom / IdoomAlgérie Télécom

Success Response (200)

json
{
    "status": "success",
    "message": "Bill payment completed successfully",
    "operation_id": "OP_DZ_000000000000",
    "transaction_id": "TXN_000000000",
    "transaction_status": "confirmed"
}

Note: The bill payment will be processed through SofizPay gateway and confirmation will be issued immediately.