Skip to main content

Eversend Python SDK

Project description

Eversend Python SDK

PyPI version Build Status Dependencies

Python SDK for Eversend payments API

Table of Contents

  1. Installation
  2. Initialization
  3. Usage
  4. Contribution Guidelines
  5. License

Installation

$ pip install -U eversend

Initialization

from eversend import Eversend

eversendClient = Eversend(clientId= 'clientId', clientSecret= 'clientSecret', version='v1')

wallets = eversendClient.Wallets.list();

You can get your clientId and clientSecret from the settings section in the dashboard

Usage

Wallets

Get all wallets

wallets = eversendClient.Wallets.list();

Get one wallet

wallets = eversendClient.Wallets.getOne('USD');

Transactions

Get all transactions

transactions = eversendClient.Transactions.list(
    page = 1,
    limit = 10
);

If page and limit are not set, the default of 1 and 10 are used respectively.

Get one transaction

transaction = eversendClient.Transactions.getOne(
    transactionId= "EVS12345678"
);

Exchange

To exchange from one wallet to another, you first have to generate a quotation. This returns a token with a 30s timeout that you can use to make the exchange.

Get exchange quotation

quotation = eversendClient.Exchange.getQuotation(
    source = "USD",
    destination = "UGX",
    amount = 10.0
);

Exchange currency

exchange = eversendClient.Exchange.exchange(
    token = "dhhsggajjshhdhdhd",
    transactionRef = "EVS-12345678", # optional field
);

Beneficiaries

Get beneficiaries

beneficiaries = eversendClient.Beneficiaries.list(
    page = 1,
    limit = 10
);

If page and limit are not set, the default of 1 and 10 are used respectively.

Get single beneficiary

beneficiary = eversendClient.Beneficiaries.getOne(
    beneficiaryId = 100
);

Create a beneficiary

beneficiary = eversendClient.Beneficiaries.create(
    firstName = "John",
    lastName = "Okello",
    country = "UG", # Alpha-2 country code
    phoneNumber = "+256712345678", # Should be in international format
    bankAccountName = "John Okello",
    bankAccountNumber = "12345678",
    bankName = "Stanbic Bank",
    bankCode = 1234 # You can get the bank code from payouts.getDeliveryBanks()
);

Note that all bank fields are optional if bank payments will not be required

Edit a beneficiary

beneficiary = eversendClient.Beneficiaries.update(
    beneficiaryId = 100,
    firstName = "John",
    lastName = "Okello",
    country = "UG", # Alpha-2 country code
    phoneNumber = "+256712345678", # Should be in international format
    bankAccountName = "John Okello",
    bankAccountNumber = "12345678",
    bankName = "Stanbic Bank",
    bankCode = 1234 # You can get the bank code from payouts.getDeliveryBanks()
);

Note that all bank fields are optional if bank payments will not be required

Delete a beneficiary

eversendClient.Beneficiaries.delete(
    beneficiaryId = 100
);

Collections

Get collection fees

collectionFees = eversendClient.Collections.getFees(
    amount = 1000,
    currency = "KES",
    method = "momo"
);

Get collection OTP

Required when initiating mobile money collections

collectionOTP = eversendClient.Collections.getOTP(
    phone = "+256712345678"
);

Initiate Mobile Money collection

collection = eversendClient.Collections.initiate(
    method = "momo",
    phone = "+256712345678",
    amount = 1000,
    country = "UG",
    currency = "UGX",
    pin = 123456, # From phone number passed in Get Collection OTP
    pinId = "dg524fhsgfde", # From Get Collection OTP
    transactionRef = "EVS-12345678", # Optional transaction ref generated by you
    customer = { name = "John Okello" } # Optional customer object with your metadata
);

Payouts

Get payout quotation

quotation = eversendClient.Payouts.getQuotation(
    sourceWallet = "USD",
    amount = 100,
    type = "momo",
    destinationCountry = "KE",
    destinationCurrency = "KES",
    amountType = "SOURCE", # amountType can be SOURCE or DESTINATION
);

amountType refers to whether you want amount to represent sourceWallet (SOURCE) or destinationCurrency (DESTINATION)

Pay existing beneficiary

payout = eversendClient.Payouts.initiate(
    beneficiaryId = 100,
    quotationToken = "token",
    transactionRef = "EVS-12345678" # Optional transaction ref generated by you
);

Pay new beneficiary

payout = eversendClient.Payouts.initiate(
    firstName = "John",
    lastName = "Okello",
    country = "UG", # Alpha-2 country code
    phoneNumber = "+256712345678", # Should be in international format
    bankAccountName = "John Okello",
    bankAccountNumber = "12345678",
    bankName = "Stanbic Bank",
    bankCode = 1234, # You can get the bank code from payouts.getDeliveryBanks()
    quotationToken = "token",
    transactionRef = "EVS-12345678" # Optional transaction ref generated by you
);

Get delivery countries

countries = eversendClient.Payouts.countries()

Get delivery banks

banks = eversendClient.Payouts.banks(
    country = "UG"
);

Contribution Guidelines

Contributions are welcome and encouraged. Learn more about our contribution guidelines here

License

MIT © Eversend

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

eversend-1.0.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

eversend-1.0.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file eversend-1.0.1.tar.gz.

File metadata

  • Download URL: eversend-1.0.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for eversend-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2710a4f0f3ae72b2bc26c9cec5aaf3fdeb015f74dc3c6a2a3c3985088f0c5d9e
MD5 cf5e5124c77093070c01e7a3f7064450
BLAKE2b-256 93e6f6f1d94df31f21ad0f353f7aeea994a3f7b967b4ce7c831e0da72132e1d8

See more details on using hashes here.

File details

Details for the file eversend-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: eversend-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for eversend-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82d3fe4e66b367aa39d00a38bebe69eea4cee9c1fe7c614646085d5bedfef7dc
MD5 3acd9553e26e88104aaf94cf6a57bbdd
BLAKE2b-256 144d3b53a900a875e88e2856bd5a65b38df712e1b1a7487005b923fd10027c77

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