API Reference

Classes

class odeo.client.Client(client_id: str, client_secret: str, signing_key: str, base_url: str = 'https://odeo-core-api.dev.odeo.co.id')

Odeo For Business API SDK client

To create a new client object, you need to provide at the minimum the client_id, client_secret, and signing_key parameters

Example:

from odeo.client import Client

client = Client(client_id='…', client_secret='…', signing_key='…')

By default, the client will access the development API server, to access production API server set the base_url parameter to PRODUCTION_BASE_URL constant

Example:

from odeo.client import Client, PRODUCTION_BASE_URL

client = Client(
    client_id='…',
    client_secret='…',
    signing_key='…',
    base_url=PRODUCTION_BASE_URL
)
property authentication: requests_oauthlib.oauth2_session.OAuth2Session

OAuth 2 session object

set_transport_adapter(prefix: str, adapter: requests.adapters.BaseAdapter)

Override network transport adapter used in the Requests calls

property disbursement: odeo.services.disbursement.DisbursementService

Cached Disbursement service group object

property payment_gateway: odeo.services.payment_gateway.PaymentGatewayService

Cached Payment Gateway service group object

property sub_user: odeo.services.sub_user.SubUserService

Cached Sub User service group object

property cash: odeo.services.cash.CashService

Cached Cash service group object

class odeo.services.disbursement.DisbursementService(oauth: requests_oauthlib.oauth2_session.OAuth2Session, base_url: str, client_secret: str, signing_key: str)

Disbursement API service

The group functions for all Disbursement service endpoints

Example:

# Get supported banks list
banks = client.disbursement.get_banks()
get_banks()

Get supported by Odeo For Business API banks list

Returns

Banks list with details like bank code, swift code, etc.

Return type

list[Bank]

bank_account_inquiry(account_number: str, bank_id: int, customer_name: str, with_validation: bool = False)

Inquire bank account detail info

Parameters
  • account_number – Bank account number to inquire the info for

  • bank_id – Supported bank ID retrieved from DisbursementService.get_banks()

  • customer_name – Customer name that will be matched against the acquired bank info

  • with_validation – Whether to calculate customer name matching rate

Returns

Bank account data model if inquiry is successful

Return type

BankAccount

Raises
create_disbursement(account_number: str, amount: int, bank_id: int, customer_name: str, reference_id: str, description: str = None)

Create disbursement order

Parameters
  • account_number – Destination account number

  • amount – The amount that will be disbursed

  • bank_id – Destination supported bank ID retrieved from DisbursementService.get_banks()

  • customer_name – Receiver customer name

  • reference_id – Unique reference ID to be associated with the created disbursement order

  • description – Optional description to specify additional info attached to the disbursement

Returns

Disbursement data model if order successfully created

Return type

Disbursement

get_disbursement(by_disbursement_id: int = None, by_reference_id: str = None)

Get specific disbursement detail by its ID or reference ID

Parameters
  • by_disbursement_id – The ID of the disbursement detail retrieved

  • by_reference_id – The reference ID of the disbursement detail retrieved

Returns

Disbursement data model if exists

Return type

Disbursement

Raises

ResourceNotFoundError – The disbursement with the specified ID or reference ID does not exist

class odeo.services.payment_gateway.PaymentGatewayService(oauth: requests_oauthlib.oauth2_session.OAuth2Session, base_url: str, client_secret: str, signing_key: str)

Payment Gateway API service

The group functions for all Payment Gateway service endpoints

Example:

# Get specific payment order detail by its ID
payment = client.payment_gateway.get_payment(by_payment_id=123)
get_payment(by_payment_id: int = None, by_reference_id: str = None)

Get specific payment order detail by its ID or reference ID

Parameters
  • by_payment_id – The ID of the payment order detail retrieved

  • by_reference_id – The reference ID of the payment order detail retrieved

Return type

Payment

class odeo.services.cash.CashService(oauth: requests_oauthlib.oauth2_session.OAuth2Session, base_url: str, client_secret: str, signing_key: str)

Cash API service

The group functions for all Cash service endpoints

Example:

 # Create VA top up order
topup = client.cash.create_va_topup(amount=100000)
create_bulk_transfers(requests: list[odeo.models.cash.Request])

Create bulk transfer orders to any users in the system

Parameters

