Skip to main content

Maplerad python API wrapper

Project description

The Maplerad Python API Wrapper

The library follows an object-oriented approach

There are currently twelve (12) base categories namely:

  • Customer
  • Collections
  • Transfer
  • Bills
  • Wallets
  • Issuing
  • Identity
  • Transactions
  • Counterparty
  • Forex
  • Institutions
  • Misc

Learn more from the docs

Installation

 $  pip install maplerad-python

Authorization

A secret key is needed for authorization. It can be gotten from the Maplerad dashboard

Environments

Maplerad provides two environments to ensure a smooth and easy experience.

  • sandbox: for development
  • live: for production

Sandbox

Sandbox is your playground. You can credit your test wallets and use that to test your integrations, no real money will be debited or credited. Ensure to switch to Live when you are ready to launch.

Live

All method calls under Live will be charged and real money will be debited or credited. You are advised to use this when you have fully tested your integrations and are ready to launch your product.

Usage

# import the package
from maplerad_python.auth import Authentication


secret_key = os.getenv("MAPLERAD_SECRET_KEY")
environment = "DEVELOPMENT"

auth = Authenticate(secret_key,environment)

Customers

customer = auth.customers()

Create a Customer

payload = {
        "email": user.email,
        "first_name": user.first_name,
        "last_name": user.last_name,
        "country": country_type
        }

result = customer.create_customer(payload)

Upgrade Customer tier 1

payload = {
                    "customer_id": customer_id,
                    "phone": {
                        "phone_number": phone_number,
                        "phone_short_code": phone_short_code
                    },
                    "address": {
                        "city": address.city,
                        "country": address.country,
                        "postal_code": address.postal_code,
                        "state": address.state,
                        "street": address.street,
                        "street2": address.street2
                    },
                    "dob": dob,
                    "identification_number": identification_number
                }

result = customer.upgrade_customer_tier1(payload)

Upgrade customer tier2

payload = {
                "customer_id": customer_id,
                "identity": {
                    "country": identity.country,
                    "image": identity.image,
                    "number": identity.number,
                    "type": identity.type
                }
            }

result = customer.upgrade_customer_tier2(payload)

Get a customer

result = customer.get_customer(customer_id)

Get all Customers

result = customer.get_all_customers()

Get customer cards

result = customer.get_customer_cards(customer_id)

Get customer transactions

result = customer.get_customer_transactions(customer_id)

Get customer virtual accounts

result = customer.get_customer_virtual_accounts(customer_id)

Customer Card enrollment

result = customer.customer_card_enrollment(customer_id, brand)

Update Customer

payload = {
                "customer_id": customer_id,
                "photo": photo,
                "phone": {
                    "phone_number": phone.phone_number,
                    "phone_country_code": phone.phone_country_code
                },
                "middle_name": middle_name,
                "identity": {
                    "country": identity.country,
                    "image": identity.image,
                    "number": identity.number,
                    "type": identity.type
                }
            }

result = customer.update_customer(payload)

Set customer Blacklist status

result = customer.set_customer_blacklist_active(customer_id, status)

Bills

bills = auth.bills()

Buy Airtime

payload = {
                "phone_number": phone_number,
                "identifier": identifier,
                "amount": amount
            }
result = bills.buy_airtime(payload)

Get airtime billers

result = bills.get_airtime_billers(country)

Get airtime history

result = bills.get_airtime_history()

Collections

collections = auth.collections()

Create Virtual account

payload = {
                "customer_id": customer_id,
                "currency": currency_type,
                "preferred_bank": preferred_bank,
                "deposit_account_id": deposit_account_id,
                "meta": {
                    "occupation": occupation,
                    "utility_bill": utility_bill_url_or_file,
                    "bank_statement": bank_statement_url_or_file,
                    "identity_type": identity_type,
                    "identity_image": identity_image_url_or_file,
                    "identity_number": identity_number,
                    "identity_issued_date": identity_issued_date,
                    "identity_expiration": identity_expiration
                }
            }

result = collections.create_virtual_account(payload)

Counterparty

counterparty = auth.counterparty()

Blacklist a counterparty

result = counterparty.blacklist(counterpartyID, status)

Get counterparty

result = counterparty.get_counterparty(counterpartyID)

Get all counterparties

result = counterparty.get_all_counterparties()

FX

fx = auth.fx()

Generate quote

payload = {
    "source_currency": "NGN",
    "target_currency": "USD",
    "amount": "500",
}
result = fx.generate_quote(payload)

Exchange currency

result = fx.exchange_currency(quote_reference)

Get FX history

result = fx.get_fx_history()

IDentity

identity = auth.identity()

Verify Identity

result = identity.verify_identity(bvn)

Institution

institution = auth.institution()

Get all institutions

params = {
                "page": "1",
                "pageSize": "10",
                "type": "bank",
                "country": "US"
            }
result = institution.get_all_institutions(params)

Resolve institution

payload = {
                "account_number": "1234567890",
                "bank_code": "ABC123"
            }
result = institution.resolve_institution(payload)

Issuing

issuing = auth.issuing()

