List
GET /v1/payment_methods.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>
Example response has been truncated for brevity
HTTPS/1.1 200 OK
{
"payment_methods": [
{
"token": "72GW93Z3rarasS7EqiUCXsqx4jW",
"created_at": "2017-06-22T15:10:48Z",
"updated_at": "2017-06-22T15:10:48Z",
"gateway_type": "test",
"storage_state": "retained",
"third_party_token": "test_vault:4111111111111111",
"payment_method_type": "third_party_token",
"bin_metadata": {
"card_brand": "DISCOVER",
"card_category": "PERSONAL",
"card_type": "CREDIT",
"issuing_bank": "DISCOVER BANK",
"issuing_country_iso_number": "840",
"issuing_country_iso_a2_code": "US",
"issuing_country_iso_a3_code": "USA",
"issuing_country_iso_name": "UNITED STATES",
"issuing_bank_phone_number": "1 (800) 347-7000",
"issuing_bank_website": "HTTPS://WWW.DISCOVER.COM/",
"bin_type": "PERSONAL",
"regulated": "Y",
"max_pan_length": 19,
"message": "Successful"
},
"errors": [
]
},
{
"token": "5voMXfW8xotx25P7OyNywmfeYPZ",
"created_at": "2017-06-22T15:10:49Z",
"updated_at": "2017-06-22T15:10:49Z",
"gateway_type": "test",
"storage_state": "retained",
"third_party_token": "test_vault:4111111111111111",
"payment_method_type": "third_party_token",
"bin_metadata": {
"card_brand": "DISCOVER",
"card_category": "PERSONAL",
"card_type": "CREDIT",
"issuing_bank": "DISCOVER BANK",
"issuing_country_iso_number": "840",
"issuing_country_iso_a2_code": "US",
"issuing_country_iso_a3_code": "USA",
"issuing_country_iso_name": "UNITED STATES",
"issuing_bank_phone_number": "1 (800) 347-7000",
"issuing_bank_website": "HTTPS://WWW.DISCOVER.COM/",
"bin_type": "PERSONAL",
"regulated": "Y",
"max_pan_length": 19,
"message": "Successful"
},
"errors": [
]
}
]
}
<payment_methods>
<payment_method>
<token>72GW93Z3rarasS7EqiUCXsqx4jW</token>
<created_at type="dateTime">2017-06-22T15:10:48Z</created_at>
<updated_at type="dateTime">2017-06-22T15:10:48Z</updated_at>
<gateway_type>test</gateway_type>
<storage_state>retained</storage_state>
<third_party_token>test_vault:4111111111111111</third_party_token>
<payment_method_type>third_party_token</payment_method_type>
<bin_metadata>
<card_brand>DISCOVER</card_brand>
<card_category>PERSONAL</card_category>
<card_type>CREDIT</card_type>
<issuing_bank>DISCOVER BANK</issuing_bank>
<issuing_country_iso_number>840</issuing_country_iso_number>
<issuing_country_iso_a2_code>US</issuing_country_iso_a2_code>
<issuing_country_iso_a3_code>USA</issuing_country_iso_a3_code>
<issuing_country_iso_name>UNITED STATES</issuing_country_iso_name>
<issuing_bank_phone_number>1 (800) 347-7000</issuing_bank_phone_number>
<issuing_bank_website>HTTPS://WWW.DISCOVER.COM/</issuing_bank_website>
<bin_type>PERSONAL</bin_type>
<regulated>Y</regulated>
<max_pan_length>19</max_pan_length>
<message>Successful</message>
</bin_metadata>
<errors>
</errors>
</payment_method>
<payment_method>
<token>5voMXfW8xotx25P7OyNywmfeYPZ</token>
<created_at type="dateTime">2017-06-22T15:10:49Z</created_at>
<updated_at type="dateTime">2017-06-22T15:10:49Z</updated_at>
<gateway_type>test</gateway_type>
<storage_state>retained</storage_state>
<third_party_token>test_vault:4111111111111111</third_party_token>
<payment_method_type>third_party_token</payment_method_type>
<bin_metadata>
<card_brand>DISCOVER</card_brand>
<card_category>PERSONAL</card_category>
<card_type>CREDIT</card_type>
<issuing_bank>DISCOVER BANK</issuing_bank>
<issuing_country_iso_number>840</issuing_country_iso_number>
<issuing_country_iso_a2_code>US</issuing_country_iso_a2_code>
<issuing_country_iso_a3_code>USA</issuing_country_iso_a3_code>
<issuing_country_iso_name>UNITED STATES</issuing_country_iso_name>
<issuing_bank_phone_number>1 (800) 347-7000</issuing_bank_phone_number>
<issuing_bank_website>HTTPS://WWW.DISCOVER.COM/</issuing_bank_website>
<bin_type>PERSONAL</bin_type>
<regulated>Y</regulated>
<max_pan_length>19</max_pan_length>
<message>Successful</message>
</bin_metadata>
<errors>
</errors>
</payment_method>
</payment_methods>
Retrieve an ordered and paginated list of all retained payment methods in the authenticated environment.
States
Payment methods can exist in several states in the Spreedly vault - retained
, redacted
, cached
, used
, or closed
. Retained payment methods are stored in Spreedly’s vault until redacted. Redacted payment methods are payment methods that were either not retained or have been manually redacted. Cached payment methods are payment methods that have not been retained but have not yet been automatically redacted yet. Cached payment methods can still be retained. For more information, please see our guide on retaining payment methods.
If no state parameter or an invalid state parameter is passed, list will only return retained
payment methods. If the state parameter is passed, list will return those parameters: retained
, redacted
, cached
.
Example: https://core.spreedly.com/v1/payment_methods.json?state=retained,redacted,cached
If the state parameter is combined with other existing parameters such as metadata, both will be considered.
Example: https://core.spreedly.com/v1/payment_methods.json?metadata[customer_id]=123abc&state=redacted,retained
URL Parameters
Parameter | Description |
---|---|
format required |
One of json or xml |
order | The order of the returned list. Default is asc , which returns the oldest records first. To list newer records first, use desc . |
since_token | The token of the item to start from (e.g., the last token received in the previous list if iterating through records) |
metadata | A metadata key/value pair represented as a hash (e.g. metadata[key]=value ). |
state | The list of storage_states to return. By default returns retained , acceptable values are retained , redacted , cached , used , closed |
count | The number of payment methods to return. By default returns 20, maximum allowed is 100. |
Response Body
Notable response elements include:
Element | Description |
---|---|
payment_methods | Root element |
❯ token | The token uniquely identifying the payment method at Spreedly |
❯ retained | if the payment method was set to be automatically retained on creation |
❯ storage_state | The storage state of the payment method |
❯ test | true if this payment method is a test payment method and cannot be used against real gateways or receivers |
❯ payment_method_type | The type of this payment method, e.g., credit_card , bank_account , apple_pay , google_pay , etc… |
❯ errors | If the payment method is invalid (missing first name, number etc…), there will be an associated error message here |
BIN metadata is available in the response if the card is enrolled in Advanced Vault. See BIN metadata for more information.