requests – Transfer requests object list

Returns

Successfully created transfers order

Return type

list[Transfer]

list_transfers(reference_ids: list[str] = None, start_date: datetime.datetime = None, end_date: datetime.datetime = None, page_token: str = None)

Retrieve paginated list of transfers history

Parameters
  • reference_ids – Filter transfers with specific reference ID

  • start_date – Filter transfer creation date from specific date

  • end_date – Filter transfer creation date until specific date

  • page_token – Pagination token for next or previous transfers

Return type

TransfersList

create_va_topup(amount: int, user_id: int = None)

Create top up order for Virtual Account payment channels

Parameters
  • amount – The amount that will be deposited

  • user_id – Specific user ID where to deposit the amount, or current user if not set

Returns

Successfully created top up order

Return type

Topup

Raises
  • InputValidationError – Minimum amount is 10000, maximum 1000000000000

  • GeneralError – User with specified user ID not found, or there’s pending top up order

find_active_va_topup(user_id: int = None)

Retrieve currently active/pending Virtual Account top up order

Parameters

user_id – Specified the user ID of the top-up order

Return type

Topup

Raises

GeneralError – There’s no currently active/pending top up order

cancel_va_topup(user_id: str = None)

Cancel currently active/pending Virtual Account top up order

Parameters

user_id – Specified the user ID of the top-up order

Returns

Empty dictionary if successful

Raises

GeneralError – There’s no currently active/pending top up order, or user with specified user ID not found, or you’re not authorized to cancel the order, or the top-up order can’t be canceled

get_balance(user_id: str = 'me')

Retrieve the balance of current or specified user

Parameters

user_id – Specify the user ID

Return type

Balance

Raises

GeneralError – The user with specified user ID not found

get_transactions_history(user_ids: list[int] = None, start_date: datetime.datetime = None, end_date: datetime.datetime = None, page_token: str = None)

Retrieve the paginated list of transactions history for current or specified users

Parameters
  • user_ids – Specify the sub user ID

  • start_date – Filter transaction creation date from specific date

  • end_date – Filter transaction creation date until specific date

  • page_token – Pagination token for next or previous transactions

Return type

TransactionsHistory

class odeo.services.sub_user.SubUserService(oauth: requests_oauthlib.oauth2_session.OAuth2Session, base_url: str, client_secret: str, signing_key: str)

Sub User API service

The group functions for all Sub User service endpoints

Example:

# Retrieve the list of current account sub users
sub_users = client.sub_user.list_sub_users()
list_sub_users(page_token: str = None)

Retrieve paginated list of the sub users of the main account user

Parameters

page_token – Pagination token for next or previous sub users

Return type

SubUsersList

create_sub_user(email: str, name: str, phone_number: str)

Create a new user as the sub user of the main account user

Parameters
  • email – The sub user email address for registration

  • name – The sub user full name

  • phone_number – The sub user phone number where the OTP SMS will be sent to

Returns

Successfully created sub user detail

Return type

SubUser

Raises
update_sub_user(user_id: int, email: str, name: str, phone_number: str)

Update specific sub user account detail

Parameters
  • user_id – The user ID of the sub user that need to be updated

  • email – The new email address

  • name – The new full name

  • phone_number – The new phone number

Return type

SubUser

Raises

Data Classes

class odeo.models.disbursement.Bank(bank_id: int, name: str, bank_code: str, swift_code: str)
classmethod from_json(json)

Convert from JSON dictionary to Bank object

class odeo.models.disbursement.BankAccountStatus(value)

Bank account inquiry statuses

COMPLETED_INQUIRY

FAILED_INQUIRY

WRONG_BANK_ACCOUNT_NUMBER

CLOSED_BANK_ACCOUNT

INQUIRY_REJECTED_BY_THE_VENDOR_BANK

INQUIRY_VENDOR_BANK_IS_DOWN

class odeo.models.disbursement.BankAccount(bank_id: int, account_number: str, account_name: str, customer_name: str, fee: int, status: odeo.models.disbursement.BankAccountStatus, created_at: datetime.datetime, bank_account_inquiry_id: str, validity: int)
classmethod from_json(json)

Convert from JSON dictionary to BankAccount object

class odeo.models.disbursement.DisbursementStatus(value)

Disbursement order statuses