Create a Card

payload = {
    "customer_id": "123456789",
    "type": "VIRTUAL",
    "currency": "USD",
    "auto_approve": True,
    "brand": "VISA",
    "amount": 1000,
    "card_pin": 1234
    }
result = issuing.create_card(payload)

Create business card

payload = {
                "customer_id": "123456789",
                "type": CardType.PHYSICAL.value,
                "currency": "USD",
                "auto_approve": True,
                "brand": "MASTERCARD",
                "amount": 2000,
                "card_pin": 5678,
                "name": "Business Card"
            }
result = issuing.create_business_card(payload)

Set Card pin

result = issuing.set_card_pin(cardID, pin)

Get Card

result = issuing.get_card(cardID)

Get all Cards

result = issuing.get_all_cards()

Get card transactions

params = {
                "page": "1",
                "pageSize": "10",
                "type": "purchase",
                "status": "success"
            }
result = issuing.get_card_transactions(cardID, params)

Fund Card

amount = 1000
result = issuing.fund_card(cardID, amount)

Withdraw from card

result = issuing.withdraw_from_card(cardID, amount)

Freeze card

result = issuing.freeze_card(cardID)

Unfreeze card

result = issuing.unfreeze_card(cardID)

Misc

misc = auth.misc()

Get currencies

result = misc.get_currencies()

Get countries

result = misc.get_countries()

Credit test wallet

payload = {
                "amount": "100",
                "currency": "USD"
            }
result = misc.credit_test_wallet(payload)

Transactions

transactions = auth.transactions()

Get all transactions

result = transactions.get_all_transactions()

Get a transaction

result = transactions.get_transaction("transaction_id")

Verify a collection transaction

result = transactions.verify_collection_transaction("transaction_id")

Transfers

transfers = auth.transfer()

Naira transfer

payload = {
    "account_number": "string",
    "amount": 45454545,
    "bank_code": "string",
    "currency": "NGN",
}
result = transfers.naira_transfer(payload)

DOM transfer

payload= {
    "account_number": "1234567890",
    "amount": 1000.0,
    "bank_code": "ABC",
    "currency": "USD",
    "meta": {
        "scheme": "DOM",
        "sender": {
            "first_name": "John",
            "last_name": "Doe",
            "phone_number": "1234567890",
            "address": "123 Main Street",
            "country": "USA"
        },
        "counterparty": {
            "first_name": "Jane",
            "last_name": "Smith",
            "phone_number": "9876543210",
            "address": "456 Elm Street",
            "country": "Canada",
            "identity": "12345"
        }
    },
    "reason": "Payment",
    "reference": "ABC123"
}
result = transfers.dom_transfer(payload)

Cash Pickup

payload = {
    "account_number": "1234567890",
    "amount": 1000.0,
    "bank_code": "ABC",
    "currency": "USD",
    "meta": {
        "scheme": "CASHPICKUP",
        "sender": {
            "first_name": "John",
            "last_name": "Doe",
            "phone_number": "1234567890",
            "address": "123 Main Street",
            "country": "USA"
        },
        "counterparty": {
            "first_name": "Jane",
            "last_name": "Smith",
            "phone_number": "9876543210",
            "address": "456 Elm Street",
            "country": "Canada",
            "identity": "12345"
        }
    },
    "reason": "Payment",
    "reference": "ABC123"
}
result = transfers.cash_pickup_transfer(payload)

Get a transfer

result = transfers.get_transfer("transfer_id")

Get all transfers

result = transfers.get_all_transfers()

Wallet

wallets = auth.wallet()

Get wallets

result = wallets.get_wallets()

Get wallet history

result = wallets.get_wallets_history()

Get wallet history by currency

result = wallets.get_wallets_history_by_currency("USD")

Contact Developer

Twitter: 1madvirus

LinkedIN: Edwin Beshel Ayabie

Email: edwinayabie1@gmail.com

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

maplerad-python-0.0.3.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

maplerad_python-0.0.3-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file maplerad-python-0.0.3.tar.gz.

File metadata

  • Download URL: maplerad-python-0.0.3.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.6 Linux/5.19.0-45-generic

File hashes

Hashes for maplerad-python-0.0.3.tar.gz
Algorithm Hash digest
SHA256 7d1903fc6df361dc547a6a47500c54ae1fa5782f645a8d4e6a17673bbf073e36
MD5 3097f9880a9d4ed55ee95dd7fc799c2b
BLAKE2b-256 b7a635240d70e5feae4a8dd3a654bf743db42dd0bc7df85a3ba9057c6b9b6b6c

See more details on using hashes here.

File details

Details for the file maplerad_python-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: maplerad_python-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.6 Linux/5.19.0-45-generic

File hashes

Hashes for maplerad_python-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0749d541bf2fc75458f0aa16c0e832bf825f63b104e924801b04f36e3e0bdec6
MD5 36037b3e7ceba7313b151e366bc3bf97
BLAKE2b-256 7ecb22f63bc0b939d0eba6ca6fc30fce70cd3a8a808e6ec716569563b5327906

See more details on using hashes here.

Supported by

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