Skip to main content

Python software developer kit for Customates API

Project description

Customates Python SDK

Welcome to Customate's Python SDK repository.



More about customate

Customate is an API driven embedded payments platform that safeguards all funds, creates dedicated customer wallets and escrow wallets instantly, verifies your customers and enables you to create automated payment schedules to handle any incoming or outgoing payments.

Read more by visiting our main website



Supported Python Versions

This library supports the following Python implementations:

  • Python 3.6
  • Python 3.7
  • Python 3.8
  • Python 3.9
  • Python 3.10


Installation

Using pip:

pip install customate-sdk

This automatically installs customate v1.0 (or later).

Add API credentials to your settings:

#API keys for Customate
CUSTOMATE_KEY = ***Your public key supplied by Customate***
CUSTOMATE_SECRET_KEY = ***Your secret key supplied by Customate***
CUSTOMATE_URL= ***API URL***
CUSTOMATE_VERSION= ***API Version***


Useage

Create Customate client:

#Import settings
CUSTOMATE_KEY = <CUSTOMATE_KEY>
CUSTOMATE_SECRET_KEY = <CUSTOMATE_SECRET_KEY>
CUSTOMATE_URL= <CUSTOMATE_URL>
CUSTOMATE_VERSION= <CUSTOMATE_VERSION>

from customate.rest import Client
client = Client(
    api_key = CUSTOMATE_KEY,
    secret=CUSTOMATE_SECRET_KEY,
    url=CUSTOMATE_URL,
    version=CUSTOMATE_VERSION
    )

Testing our client:

Note: This is our API State endpoint.

status_response = client.status.get()
print(status_response.status_code)


Endpoints

Profile Management

Note: Please see Profile Management API Documentation

Create:

data = {
    "type": "personal",
    "first_name": "Jack",
    "middle_name": "Arthur",
    "last_name": "Smith",
    "email": "smith@customate.com",
    "phone_number": "+12126712234",
    "birth_date": "1990-02-28",
    "title": "mr",
    "gender": "male",
    "address": {
      "line_1": "Haziko",
      "line_2": "Boggs Road",
      "line_3": "",
      "city": "Tranent",
      "locality": "East Lothian",
      "postcode": "EH34 5AZ",
      "country": "GB"
    },
    "metadata": {
      "sample_internal_id": "998440c3-e046-450d-96bd-28b4c1cff11c"
    }
}
profile_response = client.profile.post(
    data=data
)
print(profile_response.status_code)
profile_id = profile_response['json']["id"]

Get:

#Returns all profiles
profile_response = client.profile.get()
print(profile_response.status_code)

#Returns all profiles with pagination
profile_response = client.profile.get(
    params = {'page_size':25,'page_number':page_number}
)
print(profile_response.status_code)

#Passing a profile ID will retrieve one record
profile_response = client.profile.get(
    profile_id=profile_id
)
print(profile_response.status_code)

Verify:

#Force verifies your profile
profile_response = client.verification.post(
    profile_id = profile_id,
    params={"force_verification": 'true'}
)
print(profile_response.status_code)

Update:

data = {
    "type": "personal",
    "first_name": "Jack",
    "middle_name": "Arthur",
    "last_name": "Smith",
    "email": "smith@customate.com",
    "phone_number": "+12126712234",
    "birth_date": "1990-02-28",
    "title": "mr",
    "gender": "male",
    "address": {
      "line_1": "Hazikos",
      "line_2": "Boggs Road",
      "line_3": "",
      "city": "Tranent",
      "locality": "East Lothian",
      "postcode": "EH34 5AZ",
      "country": "GB"
    },
    "metadata": {
      "sample_internal_id": "998440c3-e046-450d-96bd-28b4c1cff11c"
    }
}
profile_response = client.profile.put(
    data=data,
    profile_id=profile_id
)
print(profile_response.status_code)

Deactivate

profile_response = client.profile.delete(
    profile_id=profile_id
)
print(profile_response.status_code)


Wallet Management

Note: Please see Wallet Management API Documentation

Get:

#Returns all wallets for profile
wallet_response = client.profile.get(
    profile_id=profile_id
)
print(wallet_response.status_code)

#Returns all wallets for profile with pagination
wallet_response = client.profile.get(
    profile_id=profile_id,
    params = {'page_size':25,'page_number':page_number}
)
print(wallet_response.status_code)

#Passing a wallet ID will retrieve one record
wallet_response = client.profile.get(
    profile_id=profile_id,
    domain_id = wallet_id
)
print(wallet_response.status_code)


Schedule Management

Note: Please see Schedule Management API Documentation

Create:

data = {
    "title": "Sample Weekly Schedule",
    "currency": "GBP",
    "purpose": "pay",
    "period": "one_time",
    "number_of_payments": 10,
    "regular_payment_start_date": "2020-06-23",
    "regular_payment_amount": 22000,
    "deposit_payment_date": "2020-06-22",
    "deposit_payment_amount": 1000,
    "description": "Apartment rental agreement 121",
    "metadata": {},
    "funding_source_id": "498752c7-57ba-42cd-88d0-81e1744e22b0",
    "backup_funding_source_id": "f4653129-a50c-42f6-b574-8bad264578e5",
    "payee_id": "cfcd44ad-12d5-4362-a669-2da49b9c6c52"
}
schedule_response = client.schedule.post(
    profile_id=profile_id,
    data=data
)
print(schedule_response.status_code)
schedule_id = schedule_response['json']["id"]

Create DD to wallet schedule:

data = {
    "title": "Sample Weekly Schedule",
    "purpose": "pay",
    "period": "one_time",
    "number_of_payments": 10,
    "regular_payment_start_date": "2020-06-23",
    "regular_payment_amount": 22000,
    "deposit_payment_date": "2020-06-22",
    "deposit_payment_amount": 1000,
    "description": "Apartment rental agreement 121",
    "metadata": {},
    "funding_source_id": "498752c7-57ba-42cd-88d0-81e1744e22b0",
    "payee_id": "cfcd44ad-12d5-4362-a669-2da49b9c6c52"
}
schedule_response = client.direct_debit_to_wallet_schedules.post(
    profile_id=profile_id,
    data=data
)
print(schedule_response.status_code)
schedule_id = schedule_response['json']["id"]

Pay overdue payments:

schedule_response = client.schedule.post(
    profile_id=profile_id,
    domain_id=schedule_id,
    domain_action=overdue_processing
)
print(schedule_response.status_code)
schedule_id = schedule_response['json']["id"]

Get:

#Returns all schedules
schedule_response = client.schedule.get(
    profile_id=profile_id,
)
print(schedule_response.status_code)

#Returns all schedules with pagination
schedule_response = client.schedule.get(
    profile_id=profile_id,
    params = {'page_size':25,'page_number':page_number}
)
print(schedule_response.status_code)

#Passing a schedule ID will retrieve one record
schedule_response = client.schedule.get(
    profile_id=profile_id,
    domain_id=schedule_id
)
print(schedule_response.status_code)

Update:

data = {
    "title": "Sample Weekly Schedule",
    "number_of_payments": 10,
    "regular_payment_amount": 22000,
    "description": "Apartment rental agreement 121",
    "metadata": {}
}
schedule_response = client.schedule.put(
    data=data,
    profile_id=profile_id,
    domain_id=schedule_id
)
print(schedule_response.status_code)

Deactivate

schedule_response = client.schedule.delete(
    profile_id=profile_id,
    domain_id=schedule_id
)
print(schedule_response.status_code)


Funding Source Management

Note: Please see Funding Source Management API Documentation

Create:

data = {
    "title": "Sample DirectDebit Source",
    "currency": "GBP",
    "type": "direct_debit",
    "data": {
      "ownership": "single",
      "payer": {
        "full_name": "Jack Smith"
      },
      "account": {
        "sort_code": "040004",
        "account_number": "37618166"
      }
    }
  }
funding_source_response = client.funding_source.post(
    profile_id=profile_id,
    data=data
)
print(funding_source_response.status_code)
funding_source_id = funding_source_response['json']["id"]

Create DD Funding Source:

data = {
    "title": "Sample Direct Debit Source",
    "data": {
      "ownership": "single",
      "payer": {
        "full_name": "Jack Smith"
      },
      "account": {
        "sort_code": "040004",
        "account_number": "37618166"
      }
    }
}
funding_source_response = client.direct_debit_funding_source.post(
    profile_id=profile_id,
    data=data
)
print(funding_source_response.status_code)
funding_source_id = funding_source_response['json']["id"]

Get:

#Returns all funding sources
funding_source_response = client.funding_source.get(
    profile_id=profile_id,
)
print(funding_source_response.status_code)

#Returns all funding sources with pagination
funding_source_response = client.funding_source.get(
    profile_id=profile_id,
    params = {'page_size':25,'page_number':page_number}
)
print(funding_source_response.status_code)

#Passing a funding source ID will retrieve one record
funding_source_response = client.funding_source.get(
    profile_id=profile_id,
    domain_id=funding_source_id
)
print(funding_source_response.status_code)

Validate:

#Check the supplied funding source and bank details are valid

