Skip to main content

KillBills e-receipt sdk

Project description

KillBills - SDK (Python)

The main purpose of this Software Development Kit (SDK) is to facilitates the integration of KillBills' services into Python applications. The SDK will act as an intermediary layer, allowing developers to communicate with the KillBills API and access its features in a straightforward manner. By providing a consistent and easy-to-use interface, the SDK aims to simplify & speed up the process of integrating KillBills' services into Python applications.

Dependancies

Python

Features

  • getStores : The method getStores returns a list of killbills integrated stores as an array of objects with relevant properties.
  • sendTransaction : The method sendTransaction validates and send transaction to the killbills gate transaction.
  • sendReceipt : The method sendReceipt validates and send a receipt to the killbills gate receipt.

Installation

with pip :
pip install killbills-sdk

Usage/Examples

Method getStores :

import killbills_sdk
from killbills_sdk.getStores import get_stores

print(get_stores('dev','your-api-key'))
Output:
[
  {
    "id": "id",
    "billing_descriptor": "store billing descriptor",
    "store_name": "store name",
    "merchant_name": "merchant name",
    "full_address": "00 street, 00000, city",
    "siret": 00000000000000
  },
   {
    "id": "id",
    "billing_descriptor": "store billing descriptor",
    "store_name": "store name",
    "merchant_name": "merchant name",
    "full_address": "00 street, 00000, city",
    "siret": 00000000000000
  },
  //...other results
]

Method sendTransaction :

note that the transactionData object only contains minimal required values see (insert link to all possibilities)
import killbills_sdk
from killbills_sdk.sendTransaction import send_transaction

payload = {...}
print(send_transaction('dev',payload,'your-hmac-key'))
Output:
{
"status": "success",
"message": "published to gate transaction",
"messageId": "xxxxxxxxxxxxxxxxx",
"previewLink": "https://banks.killbills.co/payloads/xxxxxxxxxxxxxxxxx"
}

Method sendReceipt :

note that the receiptData object only contains minimal required values see (insert link to all possibilities)
from sendReceipt import send_receipt
receiptData = {...}
print(send_receipt('prod', receiptData,'your-hmac-key' ))
Output:
{
"status": "success",
"message": "published to gate receipt",
"messageId": "xxxxxxxxxxxxxxxxx",
"previewLink": "https://merchants.killbills.co/payloads/xxxxxxxxxxxxxxxxx"
}

Transaction & Receipt Architecture

TRANSACTION :

transactionData = {
    bank_id: '', // string (36 caractères)
    callback_url: '', // string
    partner_name: '', // string
    kb_features: [], // tableau de chaînes de caractères ou nombres vides
    receipt_format: '', // string ('JSON', 'PDF', 'SVG', 'PNG')
    transaction: {
        reference_id: '', // string
        amount: '', // number (positif)
        customer_id: '', // string
        transaction_date: '', // date (au format chaîne de caractères)
        store_name: '', // string ou vide
        billing_descriptor: '', // string
        siret: '', // string ou vide
        payment: '', // objet vide
        currency: '', // string ou vide
        pos_name: '', // string ou vide
        merchant_name: '' // string ou vide
    }
};

RECEIPT :

receiptData = {
    reference_id: '', // string (alphanumérique)
    amount: 0, // number
    total_tax_amount: '', // number ou vide
    currency: '', // string ('EUR' ou 'USD')
    date: '', // string (au format 'YYYY-MM-DDTHH:mm:ss')
    covers: 0, // number ou vide
    table: '', // string ou vide
    invoice: 0, // number ou vide
    total_discount: 0, // number ou vide
    mode: 0, // number ou vide
    partner_name: '', // string
    merchant: {
        merchant_name: '', // string ou vide
        reference_id: '', // string
        merchant_id: 0 // number ou vide
    },
    store: {
        store_name: '', // string
        reference_id: '', // string
        billing_descriptor: '', // string
        siret: '', // string (14 caractères)
        code_ape: '', // string ou vide
        tva_intra: '', // string ou vide
        address: {
            postal_code: 0, // number
            street_address: '', // string ou vide
            country: '', // string ou vide
            city: '', // string ou vide
            full_address: '', // string ou vide
            number: 0 // number ou vide
        }
    },
    taxes: [{ 
        description: '', // string ou vide
        amount: 0, // number
        rate: 550 // number (550, 1000 ou 2000) ou vide
    }],
    items: [{
        reference_id: '', // string ou vide
        name: '', // string
        description: '', // string ou vide
        type: '', // string ou vide
        quantity: 0, // number
        price: 0, // number
        discount: 0, // number ou vide
        total_amount: 0, // number ou vide
        tax: {
            description: '', // string ou vide
            amount: 0, // number
            rate: 550 // number (550, 1000 ou 2000) ou vide
        },
        subitems: [{
            reference_id: '', // string ou vide
            name: '', // string
            description: '', // string ou vide
            quantity: 0, // number ou vide
            price: 0, // number ou vide
            discount: 0, // number ou vide
            total_amount: 0, // number ou vide
            tax: {
                description: '', // string ou vide
                amount: 0, // number
                rate: 550 // number (550, 1000 ou 2000) ou vide
            }
        }]
    }],
    payments: [{
        bin: '', // string ou vide
        last_four: '', // string ou vide
        auth_code: '', // string ou vide
        scheme: '', // string ou vide
        amount: 0, // number
        transaction_date: '', // string (au format 'YYYY-MM-DDTHH:mm:ss')
        transaction_id: '', // string ou vide
        payment_type: '' // string ou vide
    }]
};

Run Locally

Clone the project

  git clone https://github.com/killbillsdev/python-sdk

Go to the project directory

  cd python-sdk

Install dependencies

make install

Build project

make build

Running Tests

To run tests, run the following command

make test

Feedback

If you have any feedback, please reach out to us at :

https://freeonlinesurveys.com/s/8biYAZPa

License

MIT MIT License

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

killbills_sdk-0.0.2.tar.gz (10.0 kB view details)

Uploaded Source

Built Distributions

killbills_sdk-0.0.2.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

killbills_sdk-0.0.2-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file killbills_sdk-0.0.2.tar.gz.

File metadata

  • Download URL: killbills_sdk-0.0.2.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for killbills_sdk-0.0.2.tar.gz
Algorithm Hash digest
SHA256 97587fc112a56aa9a1934a59face8d3fa89e5f09f4782695e1c73233926905ab
MD5 f0e766ca1430137592ed390b09f328e5
BLAKE2b-256 f65914bcaf90cb020d6576d156bd9db7d8fa0ef4c986b192a39807142ea3e459

See more details on using hashes here.

File details

Details for the file killbills_sdk-0.0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for killbills_sdk-0.0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7410382dec079101b49550be05e2465358c728d49531eebef056f486807e759
MD5 4f37a4c66da5bc5cea19ef6f61c83322
BLAKE2b-256 196bc8aefe7fa7c679b9494057a9bb406000f4e5d2e6df93becf89db4a1adc32

See more details on using hashes here.

File details

Details for the file killbills_sdk-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for killbills_sdk-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e098399e0be0a2ba263f2551ada97bb49e4b1c5f8f7fa8a836c80291228423fc
MD5 56357914fb36a1b1ffadc948ac8c5f38
BLAKE2b-256 5bf5e45fe4a39d6a518156d570dfcddb0f94c13795aa435cf9b5c2e384e1a113

See more details on using hashes here.

Supported by

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