DOCS

New!

/

10 minute read

December 2, 2019

Python SDK (Beta)

Note
This feature is currently in beta and subject to change. To learn more about the Beta program for this feature, contact your Marqeta representative.

The Marqeta Software Developer Kit (SDK) for Python provides easy access to the Marqeta Core API from your Python application. The Python SDK is built on top of the Core API, providing wrappers for the REST API endpoints.

What you can do with the Python SDK

You can use the SDK library to perform common programming tasks, including:

  • Build apps using your access tokens for the sandbox environment.

  • Use Python methods for easier, secure authentication.

  • Create, retrieve, and update objects and collections.

  • Access resource collections as properties of a client object.

  • Search for specific objects.

  • Call Python methods to interact with the Core API endpoints.

  • Handle errors.

How to get the SDK

To install the SDK, go to the marqeta-python repository on GitHub. See the README for requirements, dependencies, and installation.

Contribute to the SDK

The SDK is open source. Feel free to contribute on GitHub.

Python SDK basics

This section describes the basics of how to use the SDK, including configuration and basic operations. For a list of objects, see Resources. For usage specifics for each object, see Using the Python SDK.

Configuring the client

Create an account on marqeta.com to retrieve your application token and access token for the sandbox. For production, you will need to change base_url. To configure your client object:

from the marqeta import Client

base_url = "https://sandbox-api.marqeta.com/v3"
application_token = "MY_APPLICATION_TOKEN"
access_token = "MY_ACCESS_TOKEN"
timeout = 60 # seconds

client = Client(base_url, application_token, access_token, timeout)

Is this helpful?

When specifying your base url, include the /v3 version prefix.

Accessing resources

Access resource collections of the Core API as properties of the client object. For example, to access the /users endpoint:

client.users

Is this helpful?

Nested resource collections are properties of the parent collection. For example, to access the /directdeposits/transitions/{token} endpoint:

client.direct_deposits(token).transitions

Is this helpful?

Listing objects

Depending on your use case, there are several ways to retrieve collections of objects. The Python library handles pagination for you, unless you request a specific page of data. To retrieve every object in a collection, call list(limit=None) on the resource:

users = client.users.list(limit=None)

Is this helpful?

If a value is specified for limit, objects up to that number are returned. For most cases the default value of limit is None; however, for client.users.list() and client.card_products.list() the default values are 1000 and 25 respectively.

The stream() method returns a generator that efficiently downloads subsequent pages as needed, rather than download all objects into memory at once:

for user in client.users.stream():
    pass

Is this helpful?

To retrieve a single page, call the page() method and specify values for start_index and count:

page = client.users.page(start_index=0, count=5)
users = page.data

Is this helpful?

You can specify a sort field for the results by passing a params dictionary:

client.users.list(params={"sort_by": "-lastModifiedTime"})

Is this helpful?

For details, see Sorting and pagination.

Specifying additional query parameters

Most methods support additional query parameters as a params dictionary. The keys and values are the same as those described for each endpoint in the Core API Reference:

client.cards.find_show_pan(card_token, params={"show_cvv_number": True})

Is this helpful?

Finding a specific objects

To find a specific object, call the find() method on a resource collection, passing in the object’s token:

user = client.users.find(token)

Is this helpful?

Creating objects

To create an object, call the create() method of a resource collection, passing in data as a Python dict:

data = {
    "first_name": "Sarah"
}
created_user = client.users.create(data)

Is this helpful?

Updating objects

To update an object, call the save() method of a resource collection, passing in the object’s token and a dictionary containing the fields to update:

fields_to_update = {
    "first_name": "Updated Value"
}
updated_user = client.users.save(user_token, fields_to_update)

Is this helpful?

Handling errors

The SDK generates a MarqetaError exception for unsuccessful requests:

from marqeta import Client
from marqeta.errors import MarqetaError
from requests.exceptions import RequestException

try:
    user = client.users.find(token)
except MarqetaError as error:
    print(error.code)
except RequestException as error:
    print(error)

Is this helpful?

The exception’s code value in the JSON response contains the error returned by the Core API. For more information, see Errors.

Resources

The Marqeta Python Library supports the following endpoints:

Endpoint Python object

client.account_holder_groups

client.auth_controls

client.auth_controls.exempt_mids

