cards_api = client.cardsCardsApi
Retrieves a list of cards owned by the account making the request. A max of 25 cards will be returned.
def list_cards(self,
cursor=None,
customer_id=None,
include_disabled=False,
reference_id=None,
sort_order=None)| Parameter | Type | Tags | Description |
|---|---|---|---|
cursor |
string |
Query, Optional | A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See Pagination for more information. |
customer_id |
string |
Query, Optional | Limit results to cards associated with the customer supplied. By default, all cards owned by the merchant are returned. |
include_disabled |
bool |
Query, Optional | Includes disabled cards. By default, all enabled cards owned by the merchant are returned. Default: False |
reference_id |
string |
Query, Optional | Limit results to cards associated with the reference_id supplied. |
sort_order |
str (Sort Order) |
Query, Optional | Sorts the returned list by when the card was created with the specified order. This field defaults to ASC. |
cursor = 'cursor6'
customer_id = 'customer_id8'
include_disabled = False
reference_id = 'reference_id2'
sort_order = 'DESC'
result = cards_api.list_cards(cursor, customer_id, include_disabled, reference_id, sort_order)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)Adds a card on file to an existing merchant.
def create_card(self,
body)| Parameter | Type | Tags | Description |
|---|---|---|---|
body |
Create Card Request |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
body = {}
body['idempotency_key'] = '4935a656-a929-4792-b97c-8848be85c27c'
body['source_id'] = 'cnon:uIbfJXhXETSP197M3GB'
body['verification_token'] = 'verification_token0'
body['card'] = {}
body['card']['id'] = 'id0'
body['card']['card_brand'] = 'INTERAC'
body['card']['last_4'] = 'last_42'
body['card']['exp_month'] = 236
body['card']['exp_year'] = 60
body['card']['cardholder_name'] = 'Amelia Earhart'
body['card']['billing_address'] = {}
body['card']['billing_address']['address_line_1'] = '500 Electric Ave'
body['card']['billing_address']['address_line_2'] = 'Suite 600'
body['card']['billing_address']['address_line_3'] = 'address_line_34'
body['card']['billing_address']['locality'] = 'New York'
body['card']['billing_address']['sublocality'] = 'sublocality8'
body['card']['billing_address']['administrative_district_level_1'] = 'NY'
body['card']['billing_address']['postal_code'] = '10003'
body['card']['billing_address']['country'] = 'US'
body['card']['customer_id'] = 'VDKXEEKPJN48QDG3BGGFAK05P8'
body['card']['reference_id'] = 'user-id-1'
result = cards_api.create_card(body)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)Retrieves details for a specific Card.
def retrieve_card(self,
card_id)| Parameter | Type | Tags | Description |
|---|---|---|---|
card_id |
string |
Template, Required | Unique ID for the desired Card. |
card_id = 'card_id4'
result = cards_api.retrieve_card(card_id)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)Disables the card, preventing any further updates or charges. Disabling an already disabled card is allowed but has no effect.
def disable_card(self,
card_id)| Parameter | Type | Tags | Description |
|---|---|---|---|
card_id |
string |
Template, Required | Unique ID for the desired Card. |
card_id = 'card_id4'
result = cards_api.disable_card(card_id)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)