data = {
    "title": "Personal DirectDebit",
    "payer": {
      "first_name": "Jack",
      "last_name": "Smith",
      "birth_date": "1980-01-01",
      "email": "joe@email.com",
      "address": {
        "address_line_1": "25 Buckingham Rd",
        "city": "Thorpe",
        "postcode": "YO25 2YH",
        "country": "United Kingdom"
      }
    }
}
funding_source_response = client.funding_source.put(
    data=data,
    profile_id=profile_id,
    domain_id=funding_source_id,
    domain_action="validate_bank_owner"
)
print(funding_source_response.status_code)

Update:

data = {
    "title": "Personal DirectDebit",
    "payer": {
      "email": "joe@email.com",
      "address": {
        "address_line_1": "25 Buckingham Rd",
        "city": "Thorpe",
        "postcode": "YO25 2YH",
        "country": "United Kingdom"
      }
    }
}
funding_source_response = client.funding_source.put(
    data=data,
    profile_id=profile_id,
    domain_id=funding_source_id
)
print(funding_source_response.status_code)

Deactivate

funding_source_response = client.funding_source.delete(
    profile_id=profile_id,
    domain_id=funding_source_id
)
print(funding_source_response.status_code)


Open Banking Mandates

Note: Please see Open Banking Management API Documentation

Get:

#Returns all open banking mandate providers
open_banking_response = client.open_banking_mandate_providers.get()
print(open_banking_response.status_code)

Create:

data = {
    "provider_id": "ob-natwest-vrp-sandbox",
    "country": "GB",
    "currency": "GBP",
    "payer_name": "Mr A Payer",
    "payer_email": "smith@customate.com",
    "beneficiary_name": "Mrs A Receiver",
    "maximum_individual_amount": 10000,
    "maximum_payment_amount": 20000,
    "maximum_payment_period": "daily",
    "reference": "Tenancy agreement 1",
    "redirect_url": "https://www.yoursite.com/mandates",
    "valid_from_date": "2023-01-01",
    "valid_to_date": "2024-12-31"
}
open_banking_response = client.open_banking_to_wallet_mandates.post(
    profile_id=profile_id,
    data=data
)
print(open_banking_response.status_code)
open_banking_id = open_banking_response['json']["id"]

Get:

#Returns all open banking mandates
open_banking_response = client.open_banking_mandates.get(
    profile_id=profile_id,
)
print(open_banking_response.status_code)

#Returns all open banking with pagination
open_banking_response = client.open_banking_mandates.get(
    profile_id=profile_id,
    params = {'page_size':25,'page_number':page_number}
)
print(open_banking_response.status_code)

#Passing a open banking mandate ID will retrieve one record
open_banking_response = client.open_banking_mandates.get(
    profile_id=profile_id,
    domain_id=open_banking_mandate_id
)
print(open_banking_response.status_code)

Deactivate

open_banking_response = client.open_banking_mandates.delete(
    profile_id=profile_id,
    domain_id=open_banking_mandate_id
)
print(open_banking_response.status_code)


Payee Management

Note: Please see Payee Management API Documentation

Create:

data = {
    "title": "Sample Bank Ltd.",
    "type": "bank_account",
    "currency": "GBP",
    "data": {
      "recipient": {
        "full_name": "",
        "email": "",
        "address": {
          "line_1": "Haziko",
          "line_2": "Boggs Road",
          "line_3": "",
          "city": "Tranent",
          "locality": "East Lothian",
          "postcode": "EH34 5AZ",
          "country": "GB"
        }
      },
      "account": {
        "iban": "SAPYGB2L40000031000001",
        "sort_code": "040004",
        "account_number": "37618166"
      }
    }
}
payee_response = client.payee.post(
    profile_id=profile_id,
    data=data
)
print(payee_response.status_code)
payee_id = payee_response['json']["id"]

Get:

#Returns all payees
payee_response = client.payee.get(
    profile_id=profile_id,
)
print(payee_response.status_code)

#Returns all payees with pagination
payee_response = client.payee.get(
    profile_id=profile_id,
    params = {'page_size':25,'page_number':page_number}
)
print(payee_response.status_code)

#Passing a payee ID will retrieve one record
payee_response = client.payee.get(
    profile_id=profile_id,
    domain_id=payee_id
)
print(payee_response.status_code)

Validate:

#Check the supplied payee and bank details are valid

data = {
    "title": "Personal DirectDebit",
    "recipient": {
      "first_name": "Jack",
      "last_name": "Smith",
      "birth_date": "1980-01-01",
      "email": "joe@email.com",
      "address": {
        "address_line_1": "25 Buckingham Rd",
        "city": "Thorpe",
        "postcode": "YO25 2YH",
        "country": "United Kingdom"
      }
    }
}
payee_response = client.payee.put(
    data=data,
    profile_id=profile_id,
    domain_id=payee_id,
    domain_action="validate_bank_owner"
)
print(payee_response.status_code)