client.auto_reloads

client.balances

client.bulk_issuances

client.businesses

client.businesses(business_token).transitions

client.card_products

client.cards

client.cards(token).transitions

client.commando_modes

client.commando_modes(token).transitions

client.digital_wallet_tokens

client.digital_wallet_tokens(token).transitions

client.direct_deposits

client.direct_deposits(token).transitions

client.direct_deposits.accounts

client.fees

client.fee_transfers

client.funding_sources.addresses

client.funding_sources.ach

client.funding_sources.payment_card

client.funding_sources.program_gateway

client.funding_sources.program

client.gpa_orders

client.gpa_orders.unloads

client.kyc

client.mcc_groups

client.msa_orders

client.msa_orders.unloads

client.offer_orders

client.program_transfers

client.program_transfers.types

client.push_to_cards

client.push_to_cards.disburse

client.push_to_cards.payment_card

client.real_time_fee_groups

client.transactions

client.transactions(token).related

client.users

client.users(token).transitions

client.velocity_controls

client.webhooks

Using the Python SDK

The following sections show the basic method usage for each of the Python objects. For details on the REST API, including input and return values, see the Core API Reference.

Account holder groups

Use the account_holder_groups object to manage groups of multiple account holders. For details on account holder groups, including available parameters, see /accountholdergroups in the Core API Reference. The following code examples show basic usage of the account_holder_groups methods.

# Create an account holder group
account_holder_group = client.account_holder_groups.create({...})

# Retrieve a specific account holder group
account_holder_group = client.account_holder_groups.find(token)

# Update an account holder group
account_holder_group = client.account_holder_groups.save(token, {...})

# List all account holder groups
account_holder_groups = client.account_holder_groups.list()
for account_holder_group in client.account_holder_groups.stream():
    pass
account_holder_groups_page = client.account_holder_groups.page(start_index=0)

Is this helpful?

Auth controls

Use the auth_controls object to manage authorization controls, which are spend controls that limit where users can transact. For details, including available parameters, see /authcontrols in the Core API Reference. The following code examples show basic usage of the auth_controls methods.

# Create an auth control
auth_control = client.auth_controls.create({...})

# Retrieve a specific auth control
auth_control = client.auth_controls.find(token)

# Update an auth control
auth_control = client.auth_controls.save(token, {...})

# List all auth controls
auth_controls = client.auth_controls.list()
for auth_control in client.auth_controls.stream():
    pass
auth_controls_page = client.auth_controls.page(start_index=0)

Is this helpful?

Manage exempt MIDs

Use the auth_controls.exempt_mids object to manage exemptions of Merchant Identifier numbers (MIDs) from authorization controls. Transactions originating from an exempt MID ignore otherwise applicable authorization controls. For details, including input parameters, see the /authcontrols/exemptmids endpoint in the Core API Reference. The following code examples show basic usage of the auth_controls.exempt_mids methods.

# Create an exempt MID
exempt_mid = client.auth_controls.exempt_mids.create({...})

# Retrieve a specific exempt MID
exempt_mid = client.auth_controls.exempt_mids.find(token)

# Update an exempt MID
exempt_mid = client.auth_controls.exempt_mids.save(token, {...})

# List all exempt MIDs
exempt_mi_ds = client.auth_controls.exempt_mids.list()
for exempt_mid in client.auth_controls.exempt_mids.stream():
    pass
exempt_mi_ds_page = client.auth_controls.exempt_mids.page(start_index=0)

Is this helpful?

Auto reloads

Use the auto_reloads object to automatically load a specified amount of funding into an MSA or GPA account when the balance falls below a defined threshold. Transactions originating from an exempt MID ignore otherwise applicable authorization controls. For details, including input parameters, see the /autoreloads endpoint in the Core API Reference. The following code examples show basic usage of the auto_reloads methods.

# Create an autoreload
autoreload = client.auto_reloads.create({...})

# Retrieve a specific autoreload
autoreload = client.auto_reloads.find(token)

# Update an autoreload
autoreload = client.auto_reloads.save(token, {...})

# List all autoreloads
autoreloads = client.auto_reloads.list()
for autoreload in client.auto_reloads.stream():
    pass
autoreloads_page = client.auto_reloads.page(start_index=0)

Is this helpful?

Balances

