Skip to content

KodyPay/kody-clientsdk-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kody API – Python SDK

This guide provides an overview of using the Kody Python gRPC Client SDK and its reference documentation.

Client Libraries

Kody provides client libraries for many popular languages to access the APIs. If your desired programming language is supported by the client libraries, we recommend that you use this option.

Available languages:

The advantages of using the Kody Client library instead of a REST API are:

  • Maintained by Kody.
  • Built-in authentication and increased security.
  • Built-in retries.
  • Idiomatic for each language.
  • Efficient protocol buffer HTTP request body.
  • Quicker development.
  • Backwards compatibility with new versions.

If your coding language is not listed, please let the Kody team know and we will be able to create it for you.

Python Installation

Requirements

  • Python 3.7 or later
  • pip / virtualenv (optional)
  • gRPC and Protobuf libraries

Step 1: Install dependencies

Add to your requirements.txt:

grpcio-tools

And in your setup.py:

install_requires=[
    'grpcio==1.66.1',
    'protobuf==5.27.2'
],

Step 2: Install via pip

Install the Kody Python SDK from PyPI:

pip install kody-clientsdk-python

Step 3: Import in Code

import kody_clientsdk_python.pay.v1.pay_pb2 as kody_model
import kody_clientsdk_python.pay.v1.pay_pb2_grpc as kody_client

Authentication

The client library uses a combination of a Store ID and an API key.

These credentials will be shared with you during the technical integration onboarding process. During development, you’ll be given a test Store ID and test API key. For production, you’ll receive live credentials securely linked to your onboarded store.

Host names

  • Development and test: https://grpc-staging.kodypay.com
  • Live: https://grpc.kodypay.com

API Authentication

All client requests authenticate using gRPC metadata with the x-api-key.

# Create request and set metadata
get_terminals_request = kody_model.TerminalsRequest(store_id="STORE ID")
metadata = [("x-api-key", "API KEY")]

# Setup gRPC channel and client stub
channel = grpc.secure_channel("HOSTNAME", grpc.ssl_channel_credentials())
kody_service = kody_client.KodyPayTerminalServiceStub(channel)

# Make the call
get_terminals_response = kody_service.Terminals(get_terminals_request, metadata=metadata)

🔒 Store your API KEY securely using environment variables. How to Handle Secrets in Python

Documentation

For full API documentation, protocol definitions, and integration guides, please visit: 📚 https://api-docs.kody.com

Sample Code

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 9