PENDING_DISBURSE_INQUIRY

PENDING_DISBURSE_INQUIRY_DUE_TO_BANK_RECONCILIATION

DISBURSEMENT_IS_ON_PROGRESS

COMPLETED_DISBURSEMENT

SUSPECT_DISBURSE_INQUIRY

FAILED_DISBURSE_INQUIRY

WRONG_BANK_ACCOUNT_NUMBER

CLOSED_BANK_ACCOUNT

INQUIRY_REJECTED_BY_THE_VENDOR_BANK

INQUIRY_VENDOR_BANK_IS_DOWN

class odeo.models.disbursement.Disbursement(disbursement_id: str, bank_id: int, bank_code: str, account_number: str, customer_name: str, amount: int, fee: int, reference_id: str, status: odeo.models.disbursement.DisbursementStatus, created_at: datetime.datetime, description: str = None)
classmethod from_json(json: dict)

Convert from JSON dictionary to Disbursement object

class odeo.models.payment_gateway.PaymentStatus(value)

Payment order statuses

PAYMENT_VERIFICATION_IS_ON_PROGRESS

PAYMENT_IS_COMPLETED_OR_PAID

SUSPECT_PAYMENT

FAILED_PAYMENT

PAYMENT_FAILED_REJECTED_BY_MERCHANT

class odeo.models.payment_gateway.Payment(payment_id: int, amount: int, fee: int, status: odeo.models.payment_gateway.PaymentStatus, reference_id: str)
classmethod from_json(json: dict)

Convert from JSON dictionary to Payment object

class odeo.models.cash.Cash(amount: int, currency: str, formatted_amount: str)
classmethod from_json(json: dict)

Convert from JSON dictionary to Cash object

class odeo.models.cash.Balance(cash: odeo.models.cash.Cash, locked_cash: odeo.models.cash.Cash)
classmethod from_json(json: dict)

Convert from JSON dictionary to Balance object

class odeo.models.cash.Request(receiver_user_id: int, amount: int, reference_id: str, sender_user_id: int = None, note: str = None)
to_dict()

Convert Request object to dictionary data type

class odeo.models.cash.Channel(fee: int, channel_id: int, pay_code: str, amount: int, total: int)
classmethod from_json(json: dict)

Convert from JSON dictionary to Channel

class odeo.models.cash.Topup(channels: list, topup_id: str, expires_at: datetime.datetime)
classmethod from_json(json: dict)

Convert from JSON dictionary to Topup

class odeo.models.cash.CashTransaction(cash_transaction_id: str, user_id: str, amount: int, balance_before: int, balance_after: int, transaction_type: str, created_at: datetime.datetime)
classmethod from_json(json: dict)

Convert from JSON dictionary to CashTransaction

class odeo.models.cash.TransactionsHistory(cash_transactions: list, next_page_token: str = None)
classmethod from_json(json: dict)

Convert from JSON dictionary to TransactionHistory

class odeo.models.cash.Transfer(transfer_id: str, created_at: datetime.datetime, receiver_user_id: int, amount: int, reference_id: str, sender_user_id: int = None, note: str = None)
classmethod from_json(json: dict)

Convert from JSON dictionary to Transfer

class odeo.models.cash.TransfersList(transfers: list, next_page_token: str = None)
classmethod from_json(json: dict)

Convert from JSON dictionary to TransfersList

class odeo.models.sub_user.SubUser(user_id: int, name: str, phone_number: str, email: str)
classmethod from_json(json: dict)

Convert from JSON dictionary to SubUser object

class odeo.models.sub_user.SubUsersList(sub_users: list, next_page_token: str = None)
classmethod from_json(json: dict)

Convert from JSON dictionary to SubUsersList object

Exceptions

exception odeo.exceptions.GeneralError

General/generic error message

exception odeo.exceptions.InputValidationError

Request inputs validation failed

exception odeo.exceptions.InsufficientBalanceError

User balance is insufficient to cover any cash transactions

exception odeo.exceptions.InvalidBankError

Unsupported or invalid bank ID

exception odeo.exceptions.ResourceNotFoundError

The resource requested does not exists

Functions

odeo.api_signature.generate_signature(http_method: str, path: str, query_string: str, access_token: str, timestamp: int, request_body: str, signing_key: str) str