Use the balances object to retrieve a specifc balance or list all MSA balances. For details, including available parameters, see the /balances endpoint in the Core API Reference. The following code examples show basic usage of the balances methods.

# Retrieve a specific balance
balance = client.balances.find_for_user_or_business(token)

# List all MSA balances
balances = client.balances.list_msas_for_user_or_business(token)
for balance in client.balances.stream_msas_for_user_or_business(token):
    pass

Is this helpful?

Bulk issuances

Use the bulk_issuances object to manage bulk card orders. For details, including input parameters, see the /bulkissuances endpoint in the Core API Reference. The following code examples show basic usage of the bulk_issuances methods.

# Create a bulk issuance
bulk_issuance = client.bulk_issuances.create({...})

# Retrieve a specific bulk issuance
bulk_issuance = client.bulk_issuances.find(token)

# List all bulk issuances
bulk_issuances = client.bulk_issuances.list()
for bulk_issuance in client.bulk_issuances.stream():
    pass
bulk_issuances_page = client.bulk_issuances.page(start_index=0)

Is this helpful?

Businesses

Use the businesses object to manage businesses on the Marqeta platform. For details, including input parameters, see the /businesses endpoint in the Core API Reference. The following code examples show basic usage of the businesses methods.

# Create a business
business = client.businesses.create({...})

# Retrieve a specific business
business = client.businesses.find(token)

# Update a business
business = client.businesses.save(token, {...})

# List all businesses
businesses = client.businesses.list()
for business in client.businesses.stream():
    pass
businesses_page = client.businesses.page(start_index=0)

# Retrieve a specific business SSN
ssn = client.businesses(token).ssn()

# Retrieve a specific business Full SSN
ssn = client.businesses(token).ssn(full_ssn = True)

# List all children of parent business
child_cardholders = client.businesses(token).children.list()
for child_cardholder in client.businesses(token).children.stream():
    pass
child_cardholders_page = client.businesses(token).children.page(start_index=0)

# Search for businesses
businesss = client.businesses.look_up({...})

Is this helpful?

Business transitions

Use the businesses(business_token).transitions object to manage business transitions. For details, including input parameters, see the /businesstransitions endpoint in the Core API Reference. The following code examples show basic usage of the businesses(business_token).transitions methods.

# Create a business transition
transition = client.businesses(business_token).transitions.create(...)

# Retrieve a specific business transition
transition = client.businesses(business_token).transitions.find(token)

# List transitions for a specific business
transitions = client.businesses(business_token).transitions.list()
for transition in client.businesses(business_token).transitions.stream():
    pass
transitions_page = client.businesses(business_token).transitions.page(start_index=0)

Is this helpful?

Card products

Use the /card_products object to manage the behavior and functionality of one or more physical or virtual cards. For details, including input parameter, see /cardproducts in the Core API Reference. The following code examples show basic usage of the card_products methods.

# Create a card product
card_product = client.card_products.create({...})

# Retrieve a specific card product
card_product = client.card_products.find(token)

# Update a card product
card_product = client.card_products.save(token, {...})

# List all card products. Default limit is 25.
card_products = client.card_products.list()
for card_product in client.card_products.stream():
    pass
card_products_page = client.card_products.page(start_index=0)

Is this helpful?

Cards

Use the /cards object to manage the behavior and functionality of one or more physical or virtual cards. For details, including input descriptions, see /cards in the Core API Reference. The following code examples show basic usage of the cards methods.

# Create a card
data = {...}
card = client.cards.create(data)

# Create a merchant onboarding card
data = {...}
card = client.cards.create_for_merchant(token, data)

# Return a specific card
card = client.cards.find(token)

# Return a specific card - PAN visible
card = client.cards.find_show_pan(token)

# Retrieve a card by its barcode
card = client.cards.find_by_barcode(barcode)

# Return the user and card tokens for a specified PAN
tokens = client.cards.tokens_for_pan(pan)

# Return a merchant onboarding card
card = client.cards.find_for_merchant(token)

# Return a specific card - PAN visible
card = client.cards.find_for_merchant_show_pan(token)

# Update a card
data = {...}
card = client.cards.save(data)

# List cards by last 4
cards = client.cards.list(last_four="6789")
for card in client.cards.stream():
    pass
cards_page = client.cards.page()

