Knowledge Center

Knowledge Center > API > REST API > REST API Reference > Payment Methods > Get payment methods

Get payment methods

This REST API reference describes how to retrieve all credit card information for the specified customer account.

Request

  • Production: GET https://api.zuora.com/rest/v1/payment-methods/credit-cards/accounts/{account-key}
  • API Sandbox: GET https://apisandbox-api.zuora.com/rest/v1/payment-methods/credit-cards/accounts/{account-key}

Request parameters

account-key

required

path

Account number or account ID

pageSize

optional

query

Number of rows to return.  Maximum is 40; default is 20.

Response

The response includes details credit or debit cards for the specified customer account. Card numbers are masked, e.g., "************1234". Cards are returned in reverse chronological order of last update.

You can send requests for bank transfer payment methods types. The response will not include bank transfer details.

Response parameters

success

Contains true if successful, otherwise false.

processId

Internal process ID to assist Zuora support. Only returned if success is false.

reasons

Information on one or more reasons for the result. Only returned if success is false.

code

Eight-digit numeric error code

message

Description of the error

creditCards

Container for one or more credit or debit card records:

id

Unique ID generated by Zuora when this payment method was created

defaultPaymentMethod

Contains true if this is the default payment method for this customer, otherwise false.

cardType

The type of credit card or debit card being billed.  Possible values are: Visa, MasterCard, AmericanExpress, Discover.

cardNumber

Credit or debit card number, 16 characters or less, masked for security purposes.

expirationMonth

Two-digit expiration month (01 - 12)

expirationYear

Four-digit expiration year

cardHolderInfo

Container for the name and billing address for the card holder.

cardHolderName

The full name as it appears on the card, e.g., "John J Smith", 50 characters or less

addressLine1

First address line, 255 characters or less

addressLine2

Second address line, 255 characters or less

city

City, 40 characters or less

state

State, must be a valid state name or 2-character abbreviation

zipCode

Zip code, 20 characters or less

country

Country, must be a valid country name or abbreviation.

phone

Phone number, 40 characters or less

email

Card holder's email address, 80 characters or less

nextPage

URL for requesting the next page of the response, if it exists; otherwise absent

Notes

  1. The response only includes payment details on payment methods that are credit or debit cards.

Examples

HTTP/JSON request:

GET https://api.zuora.com/rest/v1/paymen...115?pageSize=2

JSON response:

{
  "nextPage": "https://api.zuora.com/rest/v1/payment-methods/credit-cards/accounts/A00001115?page=2&pageSize=2",
  "creditCards": [
    {
      "cardHolderInfo": {
        "zipCode": null,
        "addressLine2": null,
        "addressLine1": null,
        "phone": "4082021111",
        "state": null,
        "country": null,
        "city": null,
        "cardHolderName": "Leo",
        "email": "test@zuora.com"
      },
      "defaultPaymentMethod": true,
      "id": "2c92c8f83dabf9cf013daef12dd303b0",
      "expirationMonth": 10,
      "cardNumber": "************1111",
      "expirationYear": 2020,
      "cardType": "Visa"
    },
    {
      "cardHolderInfo": {
        "zipCode": "95135",
        "addressLine2": null,
        "addressLine1": "1400 Bridge Pkwy",
        "phone": null,
        "state": "California",
        "country": "United States",
        "city": "San Jose",
        "cardHolderName": "foo CC name",
        "email": null
      },
      "defaultPaymentMethod": false,
      "id": "2c92a0f9391832b10139183e279e0044",
      "expirationMonth": 10,
      "cardNumber": "*****foo CC #",
      "expirationYear": 2012,
      "cardType": "Visa"
    }
  ],
  "success": true
}

CURL request:

##
## Get Credit Card by Account Key
##
echo
echo "=============Get credit card============="
echo
curl -i -k -H "apiAccessKeyId:$USER_NAME" -H "apiSecretAccessKey:$PASSWORD" -H "Accept:application/json" -X GET $BASE_URL/v1/payment-methods/credit-cards/accounts/A00000001

JSON response:

{
  "nextPage": "https://api.zuora.com/rest/v1/payment-methods/credit-cards/accounts/A00001115?page=2&pageSize=2",
  "creditCards": [
    {
      "cardHolderInfo": {
        "zipCode": null,
        "addressLine2": null,
        "addressLine1": null,
        "phone": "4082021111",
        "state": null,
        "country": null,
        "city": null,
        "cardHolderName": "Leo",
        "email": "test@zuora.com"
      },
      "defaultPaymentMethod": true,
      "id": "2c92c8f83dabf9cf013daef12dd303b0",
      "expirationMonth": 10,
      "cardNumber": "************1111",
      "expirationYear": 2020,
      "cardType": "Visa"
    },
    {
      "cardHolderInfo": {
        "zipCode": "95135",
        "addressLine2": null,
        "addressLine1": "1400 Bridge Pkwy",
        "phone": null,
        "state": "California",
        "country": "United States",
        "city": "San Jose",
        "cardHolderName": "foo CC name",
        "email": null
      },
      "defaultPaymentMethod": false,
      "id": "2c92a0f9391832b10139183e279e0044",
      "expirationMonth": 10,
      "cardNumber": "*****foo CC #",
      "expirationYear": 2012,
      "cardType": "Visa"
    }
  ],
  "success": true
}
Last modified
13:32, 8 Oct 2015

Tags

Classifications

(not set)