Update:

data = {
    "title": "Payee",
    "recipient": {
      "email": "joe@email.com",
      "address": {
        "address_line_1": "25 Buckingham Rd",
        "city": "Thorpe",
        "postcode": "YO25 2YH",
        "country": "United Kingdom"
      }
    }
}
payee_response = client.payee.put(
    data=data,
    profile_id=profile_id,
    domain_id=payee_id
)
print(payee_response.status_code)

Deactivate

payee_response = client.payee.delete(
    profile_id=profile_id,
    domain_id=payee_id
)
print(payee_response.status_code)


Payment Management

Note: Please see Payment Management API Documentation

Create:

data = {
    "amount": 1200,
    "description": "Deposit for apartment 121",
    "execution_date": "2022-04-12",
    "metadata": {
      "sample_internal_id": "d2f148cf-901c-4fee-8792-21016da755a0"
    },
    "funding_source_id": "12d24482-fbb1-4d9d-b41d-0d506ea4bc9b",
    "payee_id": "fdbf7995-84f6-4c28-b5e8-9ebec78c8edc"
}
payment_response = client.payment.post(
    profile_id=profile_id,
    data=data
)
print(payment_response.status_code)
payment_id = payment_response['json']["id"]

Create wallet to wallet payment:

data = {
    "amount": 1200,
    "description": "Deposit for apartment 121",
    "currency": "GBP",
    "execution_date": "2022-04-12",
    "metadata": {
      "sample_internal_id": "d2f148cf-901c-4fee-8792-21016da755a0"
    },
    "payee_id": "fdbf7995-84f6-4c28-b5e8-9ebec78c8edc"
}
payment_response = client.wallet_to_wallet_payment.post(
    profile_id=profile_id,
    data=data
)
print(payment_response.status_code)
payment_id = payment_response['json']["id"]

Create DD to wallet payment:

data = {
    "amount": 1200,
    "description": "Deposit for apartment 121",
    "execution_date": "2022-04-12",
    "metadata": {
      "sample_internal_id": "d2f148cf-901c-4fee-8792-21016da755a0"
    },
    "funding_source_id": "12d24482-fbb1-4d9d-b41d-0d506ea4bc9b",
    "payee_id": "fdbf7995-84f6-4c28-b5e8-9ebec78c8edc"
}
payment_response = client.direct_debit_to_wallet_payment.post(
    profile_id=profile_id,
    data=data
)
print(payment_response.status_code)
payment_id = payment_response['json']["id"]

Create wallet to bank account payment:

data = {
    "amount": 1200,
    "description": "Deposit for apartment 121",
    "currency": "GBP",
    "execution_date": "2022-04-12",
    "metadata": {
      "sample_internal_id": "d2f148cf-901c-4fee-8792-21016da755a0"
    },
    "payee_id": "fdbf7995-84f6-4c28-b5e8-9ebec78c8edc"
}
payment_response = client.wallet_to_bank_account_payment.post(
    profile_id=profile_id,
    data=data
)
print(payment_response.status_code)
payment_id = payment_response['json']["id"]

Create open banking to wallet payment:

data = {
    "amount": 10000,
    "description": "Deposit for Flat 1",
    "country": "GB",
    "currency": "GBP",
    "redirect_url": "https://www.yoursite.com/payments",
    "metadata": {
      "client_internal_id": "d2f148cf-901c-4fee-8792-21016da755a0"
    },
    "provider_id": "mock-payments-gb-redirect",
    "payer_iban": "ES13ABBY09012606978360",
    "payer_name": "Mr A Payer",
    "beneficiary": "Mrs A Receiver"
}
payment_response = client.open_banking_to_wallet_payment.post(
    profile_id=profile_id,
    data=data
)
print(payment_response.status_code)
payment_id = payment_response['json']["id"]

Create (variable) open banking to mandate payment:

data = {
    "amount": 10000,
    "description": "Deposit for Flat 1",
    "currency": "GBP",
    "metadata": {
      "sample_internal_id": "d2f148cf-901c-4fee-8792-21016da755a0"
    },
    "beneficiary_name": "Mrs A Receiver",
    "mandate_id": "ebfd76ac-6fc4-4661-9719-ff7bb3cc0360"
}

payment_response = client.open_banking_to_wallet_mandate_payment.post(
    profile_id=profile_id,
    data=data
)
print(payment_response.status_code)
payment_id = payment_response['json']["id"]