# List all cards for one user
cards = client.cards.list_for_user(token)
for card in client.cards.stream_for_user(token):
    pass

Is this helpful?

Card transitions

Use the cards(token).transitions object to manage card transitions. For details, including input parameters, see the /cardtransitions endpoint in the Core API Reference. The following code examples show basic usage of the cards(token).transitions methods.

# Create a card transition
transition = client.cards(token).transitions.create(...)

# Retrieve a specific card transition
transition = client.cards(token).transitions.find(token)

# List transitions for a specific card
transitions = client.cards(token).transitions.list()
for transition in client.cards(token).transitions.stream():
    pass
transitions_page = client.cards(token).transitions.page(start_index=0)

Is this helpful?

Commando modes

Use the commando_modes object to manage the commando modes fallback measure that ensures Gateway JIT-funded cards continue to function in the event your system fails. For details, including input parameters, see the /commandomodes endpoint in the Core API Reference. The following code examples show basic usage of the commando_modes methods.

# Retrieve a specific commando mode
commando_mode = client.commando_modes.find(token)

# List all commando modes
commando_modes = client.commando_modes.list()
for commando_mode in client.commando_modes.stream():
    pass
commando_modes_page = client.commando_modes.page(start_index=0)

Is this helpful?

Commando mode transitions

Use the commando_modes(token) object to manage commando mode transitions. For details, including input parameters, see the /commandomodes/transitions endpoint in the Core API Reference. The following code examples show basic usage of the commando_modes(token) methods.

# Retrieve a specific commando mode transition
transition = client.commando_modes(token).transitions.find(token)

# List transitions for a specific commando mode
transitions = client.commando_modes(token).transitions.list()
for transition in client.commando_modes(token).transitions.stream():
    pass
transitions_page = client.commando_modes(token).transitions.page(start_index=0)

Is this helpful?

Digital wallet tokens

Use the digital_wallet_tokens object to manage digital wallet tokens. For details, including input parameters, see the /digitalwallettokens/{token} endpoint in the Core API Reference. The following code examples show basic usage of the digital_wallet_tokens methods.

# Retrieve a specific digital wallet token
digital_wallet_token = client.digital_wallet_tokens.find(token)

# Retrieve a specific digital wallet token with PAN
digital_wallet_token = client.digital_wallet_tokens.find_show_pan(token)

# List all digital wallet tokens
digital_wallet_tokens = client.digital_wallet_tokens.list()
for digital_wallet_token in client.digital_wallet_tokens.stream():
    pass
digital_wallet_tokens_page = client.digital_wallet_tokens.page(start_index=0)

Is this helpful?

Digital wallet token transitions

Use the digital_wallet_tokens(token).transitions object to manage digital wallet token transitions. For details, including input parameters, see the /digitalwallettokentransitions endpoint in the Core API Reference. The following code examples show basic usage of the digital_wallet_tokens(token).transitions methods.

# Create a digital wallet token transition
transition = client.digital_wallet_tokens(token).transitions.create(...)

# Retrieve a specific digital wallet token transition
transition = client.digital_wallet_tokens(token).transitions.find(token)

# List transitions for a specific digital wallet token
transitions = client.digital_wallet_tokens(token).transitions.list()
for transition in client.digital_wallet_tokens(token).transitions.stream():
    pass
transitions_page = client.digital_wallet_tokens(token).transitions.page(start_index=0)

Is this helpful?

Direct deposits

Use the direct_deposits object to manage direct deposits. For details, including input parameters, see the /directdeposits endpoint in the Core API Reference. The following code examples show basic usage of the direct_deposits methods.

# Retrieve a specific direct deposit
direct_deposit = client.direct_deposits.find(token)

# List all direct deposits
direct_deposits = client.direct_deposits.list()
for direct_deposit in client.direct_deposits.stream():
    pass
direct_deposits_page = client.direct_deposits.page(start_index=0)

Is this helpful?

Direct deposit transitions

Use the direct_deposits(token).transitions object to manage direct deposit transitions. For details, including input parameters, see the /directdeposits/transitions endpoint in the Core API Reference. The following code examples show basic usage of the direct_deposits(token).transitions methods.

# Create a direct deposit transition
transition = client.direct_deposits(token).transitions.create(...)

