Dime Payments Python SDK
A typed Python client for the Dime Payments API. Works with Python 3.10+ on any platform.
from dime_payments import Client
dime = Client('your-api-token')
txn = dime.transactions.charge_card('000010', {
'amount': '49.99',
'token': 'tok_abc123',
})
print(txn.transaction_status) # "Success"
Requirements
- Python 3.10+
- A Dime API token (a Laravel Sanctum personal access token). Tokens are minted inside the
Dime application, not via this SDK, and carry abilities (e.g.
transaction:charge-card-token,customer:read) that gate which calls succeed.
Installation
pip install dime-python-sdk
Configuration
The simplest setup needs only a token:
dime = Client('your-api-token')
Point it at another environment, or use Config for full control:
from dime_payments import Client, Config
# Staging environment
dime = Client('your-api-token', 'https://staging.dimepayments.com')
# Full control
dime = Client(Config(
token='your-api-token',
base_url='https://app.dimepayments.com',
timeout=30.0, # seconds
max_retries=2, # retries 429 / 5xx / network errors with backoff
retry_base_delay=0.5,
))
The SDK sends Authorization: Bearer <token> and JSON headers on every request. Transient
failures (HTTP 429 and 5xx, network errors) are retried with exponential backoff, honoring the
Retry-After header when present.
Resources
Every resource hangs off the client as a property. The merchant sid is always passed
explicitly; remaining fields go in an attributes or filters dict. All amounts are
returned as strings to avoid float rounding.
| Property | Endpoints |
|---|---|
dime.transactions |
charge_card, charge_ach, tokenize_card, refund, void, show, list |
dime.customers |
list, show, create, update, delete |
dime.payment_methods |
list, show, create, update, delete |
dime.merchants |
list, show, create, update, get_form_link |
dime.addresses |
list, show, create, update, delete |
dime.deposits |
list, list_with_transactions, show |
dime.recurring_payments |
list, show, create, edit, pause, cancel, activate, delete |
dime.invoices |
list, show, create, update, delete, send, mark_sent, void, duplicate, pay, get_link, list_items, add_line_item, update_line_item, delete_line_item, create_item |
dime.recurring_invoices |
list, show, create, cancel |
Transactions
# Charge a stored token
txn = dime.transactions.charge_card('000010', {
'amount': '100.00',
'token': 'tok_abc123',
'email': 'customer@example.com',
})
# Charge raw card details (merchant must be PCI compliant)
txn = dime.transactions.charge_card('000010', {
'amount': '100.00',
'cardholder_name': 'John Doe',
'card_number': '4111111111111111',
'expiration_date': '01/2027',
'cvv': '123',
})
# ACH
txn = dime.transactions.charge_ach('000010', {
'routing_number': '123456789',
'account_number': '9876543210',
'account_type': 'Checking',
'account_name': 'John Doe',
'amount': '75.00',
})
# Tokenize without charging
result = dime.transactions.tokenize_card('000010', {
'cardholder_name': 'John Doe',
'card_number': '4111111111111111',
'expiration_date': '01/2027',
})
print(result.token)
# Refund / void
dime.transactions.refund('000010', {'amount': '25.00', 'transaction_info_id': 123456})
dime.transactions.void('000010', 'CC', 123456)
# Read
txn = dime.transactions.show('000010', {'transaction_info_id': 123456})
Customers, payment methods, addresses
customer = dime.customers.create('000010', {
'first_name': 'Jane',
'last_name': 'Doe',
'email': 'jane@example.com',
})
pm = dime.payment_methods.create('000010', {
'uuid': customer.uuid,
'type': 'cc',
'cc_name_on_card': 'Jane Doe',
'cc_number': '4111111111111111',
'cc_expiration_date': '01/2027',
'cc_brand': 'Visa',
'default': True,
})
address = dime.addresses.create('000010', customer.uuid, {
'recipient': 'Jane Doe',
'line_one': '123 Main St',
'city': 'Atlanta',
'state': 'GA',
'zip': '30301',
})
Recurring payments
rp = dime.recurring_payments.create('000010', {
'name': 'Monthly donation',
'amount': '25.00',
'start_date': '2026-07-01 00:00:00',
'recurrence_schedule': 'Monthly',
'payment_method': pm.id,
'customer_uuid': customer.uuid,
})
dime.recurring_payments.pause('000010', rp.id, '2026-09-01 00:00:00')
dime.recurring_payments.activate('000010', rp.id)
dime.recurring_payments.cancel('000010', rp.id)
Invoices
Invoices are scoped to a merchant sid and built from line items that each reference a merchant
item (a fund or designation). Draft invoices can be edited; once sent they are locked.
Identify the customer with customer_uuid — the same uuid every other resource uses, and the only
identifier the customer endpoints return. customer_id is still accepted for older integrations.
# Look up (or create) the merchant items a line can reference
items = dime.invoices.list_items('000010')
item = dime.invoices.create_item('000010', {
'name': 'Consulting',
'description': 'Professional services',
'price': 125,
'tax_deductible': False,
})
# Create a draft invoice with one or more line items
invoice = dime.invoices.create('000010', {
'customer_uuid': customer.uuid,
'customer_name': 'Jane Doe',
'customer_email': 'jane@example.com',
'payment_terms': 'net_15', # due_on_receipt | net_15 | net_30 | net_60
'lines': [
{'item_id': item.id, 'name': 'Consulting', 'description': '2 hours',
'quantity': 2, 'unit_price': 125},
],
})
# Line-item edits return the refreshed invoice, with totals recalculated
invoice = dime.invoices.add_line_item('000010', invoice.id, {
'item_id': item.id, 'name': 'Setup', 'quantity': 1, 'unit_price': 50,
})
invoice = dime.invoices.update_line_item('000010', invoice.id, invoice.items[0].id, {'quantity': 3})
invoice = dime.invoices.delete_line_item('000010', invoice.id, invoice.items[0].id)
# Email it to the customer, or activate the pay link without emailing
dime.invoices.send('000010', invoice.id)
dime.invoices.mark_sent('000010', invoice.id)
# Share the public pay link
link = dime.invoices.get_link('000010', invoice.id)
print(link.public_url)
# Take a merchant-initiated payment. payment_type is required; omit amount to
# pay the full balance.
dime.invoices.pay('000010', invoice.id, {
'payment_type': 'cc', # cc | ach
'token': pm.token,
'amount': 125,
})
dime.invoices.void('000010', invoice.id)
dime.invoices.duplicate('000010', invoice.id)
Making the customer cover processing fees
Set cover_fee_required and the customer must pay the processing fee — it is not an optional
checkbox at checkout. The fee is not a line item and is not part of total: the merchant is
still owed total, and the fee is added on top of whatever the customer pays.
Card and ACH rates differ, so the charge depends on how the customer pays. cover_fee_quote gives
you both, quoted against the outstanding balance:
invoice = dime.invoices.create('000010', {
'customer_uuid': customer.uuid,
'customer_name': 'Jane Doe',
'customer_email': 'jane@example.com',
'payment_terms': 'net_15',
'cover_fee_required': True, # omit to inherit the merchant's invoice setting
'lines': [
{'item_id': item.id, 'name': 'Consulting', 'quantity': 1, 'unit_price': 100},
],
})
invoice.total # '100.00' — what the merchant is owed
invoice.cover_fee_quote.cc_total # '104.32' — charged if they pay by card
invoice.cover_fee_quote.ach_total # '101.26' — charged if they pay by bank
The card figure is the higher of the two and is what the invoice and its emails lead with. A partial
payment re-quotes the fee against the partial amount, so treat the quote as "settling in full today"
rather than a fixed charge. cover_fee_quote is None when no fee is required.
To reconcile a payment, amount was credited to the invoice and cover_fee was charged on top:
payment = invoice.payments[0]
payment.amount # '100.00' — applied to the balance
payment.cover_fee # '4.32' — the fee the customer also paid
# The customer was charged amount + cover_fee.
pay() behaves the same way: the fee for the payment_type you pass is added to amount, so the
card or bank account is debited more than the invoice is credited.
Recurring invoices
Templates that emit an invoice on a schedule. cover_fee_required is copied onto every invoice a
template generates.
ri = dime.recurring_invoices.create('000010', {
'customer_uuid': customer.uuid,
'payment_terms': 'net_30',
'recurring_frequency': 'Monthly', # Weekly | Biweekly | FirstFifteenth | Monthly | Yearly
'recurring_start_date': '2026-09-01',
'cover_fee_required': True, # optional
'lines': [
{'item_id': item.id, 'name': 'Retainer', 'quantity': 1, 'unit_price': 500},
],
})
print(ri.next_run_date, ri.upcoming_run_dates)
dime.recurring_invoices.cancel('000010', ri.id)
Pagination
List endpoints return a CursorPage. Iterate one page, walk pages manually, or stream every
item across all pages with auto_paging():
page = dime.transactions.list('000010', {
'start_date': '2026-01-01 00:00:00',
'end_date': '2026-01-31 23:59:59',
})
# First page only
for txn in page:
print(txn.amount)
# Next page manually
if page.has_more():
next_page = page.next()
# Every transaction across every page (fetches lazily)
for txn in page.auto_paging():
print(txn.transaction_number)
Error handling
Every failure raises a DimeException subclass. Catch the base type, or a specific one:
from dime_payments import (
DimeException,
ValidationException,
RateLimitException,
)
import time
try:
dime.transactions.charge_card('000010', {'amount': '0'})
except ValidationException as e:
e.get_errors() # {'data.amount': ['must be greater than 0']}
e.first_error()
except RateLimitException as e:
wait = e.get_retry_after() or 1
time.sleep(wait)
except DimeException as e:
e.get_status_code() # HTTP status
e.get_response_body() # decoded API body
| Exception | When |
|---|---|
ValidationException |
HTTP 400/422 with field errors |
AuthenticationException |
HTTP 401 (missing/invalid token) |
PermissionDeniedException |
HTTP 403 (belongs-to-company guard) |
NotFoundException |
HTTP 404 |
RateLimitException |
HTTP 429 (carries Retry-After) |
ServerException |
HTTP 5xx |
ConnectionException |
No HTTP response (DNS, timeout, network error) |
ApiException |
Any other non-2xx |
Notes
- GET requests carry a JSON body. The Dime API expects read parameters in the request body
even for
GETendpoints; the SDK handles this transparently. Pointbase_urlat anhttps://origin — anhttp://URL that 301-redirects tohttpswill have its request body dropped by the redirect, which surfaces as a403"You do not have access to this company." from the API. - No API versioning. Endpoints live under
/apiwith no version prefix.
Development
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest # run tests
License
MIT. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dime_python_sdk-1.3.0.tar.gz.
File metadata
- Download URL: dime_python_sdk-1.3.0.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44b37f43652fc0a52e0e552a6b10e699465de7ad1234753d083dd10ce737ff89
|
|
| MD5 |
0fb5e262a3be569c3c48fe4f759ffea1
|
|
| BLAKE2b-256 |
86c4c6520dc5cf889517ad07d233e2e5e893355abcb01df96917b10c547d6d96
|
Provenance
The following attestation bundles were made for dime_python_sdk-1.3.0.tar.gz:
Publisher:
publish.yml on dime-technology/dime-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dime_python_sdk-1.3.0.tar.gz -
Subject digest:
44b37f43652fc0a52e0e552a6b10e699465de7ad1234753d083dd10ce737ff89 - Sigstore transparency entry: 2361443951
- Sigstore integration time:
-
Permalink:
dime-technology/dime-python-sdk@dff3d2ec93082afe70c4d08ab32a3eca4b0aab0f -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/dime-technology
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dff3d2ec93082afe70c4d08ab32a3eca4b0aab0f -
Trigger Event:
release
-
Statement type:
File details
Details for the file dime_python_sdk-1.3.0-py3-none-any.whl.
File metadata
- Download URL: dime_python_sdk-1.3.0-py3-none-any.whl
- Upload date:
- Size: 39.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
526c7524b16eb65763226490940625604d895f42960319ae2ab0b4b062867523
|
|
| MD5 |
1a828438be138f33fc01bcd9920af034
|
|
| BLAKE2b-256 |
e5dfe79d81d826bb525ee389dad83a00110216476201bd7bcc599a31ce38a0bb
|
Provenance
The following attestation bundles were made for dime_python_sdk-1.3.0-py3-none-any.whl:
Publisher:
publish.yml on dime-technology/dime-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dime_python_sdk-1.3.0-py3-none-any.whl -
Subject digest:
526c7524b16eb65763226490940625604d895f42960319ae2ab0b4b062867523 - Sigstore transparency entry: 2361444044
- Sigstore integration time:
-
Permalink:
dime-technology/dime-python-sdk@dff3d2ec93082afe70c4d08ab32a3eca4b0aab0f -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/dime-technology
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dff3d2ec93082afe70c4d08ab32a3eca4b0aab0f -
Trigger Event:
release
-
Statement type: