Skip to main content

Cuenca API Client

Project description

Cuenca – Python client library

Transfers

Create transfer

import cuenca

cuenca.configure(sandbox=True)  # if using sandbox

transfer = cuenca.Transfer.create(
    recipient_name='Benito Juárez',
    account_number='646180157042875763',
    amount=12345,  # Mx$123.45
    descriptor='sending money',  # As it'll appear for the customer
    idempotency_key='unique string',
)

# To get updated status (estado)
transfer.refresh()

Retrieve by id

import cuenca

transfer = cuenca.Transfer.retrieve('tr_123')

Query by idempotency_key, account_number and status

Results are always returned in descending order of created_at

The methods that can be used:

  • one() - returns a single result. Raises NoResultFound if there are no results and MultipleResultsFound if there are more than one
  • first() - returns the first result or None if there aren't any
  • all() - returns a generator of all matching results. Pagination is handled automatically as you iterate over the response
  • count() - returns an integer with the count of the matching results
import cuenca
from cuenca.types import Status

# find the unique transfer using the idempotency key
transfer = cuenca.Transfer.one(idempotency_key='unique string')

# returns a generator of all succeeded transfers to the specific account
transfers = cuenca.Transfer.all(
    account_number='646180157000000004',
    status=Status.succeeded
)

# the total number of succeeded transfers
count = cuenca.Transfer.count(status=Status.succeeded)

Api Keys

Roll the ApiKey

import cuenca

# create new key and deactive old key in 60 mins
old_key, new_key = cuenca.ApiKey.roll(60)

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cuenca-0.0.2.dev0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

cuenca-0.0.2.dev0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file cuenca-0.0.2.dev0.tar.gz.

File metadata

  • Download URL: cuenca-0.0.2.dev0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.7

File hashes

Hashes for cuenca-0.0.2.dev0.tar.gz
Algorithm Hash digest
SHA256 808512a2c7e2b90acb319725676ff79246abd6f4a850ee3bd7d4a1751906dd93
MD5 cd72162be1212cf5eefce0a1dbd81147
BLAKE2b-256 29c9965779d46ee13d847ad1ccac057dd1747f94420c8f6ee6c26e713eea8a80

See more details on using hashes here.

File details

Details for the file cuenca-0.0.2.dev0-py3-none-any.whl.

File metadata

  • Download URL: cuenca-0.0.2.dev0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.7

File hashes

Hashes for cuenca-0.0.2.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 df90b223f492fb2b64745d65ea61bea68c29c06b0a6b7d8ea264b670a8aae111
MD5 94ee28e9c1758e53dc3be22eae8c6f23
BLAKE2b-256 10cef4ba2c2dae80aad3a12303a5118cfaf4e9f783db4ab28184f11fb4b4ec01

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