# Retrieve a specific direct deposit transition
transition = client.direct_deposits(token).transitions.find(token)

# List transitions for a specific direct deposit
transitions = client.direct_deposits(token).transitions.list()
for transition in client.direct_deposits(token).transitions.stream():
    pass
transitions_page = client.direct_deposits(token).transitions.page(start_index=0)

Is this helpful?

Direct deposit accounts

Use the direct_deposits.accounts object to manage direct deposit accounts. For details, including input parameters, see the /directdeposits/accounts endpoint in the Core API Reference. The following code examples show basic usage of the direct_deposits.accounts methods.

# Retrieve a specific direct deposit account
direct_deposit_account = client.direct_deposits.accounts.find(token)

# Update a direct deposit account
direct_deposit_account = client.direct_deposits.accounts.save(token, {...})

Is this helpful?

Fees

Use the fees object to manage fees against a user’s general purpose account (GPA). For details, including input parameters, see the /fees endpoint in the Core API Reference. The following code examples show basic usage of the fees methods.

# Create a fee
fee = client.fees.create({...})

# Retrieve a specific fee
fee = client.fees.find(token)

# Update a fee
fee = client.fees.save(token, {...})

# List all fees
fees = client.fees.list()
for fee in client.fees.stream():
    pass
fees_page = client.fees.page(start_index=0)

Is this helpful?

Fee transfers

Use the fee_transfers object to manage fee transfers. For details, including input parameters, see the /feetransfers endpoint in the Core API Reference. The following code examples show basic usage of the fee_transfers methods.

# Create a fee transfer
fee_transfer = client.fee_transfers.create({...})

# Retrieve a specific fee transfer
fee_transfer = client.fee_transfers.find(token)

Is this helpful?

Funding source addresses

Use the funding_sources.addresses object to manage funding source addresses. For details, including input parameters, see the /fundingsources/addresses endpoint in the Core API Reference. The following code examples show basic usage of the funding_sources.addresses methods.

# Create a funding source address
funding_source_address = client.funding_sources.addresses.create({...})

# Retrieve a specific funding source address
funding_source_address = client.funding_sources.addresses.find(token)

# Update a funding source address
funding_source_address = client.funding_sources.addresses.save(token, {...})

# list funding source addresses for a specific user
addresses = client.funding_sources.addresses.list_for_user(user_token)
for address in client.funding_sources.addresses.stream_for_user(user_token)
    pass

# list funding source addresses for a specific business
addresses = client.funding_sources.addresses.list_for_business(business_token)
for address in client.funding_sources.addresses.stream_for_business(business_token)
    pass

Is this helpful?

ACH funding sources

Use the funding_sources.ach object to manage funding source addresses. For details, including input parameters, see the /fundingsources/ach endpoint in the Core API Reference. The following code examples show basic usage of the funding_sources.ach methods.

# Create an ACH funding source
ach_funding_source = client.funding_sources.ach.create({...})

# Retrieve a specific ACH funding source
ach_funding_source = client.funding_sources.ach.find(token)

# Retrieve the dollar amounts used to verify an ACH funding source
client.funding_sources.addresses(token).verification_amounts()

# Update an ACH funding source
ach_funding_source = client.funding_sources.ach.save(token, {...})

Is this helpful?

Payment card funding sources

Use the funding_sources.payment_card object to manage funding sources for payment cards. For details, including input parameters, see the /fundingsources/paymentcard endpoint in the Core API Reference. The following code examples show basic usage of the funding_sources.payment_card methods.

# Create a payment card funding source
payment_card_funding_source = client.funding_sources.payment_card.create({...})

# Retrieve a specific payment card funding source
payment_card_funding_source = client.funding_sources.payment_card.find(token)

# Update a payment card funding source
payment_card_funding_source = client.funding_sources.payment_card.save(token, {...})

Is this helpful?

Program gateway funding sources

Use the funding_sources.program_gateway object to manage program gateway funding sources. For details, including input parameters, see the /fundingsources/programgateway endpoint in the Core API Reference. The following code examples show basic usage of the funding_sources.program_gateway methods.

# Create a program gateway funding source
program_gateway_funding_source = client.funding_sources.program_gateway.create({...})

# Retrieve a specific program gateway funding source
program_gateway_funding_source = client.funding_sources.program_gateway.find(token)

# Update a program gateway funding source
program_gateway_funding_source = client.funding_sources.program_gateway.save(token, {...})

Is this helpful?

Program funding sources

Use the funding_sources.program object to manage program funding sources. For details, including input parameters, see the /fundingsources/program endpoint in the Core API Reference. The following code examples show basic usage of the funding_sources.program methods.

# Create a program funding source
program_funding_source = client.funding_sources.program.create({...})

# Retrieve a specific program funding source
program_funding_source = client.funding_sources.program.find(token)

# Update a program funding source
program_funding_source = client.funding_sources.program.save(token, {...})

Is this helpful?

GPA orders

Use the gpa_orders object to manage GPA orders. For details, including input parameters, see the /gpaorders endpoint in the Core API Reference. The following code examples show basic usage of the gpa_orders methods.

# Create a GPA order
gpa_order = client.gpa_orders.create({...})

# Retrieve a specific GPA order
gpa_order = client.gpa_orders.find(token)

Is this helpful?

GPA returns

Use the gpa_orders.unloads object to manage GPA orders. For details, including input parameters, see the /gpaorders/unloads endpoint in the Core API Reference. The following code examples show basic usage of the gpa_orders.unloads methods.

# Create a GPA return
gpa_return = client.gpa_orders.unloads.create({...})

# Retrieve a specific GPA return
gpa_return = client.gpa_orders.unloads.find(token)

# List all GPA returns
gpa_returns = client.gpa_orders.unloads.list()
for gpa_return in client.gpa_orders.unloads.stream():
    pass
gpa_returns_page = client.gpa_orders.unloads.page(start_index=0)

Is this helpful?

KYC

Use the kyc object to manage KYC. For details, including input parameters, see the /kyc endpoint in the Core API Reference. The following code examples show basic usage of the kyc methods.

# Retrieve a specific KYC result
kyc = client.kyc.find(token)

# Update KYC answers
client.kyc.save(token, {...})

# Perform a KYC operation
client.kyc.create({...})

# List KYC results for a specific user
kyc_results = client.kyc.list_for_user(user_token)
for kyc_result in client.kyc.stream_for_user(user_token):
    pass

# List KYC results for a specific business
kyc_results = client.kyc.list_for_business(business_token)
for kyc_result in client.kyc.stream_for_business(business_token):
    pass

Is this helpful?

MCC groups

Use the mcc_groups object to manage MCC groups. For details, including input parameters, see the /mccgroups endpoint in the Core API Reference. The following code examples show basic usage of the mcc_groups methods.

# Create an MCC group
mcc_group = client.mcc_groups.create({...})

# Retrieve a specific MCC group
mcc_group = client.mcc_groups.find(token)

# Update an MCC group
mcc_group = client.mcc_groups.save(token, {...})

# List all MCC groups
mcc_groups = client.mcc_groups.list()
for mcc_group in client.mcc_groups.stream():
    pass
mcc_groups_page = client.mcc_groups.page(start_index=0)

Is this helpful?

MSA orders

Use the msa_orders object to manage MSA orders. For details, including input parameters, see the /msaorders endpoint in the Core API Reference. The following code examples show basic usage of the msa_orders methods.

# Create an MSA order
msa_order = client.msa_orders.create({...})

# Retrieve a specific MSA order
msa_order = client.msa_orders.find(token)

# Update an MSA order
msa_order = client.msa_orders.save(token, {...})

Is this helpful?

MSA order unloads

Use the msa_orders.unloads object to manage MSA order unloads. For details, including input parameters, see the /msaorders/unloads endpoint in the Core API Reference. The following code examples show basic usage of the msa_orders.unloads methods.

# Create an MSA order unload
msa_order_unload = client.msa_orders.unloads.create({...})

# Retrieve a specific MSA order unload
msa_order_unload = client.msa_orders.unloads.find(token)

# List all MSA order unloads
msa_order_unloads = client.msa_orders.unloads.list()
for msa_order_unload in client.msa_orders.unloads.stream():
    pass
msa_order_unloads_page = client.msa_orders.unloads.page(start_index=0)

Is this helpful?

Offer orders

Use the offer_orders object to manage offer orders. For details, including input parameters, see the /offerorders endpoint in the Core API Reference. The following code examples show basic usage of the offer_orders methods.

# Create an offer order
offer_order = client.offer_orders.create({...})

# Retrieve a specific offer order
offer_order = client.offer_orders.find(token)

Is this helpful?

Program transfers

Use the program_transfers objects to manage program transfers. For details, including input parameters, see the /programtransfers endpoint in the Core API Reference. The following code examples show basic usage of the program_transfers methods.

# Create a program transfer
program_transfer = client.program_transfers.create({...})

# Retrieve a specific program transfer
program_transfer = client.program_transfers.find(token)

# List all program transfers
program_transfers = client.program_transfers.list()
for program_transfer in client.program_transfers.stream():
    pass
program_transfers_page = client.program_transfers.page(start_index=0)

Is this helpful?

Program transfer types

Use the program_transfers.types object to manage program transfer types. For details, including input parameters, see the /programtransfers/types endpoint in the Core API Reference. The following code examples show basic usage of the program_transfers.types methods.

# Create a program transfer type
program_transfer_type = client.program_transfers.types.create({...})

# Retrieve a specific program transfer type
program_transfer_type = client.program_transfers.types.find(token)

# Update a program transfer type
program_transfer_type = client.program_transfers.types.save(token, {...})

# List all program transfer types
program_transfer_types = client.program_transfers.types.list()
for program_transfer_type in client.program_transfers.types.stream():
    pass
program_transfer_types_page = client.program_transfers.types.page(start_index=0)

Is this helpful?

Push-to-cards

Use the push_to_cards object to manage push-to-card payment cards. For details, including input parameters, see the /pushtocards endpoint in the Core API Reference. The following code examples show basic usage of the push_to_cards methods.

# Create a push-to-card
push_to_card = client.push_to_cards.create({...})

# Retrieve a specific push-to-card
push_to_card = client.push_to_cards.find(token)

# Update a push-to-card
push_to_card = client.push_to_cards.save(token, {...})

# List all push-to-cards
push_to_cards = client.push_to_cards.list()
for push_to_card in client.push_to_cards.stream():
    pass
push_to_cards_page = client.push_to_cards.page(start_index=0)

Is this helpful?

Push-to-card disbursements

Use the push_to_cards.disburse object to manage push-to-card disbursements. For details, including input parameters, see the /pushtocards/disburse endpoint in the Core API Reference. The following code examples show basic usage of the push_to_cards.disburse methods.

# Create a push-to-card disbursement
push_to_card_disbursement = client.push_to_cards.disburse.create({...})

# Retrieve a specific push-to-card disbursement
push_to_card_disbursement = client.push_to_cards.disburse.find(token)

# List all push-to-card disbursements
push_to_card_disbursements = client.push_to_cards.disburse.list()
for push_to_card_disbursement in client.push_to_cards.disburse.stream():
    pass
push_to_card_disbursements_page = client.push_to_cards.disburse.page(start_index=0)

Is this helpful?

Push-to-card payment cards

Use the push_to_cards.payment_card object to manage push-to-card disbursements. For details, including input parameters, see the /pushtocards/paymentcard endpoint in the Core API Reference. The following code examples show basic usage of the push_to_cards.payment_card methods.

# Create a push-to-card payment card
push_to_card_payment_card = client.push_to_cards.payment_card.create({...})

# Retrieve a specific push-to-card payment card
push_to_card_payment_card = client.push_to_cards.payment_card.find(token)

# List all push-to-card payment cards
push_to_card_payment_cards = client.push_to_cards.payment_card.list()
for push_to_card_payment_card in client.push_to_cards.payment_card.stream():
    pass
push_to_card_payment_cards_page = client.push_to_cards.payment_card.page(start_index=0)

Is this helpful?

Realtime fee groups

Use the real_time_fee_groups object to manage push-to-card disbursements. For details, including input parameters, see the /realtimefeegroups endpoint in the Core API Reference. The following code examples show basic usage of the real_time_fee_groups methods.

# Create a realtime fee group
realtime_fee_group = client.real_time_fee_groups.create({...})

# Retrieve a specific realtime fee group
realtime_fee_group = client.real_time_fee_groups.find(token)

# Update a realtime fee group
realtime_fee_group = client.real_time_fee_groups.save(token, {...})