Create service payment:

data = {
    "amount": 1200,
    "scenario": "IncomingBankTransfer",
    "description": "Deposit for apartment 121",
    "payee_id": "fdbf7995-84f6-4c28-b5e8-9ebec78c8edc"
}
payment_response = client.service_payment.post(
    profile_id=profile_id,
    data=data
)
print(payment_response.status_code)
payment_id = payment_response['json']["id"]

Get:

#Returns all payments
payment_response = client.payment.get(
    profile_id=profile_id,
)
print(payment_response.status_code)

#Returns all payments with pagination
payment_response = client.payment.get(
    profile_id=profile_id,
    params = {'page_size':25,'page_number':page_number}
)
print(payment_response.status_code)

#Passing a payments ID will retrieve one record
payment_response = client.payment.get(
    profile_id=profile_id,
    domain_id=payment_id
)
print(payment_response.status_code)

Get open banking providers (for single payment):

#Returns all banking providers
payment_response = client.open_banking_provider.get()
print(payment_response.status_code)

#Returns all banking providers for defined country and currency
payment_response = client.open_banking_provider.get(
    params = {'currency':'GBP','country':'UK'}
)
print(payment_response.status_code)


Get non-processing dates:

#Returns all non-processing dates
payment_response = client.non_processing_date.get()
print(payment_response.status_code)

#Returns all non-processing dates with pagination
payment_response = client.non_processing_date.get(
    params = {'page_size':25,'page_number':page_number}
)
print(payment_response.status_code)



Transaction Management

Note: Please see Transaction Management API Documentation

Get:

#Returns all transactions
transaction_response = client.transaction.get(
    profile_id=profile_id,
)
print(transaction_response.status_code)

#Returns all transactions with pagination
transaction_response = client.transaction.get(
    profile_id=profile_id,
    params = {'page_size':25,'page_number':page_number}
)
print(transaction_response.status_code)

#Returns all transactions with pagination and filtering and sorting
transaction_response = client.transaction.get(
    profile_id=profile_id,
    params = {
        'page_size':10,
        'page_number':1, 
        "sort": "-completion_date",
        "filters": {
            "amount.lte": 750,
            "creation_date.gte": "1564032580000",
            "creation_date.lte": "1564032592299",
            "completion_date.gte":"1564032580000",
            "completion_date.lte":"1564032592299",
        }}
)
print(transaction_response.status_code)

#Passing a transaction ID will retrieve one record
transaction_response = client.transaction.get(
    profile_id=profile_id,
    domain_id=transaction_id
)
print(transaction_response.status_code)


Webhook Management

Note: Please see Webhook Management API Documentation

Create:

data = {
    "callback_url": "https://your-callback-url.com/webhook",
}
webhook_response = client.webhook.post(
    data=data
)
print(webhook_response.status_code)
webhook_id = webhook_response['json']["id"]

Get:

#Returns all webhooks
webhook_response = client.webhook.get()
print(webhook_response.status_code)

#Returns all webhooks with pagination
webhook_response = client.webhook.get(
    params = {'page_size':25,'page_number':page_number}
)
print(webhook_response.status_code)

#Passing a webhook ID will retrieve one record
webhook_response = client.webhook.get(
    domain_id=webhook_id
)
print(webhook_response.status_code)

Update:

data = {
    "callback_url": "https://your-callback-url.com/webhooks",
}
webhook_response = client.webhook.put(
    data=data,
    domain_id=webhook_id
)
print(webhook_response.status_code)

Deactivate

webhook_response = client.webhook.delete(
    domain_id=webhook_id
)
print(webhook_response.status_code)


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

customate-sdk-0.0.10.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

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

customate_sdk-0.0.10-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file customate-sdk-0.0.10.tar.gz.

File metadata

  • Download URL: customate-sdk-0.0.10.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for customate-sdk-0.0.10.tar.gz
Algorithm Hash digest
SHA256 2154f22e3bb026885d3322bb1cd18c3fb9d72632ac90e0a8d0657f16354e2306
MD5 fd461c166a620ce2cc9fc85ff8d464dc
BLAKE2b-256 290d0107e1ff4c592cee300d1fc57fdcb4e64e196468a43effb32583a24cb43e

See more details on using hashes here.

File details

Details for the file customate_sdk-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: customate_sdk-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for customate_sdk-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 e275bf073d686b8ac34e92564c37a116c6b310b5ae0da9c7ca8163e4d6c5c055
MD5 990a260f949c4ed30e7470f32f5be820
BLAKE2b-256 7e6d7ffd4fe811bca0135899e5dc0c46b8a07290d5da222f42594d0254adda80

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