Eversend Python SDK
Project description
Eversend Python SDK
Python SDK for Eversend payments API
Table of Contents
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 representsourceWallet
(SOURCE) ordestinationCurrency
(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.