Skip to main content

A Python library for integrating with Safaricom Daraja API

Project description

Daraja Gateway

This library provides integration with the Safaricom Daraja API using Flask.

Features

  • OAuth token management
  • C2B, B2C, B2B, STK Push
  • Webhook validation and confirmation

Installation

pip install .

Environment Configuration

Create a .env file in the root of your project:

cp .env.example .env

Edit .env with your credentials:

CONSUMER_KEY=your_consumer_key
CONSUMER_SECRET=your_consumer_secret
BASE_URL=https://sandbox.safaricom.co.ke
SHORT_CODE=600000
PASSKEY=your_passkey
INITIATOR_NAME=testapi
SECURITY_CREDENTIAL=your_encoded_security_credential
CALLBACK_URL=https://yourdomain.com/webhook/confirmation
VALIDATION_URL=https://yourdomain.com/webhook/validation
PARTY_B=600000

Usage

from daraja_gateway.client import DarajaClient
client = DarajaClient()
response = client.stk_push()
print(response)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

daraja_gateway-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

daraja_gateway-0.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file daraja_gateway-0.1.0.tar.gz.

File metadata

  • Download URL: daraja_gateway-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for daraja_gateway-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6463f624550617204b317a60a86948c8705c218cadfd6e97cb743c5798928469
MD5 03a99008235f6cd7b06b22601d5d51e4
BLAKE2b-256 21bc19d7ced901366b0f31781b9cc88823151234aa6d858e77a29a1fc4ba8233

See more details on using hashes here.

File details

Details for the file daraja_gateway-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: daraja_gateway-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for daraja_gateway-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16974120d0060d5bf27f3550494e76bae697fb31bc6f1047df25508f84db0b92
MD5 9ef551d631ee7b0c6a1a1cbb72f3715e
BLAKE2b-256 ee6c9fef289b05db578c031afee9b1e8fa30e1017b42f2ee030fbe30464d9e44

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page