# List all realtime fee groups
realtime_fee_groups = client.real_time_fee_groups.list()
for realtime_fee_group in client.real_time_fee_groups.stream():
    pass
realtime_fee_groups_page = client.real_time_fee_groups.page(start_index=0)

Is this helpful?

Transactions

Use the transactions object to manage transactions. For details, including input parameters, see the /transactions endpoint in the Core API Reference. The following code examples show basic usage of the transactions methods.

# Retrieve a specific transaction
transaction = client.transactions.find(token)

# List all transactions
transactions = client.transactions.list()
for transaction in client.transactions.stream():
    pass
transactions_page = client.transactions.page(start_index=0)

# List all transactions for a specific funding source
transactions = client.transactions.list_for_funding_source(funding_source_token)
for transaction in client.transactions.stream_for_funding_source(funding_source_token):
    pass

Is this helpful?

Use the transactions(token).related object to manage related transactions. For details, including input parameters, see the /transactions/{token}/related endpoint in the Core API Reference. The following code examples show basic usage of the transactions(token).related methods.

# List all related transations
related_transations = client.transactions(token).related.list()
for related_transation in client.transactions(token).related.stream():
    pass
related_transations_page = client.transactions(token).related.page(start_index=0)

Is this helpful?

Users

Use the users object to manage users. For details, including input parameters, see the /users endpoint in the Core API Reference. The following code examples show basic usage of the users methods.

# Create a user
user = client.users.create({...})

# Retrieve a specific user
user = client.users.find(token)

# Update a user
user = client.users.save(token, {...})

# Retrieve a specific user SSN
ssn = client.users(token).ssn()

# Retrieve a specific user Full SSN
ssn = client.users(token).ssn(full_ssn = True)

# List all users. Default limit is 1000.
users = client.users.list()
for user in client.users.stream():
    pass
users_page = client.users.page(start_index=0)

# List all children of parent user
child_cardholders = client.users(token).children.list()
for child_cardholder in client.users(token).children.stream():
    pass
child_cardholders_page = client.users(token).children.page(start_index=0)

# Search for users, if look_up data is not specified by default lists 1000 users
users = client.users.look_up({...})

Is this helpful?

User transitions

Use the users(token).transitions object to manage user transitions. For details, including input parameters, see the /usertransitions endpoint in the Core API Reference. The following code examples show basic usage of the users(token).transitions methods.

# Create a user transition
transition = client.users(token).transitions.create(...)

# Retrieve a specific user transition
transition = client.users(token).transitions.find(token)

# List transitions for a specific user
transitions = client.users(token).transitions.list()
for transition in client.users(token).transitions.stream():
    pass
transitions_page = client.users(token).transitions.page(start_index=0)

Is this helpful?

Velocity controls

Use the velocity_controls object to manage velocity controls. For details, including input parameters, see the /velocitycontrols endpoint in the Core API Reference. The following code examples show basic usage of the velocity_controls methods.

# Create a velocity control
velocity_control = client.velocity_controls.create({...})

# Retrieve a specific velocity control
velocity_control = client.velocity_controls.find(token)

# Update a velocity control
velocity_control = client.velocity_controls.save(token, {...})

# List all velocity controls
velocity_controls = client.velocity_controls.list()
for velocity_control in client.velocity_controls.stream():
    pass
velocity_controls_page = client.velocity_controls.page(start_index=0)

# List velocity controls available for a specific user
velocity_controls = list_available_for_user(user_token)
for velocity_control in stream_available_for_user(user_token):
    pass

Is this helpful?

Webhooks

Use the webhooks object to manage webhooks. For details, including input parameters, see the /webhooks endpoint in the Core API Reference. The following code examples show basic usage of the webhooks methods.

# Create a webhook
webhook = client.webhooks.create({...})

# Retrieve a specific webhook
webhook = client.webhooks.find(token)

# Update a webhook
webhook = client.webhooks.save(token, {...})

# Ping a webhook
client.webhooks(token).ping()

# Resend a webhook
client.webhooks(token).resent(event_type, event_token)

# List all webhooks
webhooks = client.webhooks.list()
for webhook in client.webhooks.stream():
    pass
webhooks_page = client.webhooks.page(start_index=0)

Is this helpful?

Have any feedback on this page?

If you feel we can do anything better, please let our team know.

We strive for the best possible developer experience.