Payment Methods

Create credit card

POST /v1/payment_methods.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>

{
  "payment_method": {
    "credit_card": {
      "first_name": "Joe",
      "last_name": "Jones",
      "number": "5555555555554444",
      "verification_value": "423",
      "month": "3",
      "year": "2032",
      "company": "Acme Inc.",
      "address1": "33 Lane Road",
      "address2": "Apartment 4",
      "city": "Wanaque",
      "state": "NJ",
      "zip": "31331",
      "country": "US",
      "phone_number": "919.331.3313",
      "shipping_address1": "33 Lane Road",
      "shipping_address2": "Apartment 4",
      "shipping_city": "Wanaque",
      "shipping_state": "NJ",
      "shipping_zip": "31331",
      "shipping_country": "US",
      "shipping_phone_number": "919.331.3313"
    },
    "email": "joey@example.com",
    "metadata": {
      "key": "string value",
      "another_key": 123,
      "final_key": true
    }
  }
}
<payment_method>
  <credit_card>
    <first_name>Joey</first_name>
    <last_name>Jones</last_name>
    <number>5555555555554444</number>
    <verification_value>423</verification_value>
    <month>3</month>
    <year>2032</year>
    <company>Acme Inc.</company>
    <address1>33 Lane Road</address1>
    <address2>Apartment 4</address2>
    <city>Wanaque</city>
    <state>NJ</state>
    <zip>31331</zip>
    <country>US</country>
    <phone_number>919.331.3313</phone_number>
    <shipping_address1>33 Lane Road</shipping_address1>
    <shipping_address2>Apartment 4</shipping_address2>
    <shipping_city>Wanaque</shipping_city>
    <shipping_state>NJ</shipping_state>
    <shipping_zip>31331</shipping_zip>
    <shipping_country>US</shipping_country>
    <shipping_phone_number>919.331.3313</shipping_phone_number>
  </credit_card>
  <email>joey@example.com</email>
  <metadata>
    <key>String Value</key>
    <another_key>123</another_key>
    <final_key>true</final_key>
  </metadata>
</payment_method>

HTTPS/1.1 201 Created
{
  "transaction": {
    "token": "L46gdNQunedFoor9ySRJfgz7RAk",
    "created_at": "2020-02-11T20:49:32Z",
    "updated_at": "2020-02-11T20:49:32Z",
    "succeeded": true,
    "transaction_type": "AddPaymentMethod",
    "retained": false,
    "state": "succeeded",
    "message_key": "messages.transaction_succeeded",
    "message": "Succeeded!",
    "payment_method": {
      "token": "VBVmxAmSDxmc7AjUGi7ViUf9avm",
      "created_at": "2020-02-11T20:49:32Z",
      "updated_at": "2020-02-11T20:49:32Z",
      "email": "joey@example.com",
      "data": null,
      "storage_state": "cached",
      "test": true,
      "metadata": {
        "key": "string value",
        "another_key": 123,
        "final_key": true
      },
      "callback_url": null,
      "last_four_digits": "4444",
      "first_six_digits": "555555",
      "card_type": "master",
      "first_name": "Joe",
      "last_name": "Jones",
      "month": 3,
      "year": 2032,
      "address1": "33 Lane Road",
      "address2": "Apartment 4",
      "city": "Wanaque",
      "state": "NJ",
      "zip": "31331",
      "country": "US",
      "phone_number": "919.331.3313",
      "company": "Acme Inc.",
      "full_name": "Joe Jones",
      "eligible_for_card_updater": true,
      "shipping_address1": "33 Lane Road",
      "shipping_address2": "Apartment 4",
      "shipping_city": "Wanaque",
      "shipping_state": "NJ",
      "shipping_zip": "31331",
      "shipping_country": "US",
      "shipping_phone_number": "919.331.3313",
      "payment_method_type": "credit_card",
      "errors": [

      ],
      "fingerprint": "b5fe350d5135ab64a8f3c1097fadefd9effb",
      "verification_value": "XXX",
      "number": "XXXX-XXXX-XXXX-4444"
    }
  }
}
<transaction>
  <token>WO15e7O2JpxHyzi5nluNrgR8e64</token>
  <created_at type="dateTime">2020-02-11T20:49:32Z</created_at>
  <updated_at type="dateTime">2020-02-11T20:49:32Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <transaction_type>AddPaymentMethod</transaction_type>
  <retained type="boolean">false</retained>
  <state>succeeded</state>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <payment_method>
    <token>A5ugZMI8cfCs4js4BEUz7vwf9Iv</token>
    <created_at type="dateTime">2020-02-11T20:49:32Z</created_at>
    <updated_at type="dateTime">2020-02-11T20:49:32Z</updated_at>
    <email>joey@example.com</email>
    <data nil="true"></data>
    <storage_state>cached</storage_state>
    <test type="boolean">true</test>
    <metadata>
      <key>String Value</key>
      <another_key>123</another_key>
      <final_key>true</final_key>
    </metadata>
    <callback_url nil="true"></callback_url>
    <last_four_digits>4444</last_four_digits>
    <first_six_digits>555555</first_six_digits>
    <card_type>master</card_type>
    <first_name>Joey</first_name>
    <last_name>Jones</last_name>
    <month type="integer">3</month>
    <year type="integer">2032</year>
    <address1>33 Lane Road</address1>
    <address2>Apartment 4</address2>
    <city>Wanaque</city>
    <state>NJ</state>
    <zip>31331</zip>
    <country>US</country>
    <phone_number>919.331.3313</phone_number>
    <company>Acme Inc.</company>
    <full_name>Joey Jones</full_name>
    <eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
    <shipping_address1>33 Lane Road</shipping_address1>
    <shipping_address2>Apartment 4</shipping_address2>
    <shipping_city>Wanaque</shipping_city>
    <shipping_state>NJ</shipping_state>
    <shipping_zip>31331</shipping_zip>
    <shipping_country>US</shipping_country>
    <shipping_phone_number>919.331.3313</shipping_phone_number>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value>XXX</verification_value>
    <number>XXXX-XXXX-XXXX-4444</number>
    <fingerprint>b5fe350d5135ab64a8f3c1097fadefd9effb</fingerprint>
  </payment_method>
</transaction>

Add a credit card to the authenticated environment’s vault.

To create a credit card for testing, use one of the test credit card numbers. For more information about testing on Spreedly, please see this guide.

URL Parameters

Parameter Description
format
required
One of json or xml

Request Body

Element Description
payment_method Root element
❯ credit_card Credit card element
❯❯ first_name
required
The first name of the cardholder
❯❯ last_name
required
The last name of the cardholder
❯❯ number
required
The full card number
❯❯ verification_value The verification value (CVV/CVC) of the card
❯❯ month
required
The expiration month of the card
❯❯ year
required
The expiration year of the card
❯❯ full_name
optional: either full_name or both first_name and last_name are required
The full name of the cardholder. If provided, will be parsed to determine first_name and last_name. If “full_name” is entered with only a single name, “first_name” will be populated with “Not Provided” and “last_name” will be populated with the provided name.
❯❯ company The company name associated with the credit card
❯❯ address1 The first line of the billing address
❯❯ address2 The second line of the billing address
❯❯ city The city of the billing address
❯❯ state The state of the billing address
❯❯ zip The zip code of the billing address
❯❯ country The country code of the billing address
❯❯ phone_number The phone number of the billing address
❯❯ shipping_address1 The first line of the shipping address
❯❯ shipping_address2 The second line of the shipping address
❯❯ shipping_city The city of the shipping address
❯❯ shipping_state The state of the shipping address
❯❯ shipping_zip The zip code of the shipping address
❯❯ shipping_country The country code of the shipping address
❯❯ shipping_phone_number The phone number of the shipping address
❯ email The email address of the customer associated with this credit card
❯ retained true if this payment method should be automatically retained on creation
❯ allow_blank_name true if this payment method should skip the name validation requirement
❯ allow_expired_date true if this payment method should skip the expired date validation requirement
❯ allow_blank_date true if this payment method should skip the expiration date validation requirement
❯ eligible_for_card_updater true if this payment method should be included in Account Updater
❯ metadata metadata key-value pairs (limit 25). Keys are limited to 50 characters. Values are limited to 500 characters and cannot contain compounding data types

Response Body

Element Description
transaction Root element
❯ token The token uniquely identifying this transaction (not the created payment method) at Spreedly
❯ succeeded true if the transaction request was successfully executed, false otherwise
❯ retained if the payment method was set to be automatically retained on creation
❯ payment_method The payment method created as part of this transaction
❯❯ token The token identifying the newly created payment method in the Spreedly vault
❯❯ 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, third_party_token, etc…
❯❯ errors If the payment method is invalid (missing required fields, etc…), there will be associated error messages here
❯❯ last_four_digits The last four digits of the credit card number. This can be displayed to the user.
❯❯ first_six_digits The first six digits of the credit card number. This can be displayed to the user.
❯❯ verification_value The obscured verification value (CVV), e.g., XXX or XXXX
❯❯ number The obscured credit card number, e.g., XXXX-XXXX-XXXX-4444
❯❯ month The expiration month
❯❯ year The expiration year

Create bank account

POST /v1/payment_methods.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>

{
  "payment_method": {
    "bank_account": {
      "first_name": "Jon",
      "last_name": "Doe",
      "bank_routing_number": "021000021",
      "bank_account_number": "9876543210",
      "bank_account_type": "checking",
      "bank_account_holder_type": "personal"
    },
    "email": "jon.doe@example.com",
    "data": {
      "my_payment_method_identifier": 448,
      "extra_stuff": {
        "some_other_things": "Can be anything really"
      }
    },
    "metadata": {
      "key": "string value",
      "another_key": 123,
      "final_key": true
    }
  }
}
<payment_method>
  <bank_account>
    <first_name>Jon</first_name>
    <last_name>Doe</last_name>
    <bank_routing_number>021000021</bank_routing_number>
    <bank_account_number>9876543210</bank_account_number>
    <bank_account_type>checking</bank_account_type>
    <bank_account_holder_type>personal</bank_account_holder_type>
  </bank_account>
  <email>jon.doe@example.com</email>
  <data>
    <my_payment_method_identifier>448</my_payment_method_identifier>
    <extra_stuff>
      <some_other_things>Can be anything really</some_other_things>
    </extra_stuff>
  </data>
  <metadata>
    <key>String Value</key>
    <another_key>123</another_key>
    <final_key>true</final_key>
  </metadata>
</payment_method>

HTTPS/1.1 201 Created
{
  "transaction": {
    "token": "CxvS0ws3ML7lvwODZks6i6kNrmT",
    "created_at": "2018-11-06T14:37:26Z",
    "updated_at": "2018-11-06T14:37:26Z",
    "succeeded": true,
    "transaction_type": "AddPaymentMethod",
    "retained": false,
    "state": "succeeded",
    "message_key": "messages.transaction_succeeded",
    "message": "Succeeded!",
    "payment_method": {
      "token": "DSb0ZFuSDlhybP3s1Piw2Ig0re8",
      "created_at": "2018-11-06T14:37:26Z",
      "updated_at": "2018-11-06T14:37:26Z",
      "email": "jon.doe@example.com",
      "data": {
        "my_payment_method_identifier": 448,
        "extra_stuff": {
          "some_other_things": "Can be anything really"
        }
      },
      "storage_state": "cached",
      "test": true,
      "metadata": {
        "key": "string value",
        "another_key": 123,
        "final_key": true
      },
      "full_name": "Jon Doe",
      "bank_name": null,
      "account_type": "checking",
      "account_holder_type": "personal",
      "routing_number_display_digits": "021",
      "account_number_display_digits": "3210",
      "first_name": "Jon",
      "last_name": "Doe",
      "address1": null,
      "address2": null,
      "city": null,
      "state": null,
      "zip": null,
      "country": null,
      "phone_number": null,
      "company": null,
      "payment_method_type": "bank_account",
      "errors": [

      ],
      "routing_number": "021*",
      "account_number": "*3210"
    }
  }
}
<transaction>
  <token>Q2PGUbHNruTTWTfxvl3n3ahb4yf</token>
  <created_at type="dateTime">2018-11-06T14:37:26Z</created_at>
  <updated_at type="dateTime">2018-11-06T14:37:26Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <transaction_type>AddPaymentMethod</transaction_type>
  <retained type="boolean">false</retained>
  <state>succeeded</state>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <payment_method>
    <token>6fkbinCveUr9TmedAg0g0Rjmenx</token>
    <created_at type="dateTime">2018-11-06T14:37:26Z</created_at>
    <updated_at type="dateTime">2018-11-06T14:37:26Z</updated_at>
    <email>jon.doe@example.com</email>
    <data>
      <my_payment_method_identifier>448</my_payment_method_identifier>
      <extra_stuff>
        <some_other_things>Can be anything really</some_other_things>
      </extra_stuff>
    </data>
    <storage_state>cached</storage_state>
    <test type="boolean">true</test>
    <metadata>
      <key>String Value</key>
      <another_key>123</another_key>
      <final_key>true</final_key>
    </metadata>
    <full_name>Jon Doe</full_name>
    <bank_name nil="true"></bank_name>
    <account_type>checking</account_type>
    <account_holder_type>personal</account_holder_type>
    <routing_number_display_digits>021</routing_number_display_digits>
    <account_number_display_digits>3210</account_number_display_digits>
    <first_name>Jon</first_name>
    <last_name>Doe</last_name>
    <address1 nil="true"></address1>
    <address2 nil="true"></address2>
    <city nil="true"></city>
    <state nil="true"></state>
    <zip nil="true"></zip>
    <country nil="true"></country>
    <phone_number nil="true"></phone_number>
    <company nil="true"></company>
    <payment_method_type>bank_account</payment_method_type>
    <errors>
    </errors>
    <routing_number>021*</routing_number>
    <account_number>*3210</account_number>
  </payment_method>
</transaction>

Add a bank account/ACH payment type to the authenticated environment’s vault.

To create a bank account for testing, use one of the test bank account numbers. For more information about testing on Spreedly, please see this guide.

URL Parameters

Parameter Description
format
required
One of json or xml

Request Body

Element Description
payment_method Root element
❯ bank_account Bank account element
❯❯ first_name
required
The first name of the account owner
❯❯ last_name
required
The last name of the account owner
❯❯ bank_routing_number
required
The account routing number
❯❯ bank_account_number
required
The account number
❯❯ bank_account_type The type of account. Can be one of checking or savings.
❯❯ bank_account_holder_type The account holder type. Can be one business or personal.
❯❯ full_name
optional: either full_name or both first_name and last_name are required
The full name of the account owner. If provided, will be parsed to determine first_name and last_name.
❯ retained true if this payment method should be automatically retained on creation
❯ metadata metadata key-value pairs (limit 25). Keys are limited to 50 characters. Values are limited to 500 characters and cannot contain compounding data types

Response Body

Element Description
transaction Root element
❯ token The token uniquely identifying this transaction (not the created payment method) at Spreedly
❯ succeeded true if the transaction request was successfully executed, false otherwise
❯ retained if the payment method was set to be automatically retained on creation
❯ payment_method The payment method created as part of this transaction
❯❯ token The token identifying the newly created payment method in the Spreedly vault
❯❯ 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, third_party_token, etc…
❯❯ errors If the payment method is invalid (missing required fields, etc…), there will be associated error messages here
❯❯ account_type The type of account. Can be one of checking or savings.
❯❯ account_holder_type The account holder type. Can be one business or personal.
❯❯ routing_number_display_digits The obscured (first three digits) routing number. This value can be displayed to users.
❯❯ account_number_display_digits The obscured (last four digits) account number. This value can be displayed to users.

Create Android Pay

POST /v1/payment_methods.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>

{
  "payment_method": {
    "android_pay": {
      "payment_data": {
        "encryptedMessage": "V65NNwqzK0A1bi0F96HQZr4eFA8fWCatwykv3sFA8Cg4Wn4Ylk/szN6GiFTuYQFrHA7a/h0P3tfEQd09bor6pRqrM8/Bt12R0SHKtnQxbYxTjpMr/7C3Um79n0jseaPlK8+CHXljbYifwGB+cEFh/smP8IO1iw3TL/192HesutfVMKm9zpo5mLNzQ2GMU4JWUGIgrzsew6S6XshelrjE",
        "ephemeralPublicKey": "BB9cOXHgf3KcY8dbsU6fhzqTJm3JFvzD+8wcWg0W9r+Xl5gYjoZRxHuYocAx3g82v2o0Le1E2w4sDDl5w3C0lmY=",
        "tag": "boJLmOxDduTV5a34CO2IRbgxUjZ9WmfzxNl1lWqQ+Z0="
      },
      "certificate_token": "Npyj0A5xbeqO1hVNJEa4nvkCHwP",
      "transaction_id": "123456789",
      "test_card_number": "4111111111111111"
    },
    "metadata": {
      "key": "string value",
      "another_key": 123,
      "final_key": true
    }
  }
}
<payment_method>
  <android_pay>
    <payment_data>
<![CDATA[{"encryptedMessage": "V65NNwqzK0A1bi0F96HQZr4eFA8fWCatwykv3sFA8Cg4Wn4Ylk/szN6GiFTuYQFrHA7a/h0P3tfEQd09bor6pRqrM8/Bt12R0SHKtnQxbYxTjpMr/7C3Um79n0jseaPlK8+CHXljbYifwGB+cEFh/smP8IO1iw3TL/192HesutfVMKm9zpo5mLNzQ2GMU4JWUGIgrzsew6S6XshelrjE","ephemeralPublicKey": "BB9cOXHgf3KcY8dbsU6fhzqTJm3JFvzD+8wcWg0W9r+Xl5gYjoZRxHuYocAx3g82v2o0Le1E2w4sDDl5w3C0lmY=","tag": "boJLmOxDduTV5a34CO2IRbgxUjZ9WmfzxNl1lWqQ+Z0="}]]>
    </payment_data>
    <certificate_token>Npyj0A5xbeqO1hVNJEa4nvkCHwP</certificate_token>
    <transaction_id>123456789</transaction_id>
    <test_card_number>4111111111111111</test_card_number>
  </android_pay>
  <metadata>
    <key>String Value</key>
    <another_key>123</another_key>
    <final_key>true</final_key>
  </metadata>
</payment_method>

HTTPS/1.1 201 Created
{
  "transaction": {
    "token": "YjzyHKpnKsJvUcLSYXpMguQkmYM",
    "created_at": "2018-11-06T20:15:26Z",
    "updated_at": "2018-11-06T20:15:26Z",
    "succeeded": true,
    "transaction_type": "AddPaymentMethod",
    "retained": false,
    "state": "succeeded",
    "message_key": "messages.transaction_succeeded",
    "message": "Succeeded!",
    "payment_method": {
      "token": "496sm4u97JcmUwH7H8hjafLrazf",
      "created_at": "2018-11-06T20:15:26Z",
      "updated_at": "2018-11-06T20:15:26Z",
      "email": null,
      "data": null,
      "storage_state": "cached",
      "test": true,
      "metadata": {
        "key": "string value",
        "another_key": 123,
        "final_key": true
      },
      "last_four_digits": "1111",
      "first_six_digits": "411111",
      "card_type": "visa",
      "first_name": null,
      "last_name": null,
      "month": 12,
      "year": 2020,
      "full_name": "",
      "payment_method_type": "android_pay",
      "errors": [

      ]
    }
  }
}
<transaction>
  <token>NzU2j7GzrEMRu4hMLWPUGrQ2S0B</token>
  <created_at type="dateTime">2018-11-06T20:15:26Z</created_at>
  <updated_at type="dateTime">2018-11-06T20:15:26Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <transaction_type>AddPaymentMethod</transaction_type>
  <retained type="boolean">false</retained>
  <state>succeeded</state>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <payment_method>
    <token>J1om9K3hMNH2hQOB0PfYzma4ith</token>
    <created_at type="dateTime">2018-11-06T20:15:26Z</created_at>
    <updated_at type="dateTime">2018-11-06T20:15:26Z</updated_at>
    <email nil="true"></email>
    <data nil="true"></data>
    <storage_state>cached</storage_state>
    <test type="boolean">true</test>
    <metadata>
      <key>String Value</key>
      <another_key>123</another_key>
      <final_key>true</final_key>
    </metadata>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name nil="true"></first_name>
    <last_name nil="true"></last_name>
    <month type="integer">12</month>
    <year type="integer">2020</year>
    <full_name></full_name>
    <payment_method_type>android_pay</payment_method_type>
    <errors>
    </errors>
  </payment_method>
</transaction>

Add an Android Pay payment method to the authenticated environment’s vault.

To create a test Android Pay payment method, set the test_card_number element to one of the known test credit card numbers. For more information about testing on Spreedly, please see this guide.

URL Parameters

Parameter Description
format
required
One of json or xml

Request Body

Element Description
payment_method Root element
❯ android_pay Android pay element
❯❯ payment_data
required
The JSON-formatted encrypted payload Android Pay Payment Token
❯❯ certificate_token The token identifying the Certificate used by the native Android Pay app to encrypt the payment data (the certificate must exist within the same Spreedly environment as this new payment method).
❯❯ transaction_id
optional
The Google Transaction ID (required for some gateways, such as Braintree)
❯❯ test_card_number Android Pay does not provide a way to create a test payment token. To mark this as a test Android Pay payment method, specify a test card number in this field. Doing so will prevent this payment method from being used against a production gateway, while still verifying the submitted Android Pay payment data.
❯ retained true if this payment method should be automatically retained on creation
❯ metadata metadata key-value pairs (limit 25). Keys are limited to 50 characters. Values are limited to 500 characters and cannot contain compounding data types

Response Body

Element Description
transaction Root element
❯ token The token uniquely identifying this transaction (not the created payment method) at Spreedly
❯ succeeded true if the transaction request was successfully executed, false otherwise
❯ retained if the payment method was set to be automatically retained on creation
❯ payment_method The payment method created as part of this transaction
❯❯ token The token identifying the newly created payment method in the Spreedly vault
❯❯ 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, third_party_token, etc…
❯❯ errors If the payment method is invalid (missing required fields, etc…), there will be associated error messages here
❯❯ last_four_digits The last four digits of the (Android Pay alias) credit card number. This can be displayed to the user.
❯❯ first_six_digits The first six digits of the (Android Pay alias) credit card number. This can be displayed to the user.
❯❯ month The expiration month
❯❯ year The expiration year

Create Apple Pay

POST /v1/payment_methods.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>

{
  "payment_method": {
    "apple_pay": {
      "payment_data": {
        "version": "EC_v1",
        "data": "QlzLxRFnNP9/GTaMhBwgmZ2ywntbr9iOcBY4TjPZyNrnCwsJd2cq61bDQjo3agVU0LuEot2VIHHocVrp5jdy0FkxdFhGd+j7hPvutFYGwZPcuuBgROb0beA1wfGDi09I+OWL+8x5+8QPl+y8EAGJdWHXr4CuL7hEj4CjtUhfj5GYLMceUcvwgGaW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Qd65NLQsjrPatzHWbJzG7v5vJtAyrf6WhoNx3C1VchQxYuw==",
          "transactionId": "e220cc1504ec15835a375e9e8659e27dcbc1abe1f959a179d8308dd8211c9371",
          "publicKeyHash": "/4UKqrtx7AmlRvLatYt9LDt64IYo+G9eaqqS6LFOAdI="
        }
      },
      "test_card_number": "4111111111111111"
    },
    "first_name": "John",
    "last_name": "Smith",
    "email": "john.smith@example.com",
    "metadata": {
      "key": "string value",
      "another_key": 123,
      "final_key": true
    },
    "address1": "12345 Example Way",
    "city": "Atlanta",
    "state": "GA",
    "zip": "30301",
    "country": "USA",
    "shipping_address1": "12345 Example Way",
    "shipping_city": "Atlanta",
    "shipping_state": "GA",
    "shipping_zip": "30301",
    "shipping_country": "USA"
  }
}
<payment_method>
  <apple_pay>
    <payment_data>
<![CDATA[{"version":"EC_v1","data":"QlzLxRFnNP9/GTaMhBwgmZ2ywntbr9iOcBY4TjPZyNrnCwsJd2cq61bDQjo3agVU0LuEot2VIHHocVrp5jdy0FkxdFhGd+j7hPvutFYGwZPcuuBgROb0beA1wfGDi09I+OWL+8x5+8QPl+y8EAGJdWHXr4CuL7hEj4CjtUhfj5GYLMceUcvwgGaWY7WzqnEO9UwUowlDP9C3cD21cW8osn/IKROTInGcZB0mzM5bVHM73NSFiFepNL6rQtomp034C+p9mikB4nc+vR49oVop0Pf+uO7YVq7cIWrrpgMG7ussnc3u4bmr3JhCNtKZzRQ2MqTxKv/CfDq099JQIvTj8hbqswv1t+yQ5ZhJ3m4bcPwrcyIVej5J241R7dNPu9xVjM6LSOX9KeGZQGud","signature":"MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCAMIID4jCCA4igAwIBAgIIJEPyqAad9XcwCgYIKoZIzj0EAwIwejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlv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Z/0XfCwhbZZPxnJpghJvVPh6fRuZy5sJiSFhBpkPCZIdAAAxggFfMIIBWwIBATCBhjB6MS4wLAYDVQQDDCVBcHBsZSBBcHBsaWNhdGlvbiBJbnRlZ3JhdGlvbiBDQSAtIEczMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMCCCRD8qgGnfV3MA0GCWCGSAFlAwQCAQUAoGkwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTUwMjI0MTgzNTU5WjAvBgkqhkiG9w0BCQQxIgQgohbm8d0A42OAyMnc5fsgQoCNYjtEd/W/dW6+yezIwoAwCgYIKoZIzj0EAwIERzBFAiEAtEkap+JHypwfL1EdabD7RWPZol3na0LhMk9XzLhis0oCIGwxzOhQnMw+Td8WglTMNYcidqeYILTGzn3zMEXmW3j7AAAAAAAA","header":{"ephemeralPublicKey":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQwjaSlnZ3EXpwKfWAd2e1VnbS6vmioMyF6bNcq/Qd65NLQsjrPatzHWbJzG7v5vJtAyrf6WhoNx3C1VchQxYuw==","transactionId":"e220cc1504ec15835a375e9e8659e27dcbc1abe1f959a179d8308dd8211c9371","publicKeyHash":"/4UKqrtx7AmlRvLatYt9LDt64IYo+G9eaqqS6LFOAdI="}}
]]>
    </payment_data>
    <test_card_number>4111111111111111</test_card_number>
  </apple_pay>
  <email>joey@example.com</email>
  <metadata>
    <key>String Value</key>
    <another_key>123</another_key>
    <final_key>true</final_key>
  </metadata>
  <first_name>Joey</first_name>
  <last_name>Smith</last_name>
  <address1>12345 Example Way</address1>
  <city>Atlanta</city>
  <state>GA</state>
  <zip>30301</zip>
  <country>USA</country>
  <shipping_address1>12345 Example Way</shipping_address1>
  <shipping_city>Atlanta</shipping_city>
  <shipping_state>GA</shipping_state>
  <shipping_zip>30301</shipping_zip>
  <shipping_country>USA</shipping_country>
</payment_method>

HTTPS/1.1 201 Created
{
  "transaction": {
    "token": "T6uE4YJ1Pztb3C2h0n3azd8im3M",
    "created_at": "2018-11-06T20:10:47Z",
    "updated_at": "2018-11-06T20:10:47Z",
    "succeeded": true,
    "transaction_type": "AddPaymentMethod",
    "retained": false,
    "state": "succeeded",
    "message_key": "messages.transaction_succeeded",
    "message": "Succeeded!",
    "payment_method": {
      "token": "HgMCAtQCjZtxuDBC6fqabmvZIAq",
      "created_at": "2018-11-06T20:10:47Z",
      "updated_at": "2018-11-06T20:10:47Z",
      "email": "john.smith@example.com",
      "data": null,
      "storage_state": "cached",
      "test": true,
      "metadata": {
        "key": "string value",
        "another_key": 123,
        "final_key": true
      },
      "last_four_digits": "1111",
      "first_six_digits": "411111",
      "card_type": "visa",
      "first_name": "John",
      "last_name": "Smith",
      "month": 12,
      "year": 2023,
      "full_name": "John Smith",
      "address1": "12345 Example Way",
      "address2": null,
      "city": "Atlanta",
      "state": "GA",
      "zip": "30301",
      "country": "USA",
      "phone_number": null,
      "company": null,
      "shipping_address1": "12345 Example Way",
      "shipping_address2": null,
      "shipping_city": "Atlanta",
      "shipping_state": "GA",
      "shipping_zip": "30301",
      "shipping_country": "USA",
      "shipping_phone_number": null,
      "payment_method_type": "apple_pay",
      "errors": [

      ]
    }
  }
}
<transaction>
  <token>5tozGHP1EGxrVKpHTD2y6ZmJvST</token>
  <created_at type="dateTime">2018-11-06T20:10:46Z</created_at>
  <updated_at type="dateTime">2018-11-06T20:10:47Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <transaction_type>AddPaymentMethod</transaction_type>
  <retained type="boolean">false</retained>
  <state>succeeded</state>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <payment_method>
    <token>8CkRPxdrA3dbvapFrSiPZuXZ4dL</token>
    <created_at type="dateTime">2018-11-06T20:10:46Z</created_at>
    <updated_at type="dateTime">2018-11-06T20:10:47Z</updated_at>
    <email>joey@example.com</email>
    <data nil="true"></data>
    <storage_state>cached</storage_state>
    <test type="boolean">true</test>
    <metadata>
      <key>String Value</key>
      <another_key>123</another_key>
      <final_key>true</final_key>
    </metadata>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>Joey</first_name>
    <last_name>Smith</last_name>
    <month type="integer">12</month>
    <year type="integer">2023</year>
    <full_name>Joey Smith</full_name>
    <address1>12345 Example Way</address1>
    <address2 nil="true"></address2>
    <city>Atlanta</city>
    <state>GA</state>
    <zip>30301</zip>
    <country>USA</country>
    <phone_number nil="true"></phone_number>
    <company nil="true"></company>
    <shipping_address1>12345 Example Way</shipping_address1>
    <shipping_address2 nil="true"></shipping_address2>
    <shipping_city>Atlanta</shipping_city>
    <shipping_state>GA</shipping_state>
    <shipping_zip>30301</shipping_zip>
    <shipping_country>USA</shipping_country>
    <shipping_phone_number nil="true"></shipping_phone_number>
    <payment_method_type>apple_pay</payment_method_type>
    <errors>
    </errors>
  </payment_method>
</transaction>

Add an Apple Pay payment method to the authenticated environment’s vault.

To create a test Apple Pay payment method, set the test_card_number element to one of the known test credit card numbers. For more information about testing on Spreedly, please see this guide.

URL Parameters

Parameter Description
format
required
One of json or xml

Request Body

Element Description
payment_method Root element
❯ apple_pay Apple pay element
❯❯ payment_data
required
The JSON serialized paymentData property of an Apple Pay PKPaymentToken
❯❯ test_card_number Apple Pay does not provide a way to create a test payment token. To mark this as a test Apple Pay payment method, specify a test card number in this field. Doing so will prevent this payment method from being used against a production gateway, while still verifying the submitted Apple Pay payment data.
❯ retained true if this payment method should be automatically retained on creation
❯ email The email address of the cardholder
❯ first_name The first name of the cardholder
❯ last_name The last name of the cardholder
❯ address1 Cardholder’s address, line 1
❯ address2 Cardholder’s address, line 2
❯ city Cardholder’s city
❯ state Cardholder’s state
❯ zip Cardholder’s zip
❯ country Cardholder’s country
❯ metadata metadata key-value pairs (limit 25). Keys are limited to 50 characters. Values are limited to 500 characters and cannot contain compounding data types

Response Body

Element Description
transaction Root element
❯ token The token uniquely identifying this transaction (not the created payment method) at Spreedly
❯ succeeded true if the transaction request was successfully executed, false otherwise
❯ retained if the payment method was set to be automatically retained on creation
❯ payment_method The payment method created as part of this transaction
❯❯ token The token identifying the newly created payment method in the Spreedly vault
❯❯ 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, third_party_token, etc…
❯❯ errors If the payment method is invalid (missing required fields, etc…), there will be associated error messages here
❯❯ last_four_digits The last four digits of the (Apple Pay alias) credit card number. This can be displayed to the user.
❯❯ first_six_digits The first six digits of the (Apple Pay alias) credit card number. This can be displayed to the user.
❯❯ month The expiration month
❯❯ year The expiration year

Create Google Pay

POST /v1/payment_methods.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

Content-Type: application/<format>
{
  "payment_method": {
    "google_pay": {
      "payment_data": {
        "signature": "MEUCIA6SGVRwhOyeYRkeDUUNwB/kGtyfQAlOsg7NZydT17u/AiEA48BhWGQEF1EbEU0J+m8eSK3rTfhok9QqpiFVbME+Ky0=",
        "protocolVersion": "ECv1",
        "signedMessage": "{\"encryptedMessage\":\"3v4IcT/eovIDP2WF8iRUy4qWQnE9Cx0vQxIZ5f9i3Emv3Tzs1AzvB7cxXhxrjp9FVIzdOwsZAPAsm03gvoYq8Xdr70XvrVRd2MFwQhMC7IV/uEsthw4JsR8oCkbI5v/zqhu2B+JodFgavNliHcpKBgijy2D6bpx7jXEkM39M/L4oBObFxFrhVSLA1GjOV6A5gLAXNXt0ffkCYekihqAyJrWlk3sCBDCF5SUiAKEIOIZtzZLgusxjVp6ufZHOHm/53uhAi6JWSJ1E6G5aaYGtULYdwgURHtxN5OIzQPYlEGctaQd5tgfCsBFfGkYyN1GRNgclbaLzAfk/Jn7/6IVKuV0ol3xubTcnjGTZXwtTjiEyYDoz1yVqB9ViMmJa55L6nBtbbAkcNEgAi7dPnrbvBGEP7QWsNT9D71g8SWrlRTCYUAOyuamaQhofG4ul1IVjmltdAy2BHBWpqgJnR9kczydQyE7uDiqhSC1/0eG8GCGIqoi8XfOioGXfMyLZ1p2ZcNK9ECjzUrH/edrwgtShxgWuWMwQTM4DQlVTAA/R4DVs192YWZcc7jm5wLqZ0+XEaPuighJM1Ps1Egeccg\\u003d\\u003d\",\"ephemeralPublicKey\":\"BA2SvF9BdCX7Tl1wwRkyLzTfqhctobhZgSugC9Cz77XNUCBOBMfFyJQt506PUs89D6IJZZfOkZopy0shRF9Uph4\\u003d\",\"tag\":\"Uhin1BE7KAuuiam7eEQFimRUDd9Xn6tZc2fClTpfrXQ\\u003d\"}"
      },
      "first_name": "John",
      "last_name": "Smith",
      "test_card_number": "4111111111111111"
    },
    "email": "john.smith@example.com"
  }
}
<payment_method>
  <google_pay>
    <payment_data>
<![CDATA[{"signature":"MEUCIA6SGVRwhOyeYRkeDUUNwB/kGtyfQAlOsg7NZydT17u/AiEA48BhWGQEF1EbEU0J+m8eSK3rTfhok9QqpiFVbME+Ky0\u003d","protocolVersion":"ECv1","signedMessage":"{\"encryptedMessage\":\"3v4IcT/eovIDP2WF8iRUy4qWQnE9Cx0vQxIZ5f9i3Emv3Tzs1AzvB7cxXhxrjp9FVIzdOwsZAPAsm03gvoYq8Xdr70XvrVRd2MFwQhMC7IV/uEsthw4JsR8oCkbI5v/zqhu2B+JodFgavNliHcpKBgijy2D6bpx7jXEkM39M/L4oBObFxFrhVSLA1GjOV6A5gLAXNXt0ffkCYekihqAyJrWlk3sCBDCF5SUiAKEIOIZtzZLgusxjVp6ufZHOHm/53uhAi6JWSJ1E6G5aaYGtULYdwgURHtxN5OIzQPYlEGctaQd5tgfCsBFfGkYyN1GRNgclbaLzAfk/Jn7/6IVKuV0ol3xubTcnjGTZXwtTjiEyYDoz1yVqB9ViMmJa55L6nBtbbAkcNEgAi7dPnrbvBGEP7QWsNT9D71g8SWrlRTCYUAOyuamaQhofG4ul1IVjmltdAy2BHBWpqgJnR9kczydQyE7uDiqhSC1/0eG8GCGIqoi8XfOioGXfMyLZ1p2ZcNK9ECjzUrH/edrwgtShxgWuWMwQTM4DQlVTAA/R4DVs192YWZcc7jm5wLqZ0+XEaPuighJM1Ps1Egeccg\\u003d\\u003d\",\"ephemeralPublicKey\":\"BA2SvF9BdCX7Tl1wwRkyLzTfqhctobhZgSugC9Cz77XNUCBOBMfFyJQt506PUs89D6IJZZfOkZopy0shRF9Uph4\\u003d\",\"tag\":\"Uhin1BE7KAuuiam7eEQFimRUDd9Xn6tZc2fClTpfrXQ\\u003d\"}"}
]]>
    </payment_data>
    <first_name>John</first_name>
    <last_name>Smith</last_name>
    <test_card_number>4111111111111111</test_card_number>
  </google_pay>
  <email>john.smith@example.com</email>
</payment_method>

HTTPS/1.1 201 Created
{
  "transaction": {
    "token": "1n4j3sExB12GFJcncZnPdZXMaXs",
    "created_at": "2018-09-25T15:59:50Z",
    "updated_at": "2018-09-25T15:59:50Z",
    "succeeded": true,
    "transaction_type": "AddPaymentMethod",
    "retained": false,
    "state": "succeeded",
    "message_key": "messages.transaction_succeeded",
    "message": "Succeeded!",
    "payment_method": {
      "token": "2w9cGgCkg77AmZj8xFLNQnKPdSh",
      "created_at": "2018-09-25T15:59:50Z",
      "updated_at": "2018-09-25T15:59:50Z",
      "email": "john.smith@example.com",
      "data": null,
      "storage_state": "cached",
      "test": true,
      "metadata": null,
      "last_four_digits": "1111",
      "first_six_digits": "411111",
      "card_type": "visa",
      "first_name": "John",
      "last_name": "Smith",
      "month": 12,
      "year": 2023,
      "full_name": "John Smith",
      "address1": null,
      "address2": null,
      "city": null,
      "state": null,
      "zip": null,
      "country": null,
      "phone_number": null,
      "company": null,
      "shipping_address1": null,
      "shipping_address2": null,
      "shipping_city": null,
      "shipping_state": null,
      "shipping_zip": null,
      "shipping_country": null,
      "shipping_phone_number": null,
      "payment_method_type": "google_pay",
      "errors": [

      ]
    }
  }
}
<transaction>
  <token>9v92w2708YpQ5KYxsz62oZRlPsx</token>
  <created_at type="dateTime">2018-09-25T15:59:50Z</created_at>
  <updated_at type="dateTime">2018-09-25T15:59:50Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <transaction_type>AddPaymentMethod</transaction_type>
  <retained type="boolean">false</retained>
  <state>succeeded</state>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <payment_method>
    <token>UbOdSftBw7YlCG6BXB0szSGKwGZ</token>
    <created_at type="dateTime">2018-09-25T15:59:50Z</created_at>
    <updated_at type="dateTime">2018-09-25T15:59:50Z</updated_at>
    <email>john.smith@example.com</email>
    <data nil="true"></data>
    <storage_state>cached</storage_state>
    <test type="boolean">true</test>
    <metadata nil="true"></metadata>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>John</first_name>
    <last_name>Smith</last_name>
    <month type="integer">12</month>
    <year type="integer">2023</year>
    <full_name>John Smith</full_name>
    <address1 nil="true"></address1>
    <address2 nil="true"></address2>
    <city nil="true"></city>
    <state nil="true"></state>
    <zip nil="true"></zip>
    <country nil="true"></country>
    <phone_number nil="true"></phone_number>
    <company nil="true"></company>
    <shipping_address1 nil="true"></shipping_address1>
    <shipping_address2 nil="true"></shipping_address2>
    <shipping_city nil="true"></shipping_city>
    <shipping_state nil="true"></shipping_state>
    <shipping_zip nil="true"></shipping_zip>
    <shipping_country nil="true"></shipping_country>
    <shipping_phone_number nil="true"></shipping_phone_number>
    <payment_method_type>google_pay</payment_method_type>
    <errors>
    </errors>
  </payment_method>
</transaction>

Add an Google Pay payment method to the authenticated environment’s vault.

To create a test Google Pay payment method, set the test_card_number element to one of the known test credit card numbers. For more information about testing on Spreedly, please see this guide.

URL Parameters

Parameter Description
format
required
One of json or xml

Request Body

Element Description
payment_method Root element
❯ Google_pay Google pay element
❯❯ payment_data
required
The JSON serialized paymentData
❯❯ test_card_number Specify a test card number in this field. Doing so will prevent this payment method from being used against a production gateway, while still verifying the submitted Google Pay payment data.
❯❯ first_name The first name of the cardholder
❯❯ last_name The last name of the cardholder
❯❯ address1 Cardholder’s address, line 1
❯❯ address2 Cardholder’s address, line 2
❯❯ city Cardholder’s city
❯❯ state Cardholder’s state
❯❯ zip Cardholder’s zip
❯❯ country Cardholder’s country
❯ retained true if this payment method should be automatically retained on creation
❯ email The email address of the cardholder
❯ metadata metadata key-value pairs (limit 25). Keys are limited to 50 characters. Values are limited to 500 characters and cannot contain compounding data types

Response Body

Element Description
transaction Root element
❯ token The token uniquely identifying this transaction (not the created payment method) at Spreedly
❯ succeeded true if the transaction request was successfully executed, false otherwise
❯ retained if the payment method was set to be automatically retained on creation
❯ payment_method The payment method created as part of this transaction
❯❯ token The token identifying the newly created payment method in the Spreedly vault
❯❯ 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, third_party_token, etc…
❯❯ errors If the payment method is invalid (missing required fields, etc…), there will be associated error messages here
❯❯ last_four_digits The last four digits of the (Google Pay alias) credit card number. This can be displayed to the user.
❯❯ first_six_digits The first six digits of the (Google Pay alias) credit card number. This can be displayed to the user.
❯❯ month The expiration month
❯❯ year The expiration year

Create third party token

POST /v1/payment_methods.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>

{
  "payment_method": {
    "payment_method_type": "third_party_token",
    "reference": "MF424cE3jPVESunRNZW0oFtmyI4",
    "gateway_type": "litle"
  }
}
<payment_method>
  <payment_method_type>third_party_token</payment_method_type>
  <reference>MF424cE3jPVESunRNZW0oFtmyI4</reference>
  <gateway_type>litle</gateway_type>
</payment_method>

HTTPS/1.1 201 Created
{
  "transaction": {
    "token": "ActkD0upyjQvkvtER6ra7vdpZJQ",
    "created_at": "2017-07-27T17:55:02Z",
    "updated_at": "2017-07-27T17:55:02Z",
    "succeeded": true,
    "transaction_type": "AddPaymentMethod",
    "retained": false,
    "state": "succeeded",
    "message_key": "messages.transaction_succeeded",
    "message": "Succeeded!",
    "payment_method": {
      "token": "8s5YC3RaRv3zfLVNmuzVep9Mo0z",
      "created_at": "2017-07-27T17:55:02Z",
      "updated_at": "2017-07-27T17:55:02Z",
      "gateway_type": "litle",
      "storage_state": "cached",
      "third_party_token": "MF424cE3jPVESunRNZW0oFtmyI4",
      "payment_method_type": "third_party_token",
      "errors": [

      ]
    }
  }
}
<transaction>
  <token>XLRFd2gmnEVAx7K3Ryme25dvlhU</token>
  <created_at type="dateTime">2017-07-27T17:55:03Z</created_at>
  <updated_at type="dateTime">2017-07-27T17:55:03Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <transaction_type>AddPaymentMethod</transaction_type>
  <retained type="boolean">false</retained>
  <state>succeeded</state>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <payment_method>
    <token>ZeA4EtYPFZ8Km9OlKkd3RWOFFQv</token>
    <created_at type="dateTime">2017-07-27T17:55:03Z</created_at>
    <updated_at type="dateTime">2017-07-27T17:55:03Z</updated_at>
    <gateway_type>litle</gateway_type>
    <storage_state>cached</storage_state>
    <third_party_token>MF424cE3jPVESunRNZW0oFtmyI4</third_party_token>
    <payment_method_type>third_party_token</payment_method_type>
    <errors>
    </errors>
  </payment_method>
</transaction>

Add a third party token payment method to the authenticated environment’s vault.

Third party tokens are payment methods stored in the Spreedly vault, that are a reference to another payment method stored at the gateway’s vault. For more information about third party tokens, please see this guide.

URL Parameters

Parameter Description
format
required
One of json or xml

Request Body

Element Description
payment_method Root element
❯ payment_method_type third_party_token to represent an externally vaulted payment method reference
❯ reference The token identifying the payment method at the external gateway
❯ gateway_type The type of the external gateway

Response Body

Element Description
transaction Root element
❯ token The token uniquely identifying this transaction (not the created payment method) at Spreedly
❯ succeeded true if the transaction request was successfully executed, false otherwise
❯ retained if the payment method was set to be automatically retained on creation
❯ payment_method The payment method created as part of this transaction
❯❯ token The token identifying the newly created payment method in the Spreedly vault
❯❯ 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, third_party_token, etc…
❯❯ errors If the payment method is invalid (missing required fields, etc…), there will be associated error messages here
❯❯ third_party_token The token identifying the payment method at the external gateway
❯❯ gateway_type The type of the external gateway at which the target payment method is stored

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",
      "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",
      "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>
    <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>
    <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, or cached. 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
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

Show

GET /v1/payment_methods/<payment_method_token>.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

HTTPS/1.1 200 OK
{
  "payment_method": {
    "token": "1rpKvP8zOUhj4Y9EDrIoIYQzzD5",
    "created_at": "2017-06-26T17:04:38Z",
    "updated_at": "2018-11-07T15:19:09Z",
    "email": "joey@example.com",
    "data": {
      "my_payment_method_identifier": "448",
      "extra_stuff": {
        "some_other_things": "Can be anything really"
      }
    },
    "storage_state": "retained",
    "test": true,
    "metadata": {
      "key": "string value",
      "another_key": 123,
      "final_key": true
    },
    "last_four_digits": "1111",
    "first_six_digits": "411111",
    "card_type": "visa",
    "first_name": "Newfirst",
    "last_name": "Newlast",
    "month": 3,
    "year": 2032,
    "address1": null,
    "address2": null,
    "city": null,
    "state": null,
    "zip": null,
    "country": null,
    "phone_number": null,
    "company": null,
    "full_name": "Newfirst Newlast",
    "eligible_for_card_updater": true,
    "shipping_address1": null,
    "shipping_address2": null,
    "shipping_city": null,
    "shipping_state": null,
    "shipping_zip": null,
    "shipping_country": null,
    "shipping_phone_number": null,
    "payment_method_type": "credit_card",
    "errors": [

    ],
    "fingerprint": "e3cef43464fc832f6e04f187df25af497994",
    "verification_value": "XXX",
    "number": "XXXX-XXXX-XXXX-1111"
  }
}
<payment_method>
  <token>1rpKvP8zOUhj4Y9EDrIoIYQzzD5</token>
  <created_at type="dateTime">2017-06-26T17:04:38Z</created_at>
  <updated_at type="dateTime">2018-11-07T15:19:09Z</updated_at>
  <email>joey@example.com</email>
  <data>
    <my_payment_method_identifier>448</my_payment_method_identifier>
    <extra_stuff>
      <some_other_things>Can be anything really</some_other_things>
    </extra_stuff>
  </data>
  <storage_state>retained</storage_state>
  <test type="boolean">true</test>
  <metadata>
    <key>string value</key>
    <another_key type="integer">123</another_key>
    <final_key type="boolean">true</final_key>
  </metadata>
  <last_four_digits>1111</last_four_digits>
  <first_six_digits>411111</first_six_digits>
  <card_type>visa</card_type>
  <first_name>Newfirst</first_name>
  <last_name>Newlast</last_name>
  <month type="integer">3</month>
  <year type="integer">2032</year>
  <address1 nil="true"></address1>
  <address2 nil="true"></address2>
  <city nil="true"></city>
  <state nil="true"></state>
  <zip nil="true"></zip>
  <country nil="true"></country>
  <phone_number nil="true"></phone_number>
  <company nil="true"></company>
  <full_name>Newfirst Newlast</full_name>
  <eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
  <shipping_address1 nil="true"></shipping_address1>
  <shipping_address2 nil="true"></shipping_address2>
  <shipping_city nil="true"></shipping_city>
  <shipping_state nil="true"></shipping_state>
  <shipping_zip nil="true"></shipping_zip>
  <shipping_country nil="true"></shipping_country>
  <shipping_phone_number nil="true"></shipping_phone_number>
  <payment_method_type>credit_card</payment_method_type>
  <errors>
  </errors>
  <verification_value>XXX</verification_value>
  <number>XXXX-XXXX-XXXX-1111</number>
  <fingerprint>e3cef43464fc832f6e04f187df25af497994</fingerprint>
</payment_method>

Get a payment method with the given token.

URL Parameters

Parameter Description
payment_method_token
required
The token of the payment method
format
required
One of json or xml

Response Body

Notable response elements include:

Element Description
payment_method Root element
❯ token The token identifying the newly created payment method in the Spreedly vault
❯ 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, third_party_token, etc…
❯ errors If the payment method is invalid (missing required fields, etc…), there will be associated error messages here

Update

PUT /v1/payment_methods/56wyNnSmuA6CWYP7w0MiYCVIbW6.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>

{
  "payment_method": {
    "first_name": "Newfirst",
    "last_name": "Newlast",
    "metadata": {
      "key": "string value",
      "another_key": 123,
      "final_key": true
    }
  }
}
<payment_method>
  <first_name>Newfirst</first_name>
  <last_name>Newlast</last_name>
  <metadata>
    <key>String Value</key>
    <another_key>123</another_key>
    <final_key>true</final_key>
  </metadata>
</payment_method>

HTTPS/1.1 200 OK
{
  "payment_method": {
    "token": "KeGDLmLpAGDzMNOfl9TkC26qrvu",
    "created_at": "2018-11-06T15:59:42Z",
    "updated_at": "2018-11-06T18:36:11Z",
    "email": null,
    "data": null,
    "storage_state": "retained",
    "test": true,
    "metadata": {
      "key": "string value",
      "another_key": 123,
      "final_key": true
    },
    "last_four_digits": "1111",
    "first_six_digits": "411111",
    "card_type": "visa",
    "first_name": "Newfirst",
    "last_name": "Newlast",
    "month": 4,
    "year": 2020,
    "address1": null,
    "address2": null,
    "city": null,
    "state": null,
    "zip": null,
    "country": null,
    "phone_number": null,
    "company": null,
    "full_name": "Newfirst Newlast",
    "eligible_for_card_updater": true,
    "shipping_address1": null,
    "shipping_address2": null,
    "shipping_city": null,
    "shipping_state": null,
    "shipping_zip": null,
    "shipping_country": null,
    "shipping_phone_number": null,
    "payment_method_type": "credit_card",
    "errors": [

    ],
    "fingerprint": "f5ad8cbcd87e3253e1e57a817c3cde4df4f3",
    "verification_value": "",
    "number": "XXXX-XXXX-XXXX-1111"
  }
}
<payment_method>
  <token>KeGDLmLpAGDzMNOfl9TkC26qrvu</token>
  <created_at type="dateTime">2018-11-06T15:59:42Z</created_at>
  <updated_at type="dateTime">2018-11-06T18:36:11Z</updated_at>
  <email nil="true"></email>
  <data nil="true"></data>
  <storage_state>retained</storage_state>
  <test type="boolean">true</test>
  <metadata>
    <key>String Value</key>
    <another_key>123</another_key>
    <final_key>true</final_key>
  </metadata>
  <last_four_digits>1111</last_four_digits>
  <first_six_digits>411111</first_six_digits>
  <card_type>visa</card_type>
  <first_name>Newfirst</first_name>
  <last_name>Newlast</last_name>
  <month type="integer">4</month>
  <year type="integer">2020</year>
  <address1 nil="true"></address1>
  <address2 nil="true"></address2>
  <city nil="true"></city>
  <state nil="true"></state>
  <zip nil="true"></zip>
  <country nil="true"></country>
  <phone_number nil="true"></phone_number>
  <company nil="true"></company>
  <full_name>Newfirst Newlast</full_name>
  <eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
  <shipping_address1 nil="true"></shipping_address1>
  <shipping_address2 nil="true"></shipping_address2>
  <shipping_city nil="true"></shipping_city>
  <shipping_state nil="true"></shipping_state>
  <shipping_zip nil="true"></shipping_zip>
  <shipping_country nil="true"></shipping_country>
  <shipping_phone_number nil="true"></shipping_phone_number>
  <payment_method_type>credit_card</payment_method_type>
  <errors>
  </errors>
  <verification_value></verification_value>
  <number>XXXX-XXXX-XXXX-1111</number>
  <fingerprint>f5ad8cbcd87e3253e1e57a817c3cde4df4f3</fingerprint>
</payment_method>

Update a payment method’s non-sensitive attributes.

URL Parameters

Parameter Description
payment_method_token
required
The token of the payment method
format
required
One of json or xml

Request Body

Element Description
payment_method Root element
attribute One or more non-sensitive attributes to update. Non-sensitive attributes are attributes excluding card numbers, verification values (CVV), bank account numbers etc…
❯ allow_blank_name true if this payment method should skip the name validation requirement (credit card only)
❯ allow_expired_date true if this payment method should skip the expired date validation requirement (credit card only)
❯ allow_blank_date true if this payment method should skip the expiration date validation requirement
❯ eligible_for_card_updater true if this payment method should be included in Account Updater
❯ metadata metadata key-value pairs (limit 25). Keys are limited to 50 characters. Values are limited to 500 characters and cannot contain compounding data types

Response Body

Element Description
payment_method Root element
❯ token The token uniquely identifying the updated payment method

Delete metadata

DELETE /v1/payment_methods/56wyNnSmuA6CWYP7w0MiYCVIbW6/metadata.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>

{
  "keys": [
    "another_key",
    "final_key"
  ]
}
<keys type="array">
  <value>another_key</value>
  <value>final_key</value>
</keys>

HTTPS/1.1 200 OK
{
  "payment_method": {
    "token": "1rpKvP8zOUhj4Y9EDrIoIYQzzD5",
    "created_at": "2017-06-26T17:04:38Z",
    "updated_at": "2018-11-07T20:42:14Z",
    "email": "joey@example.com",
    "data": {
      "my_payment_method_identifier": "448",
      "extra_stuff": {
        "some_other_things": "Can be anything really"
      }
    },
    "storage_state": "retained",
    "test": true,
    "metadata": {
      "key": "string value"
    },
    "last_four_digits": "1111",
    "first_six_digits": "411111",
    "card_type": "visa",
    "first_name": "Newfirst",
    "last_name": "Newlast",
    "month": 3,
    "year": 2032,
    "address1": null,
    "address2": null,
    "city": null,
    "state": null,
    "zip": null,
    "country": null,
    "phone_number": null,
    "company": null,
    "full_name": "Newfirst Newlast",
    "eligible_for_card_updater": true,
    "shipping_address1": null,
    "shipping_address2": null,
    "shipping_city": null,
    "shipping_state": null,
    "shipping_zip": null,
    "shipping_country": null,
    "shipping_phone_number": null,
    "payment_method_type": "credit_card",
    "errors": [

    ],
    "fingerprint": "e3cef43464fc832f6e04f187df25af497994",
    "verification_value": "",
    "number": "XXXX-XXXX-XXXX-1111"
  }
}
<payment_method>
  <token>1rpKvP8zOUhj4Y9EDrIoIYQzzD5</token>
  <created_at type="dateTime">2017-06-26T17:04:38Z</created_at>
  <updated_at type="dateTime">2018-11-07T20:47:26Z</updated_at>
  <email>joey@example.com</email>
  <data>
    <my_payment_method_identifier>448</my_payment_method_identifier>
    <extra_stuff>
      <some_other_things>Can be anything really</some_other_things>
    </extra_stuff>
  </data>
  <storage_state>retained</storage_state>
  <test type="boolean">true</test>
  <metadata>
    <key>string value</key>
  </metadata>
  <last_four_digits>1111</last_four_digits>
  <first_six_digits>411111</first_six_digits>
  <card_type>visa</card_type>
  <first_name>Newfirst</first_name>
  <last_name>Newlast</last_name>
  <month type="integer">3</month>
  <year type="integer">2032</year>
  <address1 nil="true"></address1>
  <address2 nil="true"></address2>
  <city nil="true"></city>
  <state nil="true"></state>
  <zip nil="true"></zip>
  <country nil="true"></country>
  <phone_number nil="true"></phone_number>
  <company nil="true"></company>
  <full_name>Newfirst Newlast</full_name>
  <eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
  <shipping_address1 nil="true"></shipping_address1>
  <shipping_address2 nil="true"></shipping_address2>
  <shipping_city nil="true"></shipping_city>
  <shipping_state nil="true"></shipping_state>
  <shipping_zip nil="true"></shipping_zip>
  <shipping_country nil="true"></shipping_country>
  <shipping_phone_number nil="true"></shipping_phone_number>
  <payment_method_type>credit_card</payment_method_type>
  <errors>
  </errors>
  <verification_value></verification_value>
  <number>XXXX-XXXX-XXXX-1111</number>
  <fingerprint>e3cef43464fc832f6e04f187df25af497994</fingerprint>
</payment_method>

Remove key value pairs from a payment method’s metadata.

URL Parameters

Parameter Description
keys An array of metadata key whose key/value pairs will be deleted. If a metadata key does not already exist, it will be ignored.

Retain

PUT /v1/payment_methods/56wyNnSmuA6CWYP7w0MiYCVIbW6/retain.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==


HTTPS/1.1 200 OK
{
  "transaction": {
    "token": "ZpsccSXUp1OUcUf96UhinOM0C4e",
    "created_at": "2018-11-07T15:52:04Z",
    "updated_at": "2018-11-07T15:52:04Z",
    "succeeded": true,
    "transaction_type": "RetainPaymentMethod",
    "state": "succeeded",
    "message_key": "messages.transaction_succeeded",
    "message": "Succeeded!",
    "payment_method": {
      "token": "1rpKvP8zOUhj4Y9EDrIoIYQzzD5",
      "created_at": "2017-06-26T17:04:38Z",
      "updated_at": "2018-11-07T15:52:04Z",
      "email": "joey@example.com",
      "data": {
        "my_payment_method_identifier": "448",
        "extra_stuff": {
          "some_other_things": "Can be anything really"
        }
      },
      "storage_state": "retained",
      "test": true,
      "metadata": {
        "key": "string value",
        "another_key": 123,
        "final_key": true
      },
      "last_four_digits": "1111",
      "first_six_digits": "411111",
      "card_type": "visa",
      "first_name": "Newfirst",
      "last_name": "Newlast",
      "month": 3,
      "year": 2032,
      "address1": null,
      "address2": null,
      "city": null,
      "state": null,
      "zip": null,
      "country": null,
      "phone_number": null,
      "company": null,
      "full_name": "Newfirst Newlast",
      "eligible_for_card_updater": true,
      "shipping_address1": null,
      "shipping_address2": null,
      "shipping_city": null,
      "shipping_state": null,
      "shipping_zip": null,
      "shipping_country": null,
      "shipping_phone_number": null,
      "payment_method_type": "credit_card",
      "errors": [

      ],
      "fingerprint": "e3cef43464fc832f6e04f187df25af497994",
      "verification_value": "",
      "number": "XXXX-XXXX-XXXX-1111"
    }
  }
}
<transaction>
  <token>Wx8ynH3JNYXXBAhSAsYg3UHa0ZS</token>
  <created_at type="dateTime">2018-11-07T15:52:04Z</created_at>
  <updated_at type="dateTime">2018-11-07T15:52:04Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <transaction_type>RetainPaymentMethod</transaction_type>
  <state>succeeded</state>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <payment_method>
    <token>1rpKvP8zOUhj4Y9EDrIoIYQzzD5</token>
    <created_at type="dateTime">2017-06-26T17:04:38Z</created_at>
    <updated_at type="dateTime">2018-11-07T15:52:04Z</updated_at>
    <email>joey@example.com</email>
    <data>
      <my_payment_method_identifier>448</my_payment_method_identifier>
      <extra_stuff>
        <some_other_things>Can be anything really</some_other_things>
      </extra_stuff>
    </data>
    <storage_state>retained</storage_state>
    <test type="boolean">true</test>
    <metadata>
      <key>string value</key>
      <another_key type="integer">123</another_key>
      <final_key type="boolean">true</final_key>
    </metadata>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>Newfirst</first_name>
    <last_name>Newlast</last_name>
    <month type="integer">3</month>
    <year type="integer">2032</year>
    <address1 nil="true"></address1>
    <address2 nil="true"></address2>
    <city nil="true"></city>
    <state nil="true"></state>
    <zip nil="true"></zip>
    <country nil="true"></country>
    <phone_number nil="true"></phone_number>
    <company nil="true"></company>
    <full_name>Newfirst Newlast</full_name>
    <eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
    <shipping_address1 nil="true"></shipping_address1>
    <shipping_address2 nil="true"></shipping_address2>
    <shipping_city nil="true"></shipping_city>
    <shipping_state nil="true"></shipping_state>
    <shipping_zip nil="true"></shipping_zip>
    <shipping_country nil="true"></shipping_country>
    <shipping_phone_number nil="true"></shipping_phone_number>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value></verification_value>
    <number>XXXX-XXXX-XXXX-1111</number>
    <fingerprint>e3cef43464fc832f6e04f187df25af497994</fingerprint>
  </payment_method>
</transaction>

Retain (keep in the Spreedly vault for future use) a payment method.

URL Parameters

Parameter Description
payment_method_token
required
The token of the payment method
format
required
One of json or xml

Response Body

Notable response elements include:

Element Description
transaction Root element
❯ token The token uniquely identifying this transaction at Spreedly
❯ succeeded true if the transaction request was successfully executed, false otherwise
❯ message A human-readable string indicating the result of the transaction
❯ payment_method The payment method that was retained
❯❯ storage_state The new state of the payment method (retained)

Store

POST /v1/gateways/<gateway_token>/store.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>

{
  "transaction": {
    "payment_method_token": "56wyNnSmuA6CWYP7w0MiYCVIbW6"
  }
}
<transaction>
  <payment_method_token>56wyNnSmuA6CWYP7w0MiYCVIbW6</payment_method_token>
</transaction>

HTTPS/1.1 200 OK
{
  "transaction": {
    "created_at": "2018-11-06T18:50:35Z",
    "updated_at": "2018-11-06T18:50:35Z",
    "succeeded": true,
    "token": "FOaHsTRx3zmL2jOZ33GNRQnV3p1",
    "state": "succeeded",
    "gateway_specific_fields": null,
    "gateway_specific_response_fields": {
    },
    "transaction_type": "Store",
    "third_party_token": null,
    "gateway_transaction_id": "65",
    "gateway_latency_ms": 5,
    "message_key": "messages.transaction_succeeded",
    "message": "Succeeded!",
    "gateway_token": "Z2QU3qXVcRZ8jZwNeIwE5DuN47B",
    "gateway_type": "test",
    "payment_method": {
      "token": "N1YxpW1KgYqd7ychABRJMu64vjN",
      "created_at": "2018-11-06T18:50:35Z",
      "updated_at": "2018-11-06T18:50:35Z",
      "gateway_type": "test",
      "storage_state": "retained",
      "third_party_token": "test_vault:4111111111111111",
      "payment_method_type": "third_party_token",
      "errors": [

      ]
    },
    "basis_payment_method": {
      "token": "56wyNnSmuA6CWYP7w0MiYCVIbW6",
      "created_at": "2018-11-06T15:59:42Z",
      "updated_at": "2018-11-06T18:50:35Z",
      "email": null,
      "data": null,
      "storage_state": "retained",
      "test": true,
      "metadata": {
        "key": "string value",
        "another_key": 123,
        "final_key": true
      },
      "last_four_digits": "1111",
      "first_six_digits": "411111",
      "card_type": "visa",
      "first_name": "Newfirst",
      "last_name": "Newlast",
      "month": 4,
      "year": 2020,
      "address1": null,
      "address2": null,
      "city": null,
      "state": null,
      "zip": null,
      "country": null,
      "phone_number": null,
      "company": null,
      "full_name": "Newfirst Newlast",
      "eligible_for_card_updater": true,
      "shipping_address1": null,
      "shipping_address2": null,
      "shipping_city": null,
      "shipping_state": null,
      "shipping_zip": null,
      "shipping_country": null,
      "shipping_phone_number": null,
      "payment_method_type": "credit_card",
      "errors": [

      ],
      "fingerprint": "f5ad8cbcd87e3253e1e57a817c3cde4df4f3",
      "verification_value": "",
      "number": "XXXX-XXXX-XXXX-1111"
    },
    "response": {
      "success": true,
      "message": "Successful store",
      "avs_code": null,
      "avs_message": null,
      "cvv_code": null,
      "cvv_message": null,
      "pending": false,
      "result_unknown": false,
      "error_code": null,
      "error_detail": null,
      "cancelled": false,
      "fraud_review": null,
      "created_at": "2018-11-06T18:50:35Z",
      "updated_at": "2018-11-06T18:50:35Z"
    }
  }
}
<transaction>
  <created_at type="dateTime">2018-11-06T18:50:35Z</created_at>
  <updated_at type="dateTime">2018-11-06T18:50:35Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <token>LdzKITWaEPZEbSzllG8CALzIDbP</token>
  <state>succeeded</state>
  <gateway_specific_fields nil="true"/>
  <gateway_specific_response_fields>
  </gateway_specific_response_fields>
  <transaction_type>Store</transaction_type>
  <third_party_token nil="true"/>
  <gateway_transaction_id>57</gateway_transaction_id>
  <gateway_latency_ms type="integer">7</gateway_latency_ms>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <gateway_token>Z2QU3qXVcRZ8jZwNeIwE5DuN47B</gateway_token>
  <gateway_type>test</gateway_type>
  <payment_method>
    <token>6ePMbgPupjOMVU9a7rTpvgZ7uEF</token>
    <created_at type="dateTime">2018-11-06T18:50:35Z</created_at>
    <updated_at type="dateTime">2018-11-06T18:50:35Z</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>
    <errors>
    </errors>
  </payment_method>
  <basis_payment_method>
    <token>56wyNnSmuA6CWYP7w0MiYCVIbW6</token>
    <created_at type="dateTime">2018-11-06T15:59:42Z</created_at>
    <updated_at type="dateTime">2018-11-06T18:50:35Z</updated_at>
    <email nil="true"/>
    <data nil="true"/>
    <storage_state>retained</storage_state>
    <test type="boolean">true</test>
    <metadata>
      <key>string value</key>
      <another_key type="integer">123</another_key>
      <final_key type="boolean">true</final_key>
    </metadata>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>Newfirst</first_name>
    <last_name>Newlast</last_name>
    <month type="integer">4</month>
    <year type="integer">2020</year>
    <address1 nil="true"/>
    <address2 nil="true"/>
    <city nil="true"/>
    <state nil="true"/>
    <zip nil="true"/>
    <country nil="true"/>
    <phone_number nil="true"/>
    <company nil="true"/>
    <full_name>Newfirst Newlast</full_name>
    <eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
    <shipping_address1 nil="true"/>
    <shipping_address2 nil="true"/>
    <shipping_city nil="true"/>
    <shipping_state nil="true"/>
    <shipping_zip nil="true"/>
    <shipping_country nil="true"/>
    <shipping_phone_number nil="true"/>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value></verification_value>
    <number>XXXX-XXXX-XXXX-1111</number>
    <fingerprint>f5ad8cbcd87e3253e1e57a817c3cde4df4f3</fingerprint>
  </basis_payment_method>
  <response>
    <success type="boolean">true</success>
    <message>Successful store</message>
    <avs_code nil="true"/>
    <avs_message nil="true"/>
    <cvv_code nil="true"/>
    <cvv_message nil="true"/>
    <pending type="boolean">false</pending>
    <result_unknown type="boolean">false</result_unknown>
    <error_code nil="true"/>
    <error_detail nil="true"/>
    <cancelled type="boolean">false</cancelled>
    <fraud_review nil="true"/>
    <created_at type="dateTime">2018-11-06T18:50:35Z</created_at>
    <updated_at type="dateTime">2018-11-06T18:50:35Z</updated_at>
  </response>
</transaction>

Tokenize a payment method at the gateway.

This transaction copies the payment method information from the Spreedly vault to the gateway’s vault and creates a new Spreedly payment method to represent the gateway’s version. The reference to the payment method at the gateway is called a ThirdPartyToken and is a separate payment method from the original payment method. It is up to you to manage the lifecycle of these linked payment methods – Spreedly does not keep them in sync in any way.

The ThirdPartyToken is locked to the gateway where the card is stored; it cannot be used at another gateway. If you’d like a card to be used at multiple gateways, you’ll need to retain the card in the Spreedly vault.

URL Parameters

Parameter Description
gateway_token
required
The token of the gateway to execute against
format
required
One of json or xml

Request Body

Element Description
transaction Root element
❯ payment_method_token
required
The token of the payment method to copy to the gateway
❯ currency_code The currency of the funds, as ISO 4217 alpha currency codes, e.g., USD for US dollars. Some gateways may need this for a store call but most do not.

Response Body

Notable response elements include:

Element Description
transaction Root element
❯ token The token uniquely identifying this transaction at Spreedly
❯ succeeded true if the transaction request was successfully executed, false otherwise
❯ message A human-readable string indicating the result of the transaction
❯ gateway_transaction_id The id of the transaction at the gateway. To be used when corresponding with the gateway or reconciling transactions.
❯ response Unmodified details of the gateway response, including the message and error_code, if applicable. For failed transactions these fields can help determine the root cause.
❯ payment_method The Spreedly payment method token that references the payment method stored at the gateway
❯❯ third_party_token The token identifying the payment method as it exists at the gateway
❯ basis_payment_method The payment method vaulted at Spreedly that was copied to the gateway as part of this transaction

Redact

PUT /v1/payment_methods/<payment_method_token>/redact.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==


HTTPS/1.1 200 OK
{
  "transaction": {
    "on_test_gateway": false,
    "created_at": "2018-11-07T15:51:57Z",
    "updated_at": "2018-11-07T15:51:57Z",
    "succeeded": true,
    "token": "DDguuLBQmtH6rPh6T5awKejfbv5",
    "state": "succeeded",
    "gateway_specific_fields": {
    },
    "gateway_specific_response_fields": {
    },
    "transaction_type": "RedactPaymentMethod",
    "order_id": null,
    "ip": null,
    "gateway_transaction_id": null,
    "gateway_latency_ms": null,
    "message_key": "messages.transaction_succeeded",
    "message": "Succeeded!",
    "payment_method": {
      "token": "AkB87sKzlj9Gt1gmiWpdRhVe6PF",
      "created_at": "2018-11-06T14:37:25Z",
      "updated_at": "2018-11-07T15:51:57Z",
      "email": "joey@example.com",
      "data": null,
      "storage_state": "redacted",
      "test": true,
      "metadata": {
        "key": "String Value",
        "another_key": "123",
        "final_key": "true"
      },
      "last_four_digits": "4444",
      "first_six_digits": "555555",
      "card_type": "master",
      "first_name": "Joey",
      "last_name": "Jones",
      "month": 3,
      "year": 2032,
      "address1": null,
      "address2": null,
      "city": null,
      "state": null,
      "zip": null,
      "country": null,
      "phone_number": null,
      "company": null,
      "full_name": "Joey Jones",
      "eligible_for_card_updater": true,
      "shipping_address1": null,
      "shipping_address2": null,
      "shipping_city": null,
      "shipping_state": null,
      "shipping_zip": null,
      "shipping_country": null,
      "shipping_phone_number": null,
      "payment_method_type": "credit_card",
      "errors": [

      ],
      "fingerprint": "b5fe350d5135ab64a8f3c1097fadefd9effb",
      "verification_value": "",
      "number": ""
    }
  }
}
<transaction>
  <on_test_gateway type="boolean">false</on_test_gateway>
  <created_at type="dateTime">2018-11-07T15:51:57Z</created_at>
  <updated_at type="dateTime">2018-11-07T15:51:57Z</updated_at>
  <succeeded type="boolean">true</succeeded>
  <token>5PjIQ2q2dTJJFqUgbKw0zc1yenJ</token>
  <state>succeeded</state>
  <gateway_specific_fields>
  </gateway_specific_fields>
  <gateway_specific_response_fields>
  </gateway_specific_response_fields>
  <transaction_type>RedactPaymentMethod</transaction_type>
  <order_id nil="true"></order_id>
  <ip nil="true"></ip>
  <gateway_transaction_id nil="true"></gateway_transaction_id>
  <gateway_latency_ms nil="true"></gateway_latency_ms>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <payment_method>
    <token>AkB87sKzlj9Gt1gmiWpdRhVe6PF</token>
    <created_at type="dateTime">2018-11-06T14:37:25Z</created_at>
    <updated_at type="dateTime">2018-11-07T15:51:57Z</updated_at>
    <email>joey@example.com</email>
    <data nil="true"></data>
    <storage_state>redacted</storage_state>
    <test type="boolean">true</test>
    <metadata>
      <key>String Value</key>
      <another_key>123</another_key>
      <final_key>true</final_key>
    </metadata>
    <last_four_digits>4444</last_four_digits>
    <first_six_digits>555555</first_six_digits>
    <card_type>master</card_type>
    <first_name>Joey</first_name>
    <last_name>Jones</last_name>
    <month type="integer">3</month>
    <year type="integer">2032</year>
    <address1 nil="true"></address1>
    <address2 nil="true"></address2>
    <city nil="true"></city>
    <state nil="true"></state>
    <zip nil="true"></zip>
    <country nil="true"></country>
    <phone_number nil="true"></phone_number>
    <company nil="true"></company>
    <full_name>Joey Jones</full_name>
    <eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
    <shipping_address1 nil="true"></shipping_address1>
    <shipping_address2 nil="true"></shipping_address2>
    <shipping_city nil="true"></shipping_city>
    <shipping_state nil="true"></shipping_state>
    <shipping_zip nil="true"></shipping_zip>
    <shipping_country nil="true"></shipping_country>
    <shipping_phone_number nil="true"></shipping_phone_number>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value></verification_value>
    <number></number>
    <fingerprint>b5fe350d5135ab64a8f3c1097fadefd9effb</fingerprint>
  </payment_method>
</transaction>

Redact (strip of any sensitive credentials and make inactive) a payment method.

URL Parameters

Parameter Description
payment_method_token
required
The token of the payment method
format
required
One of json or xml

Request Body

Element Description
transaction Root element
❯ remove_from_gateway If the payment method is also stored at the gateway (e.g., for third party vaulting or offsite authorizations), include the token of the gateway here and it will be removed from the gateway as well as being redacted from Spreedly. This element is optional.
❯ remove_personal_data true if personally identifiable information should be removed from the payment method and related its transactions. This element is optional.

Response Body

Notable response elements include:

Element Description
transaction Root element
❯ token The token uniquely identifying this transaction at Spreedly
❯ succeeded true if the transaction request was successfully executed, false otherwise
❯ message A human-readable string indicating the result of the transaction
❯ personal_data_removal Personal data redaction information as part of this transaction, if applicable.
❯ payment_method The payment method that was redacted
❯❯ storage_state The new state of the payment method (redacted)

Recache

POST /v1/payment_methods/56wyNnSmuA6CWYP7w0MiYCVIbW6/recache.<format> HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/<format>

{
  "payment_method": {
    "credit_card": {
      "verification_value": "423"
    }
  }
}
<payment_method>
  <credit_card>
    <verification_value>423</verification_value>
  </credit_card>
</payment_method>

HTTPS/1.1 200 OK
{
  "transaction": {
    "token": "LivhZlHanmg7klqtmIp1EH58vRi",
    "transaction_type": "RecacheSensitiveData",
    "succeeded": true,
    "data": null,
    "created_at": "2018-11-07T15:51:57Z",
    "updated_at": "2018-11-07T15:51:57Z",
    "message_key": "messages.transaction_succeeded",
    "message": "Succeeded!",
    "payment_method": {
      "token": "1rpKvP8zOUhj4Y9EDrIoIYQzzD5",
      "created_at": "2017-06-26T17:04:38Z",
      "updated_at": "2018-11-07T15:51:57Z",
      "email": "joey@example.com",
      "data": {
        "my_payment_method_identifier": "448",
        "extra_stuff": {
          "some_other_things": "Can be anything really"
        }
      },
      "storage_state": "retained",
      "test": true,
      "metadata": {
        "key": "string value",
        "another_key": 123,
        "final_key": true
      },
      "last_four_digits": "1111",
      "first_six_digits": "411111",
      "card_type": "visa",
      "first_name": "Newfirst",
      "last_name": "Newlast",
      "month": 3,
      "year": 2032,
      "address1": null,
      "address2": null,
      "city": null,
      "state": null,
      "zip": null,
      "country": null,
      "phone_number": null,
      "company": null,
      "full_name": "Newfirst Newlast",
      "eligible_for_card_updater": true,
      "shipping_address1": null,
      "shipping_address2": null,
      "shipping_city": null,
      "shipping_state": null,
      "shipping_zip": null,
      "shipping_country": null,
      "shipping_phone_number": null,
      "payment_method_type": "credit_card",
      "errors": [

      ],
      "fingerprint": "e3cef43464fc832f6e04f187df25af497994",
      "verification_value": "XXX",
      "number": "XXXX-XXXX-XXXX-1111"
    }
  }
}
<transaction>
  <token>aVejBPdwDNOczzyyM0SvaufMu56</token>
  <transaction_type>RecacheSensitiveData</transaction_type>
  <succeeded type="boolean">true</succeeded>
  <message key="messages.transaction_succeeded">Succeeded!</message>
  <data nil="true"></data>
  <payment_method>
    <token>1rpKvP8zOUhj4Y9EDrIoIYQzzD5</token>
    <created_at type="dateTime">2017-06-26T17:04:38Z</created_at>
    <updated_at type="dateTime">2018-11-07T15:51:56Z</updated_at>
    <email>joey@example.com</email>
    <data>
      <my_payment_method_identifier>448</my_payment_method_identifier>
      <extra_stuff>
        <some_other_things>Can be anything really</some_other_things>
      </extra_stuff>
    </data>
    <storage_state>retained</storage_state>
    <test type="boolean">true</test>
    <metadata>
      <key>string value</key>
      <another_key type="integer">123</another_key>
      <final_key type="boolean">true</final_key>
    </metadata>
    <last_four_digits>1111</last_four_digits>
    <first_six_digits>411111</first_six_digits>
    <card_type>visa</card_type>
    <first_name>Newfirst</first_name>
    <last_name>Newlast</last_name>
    <month type="integer">3</month>
    <year type="integer">2032</year>
    <address1 nil="true"></address1>
    <address2 nil="true"></address2>
    <city nil="true"></city>
    <state nil="true"></state>
    <zip nil="true"></zip>
    <country nil="true"></country>
    <phone_number nil="true"></phone_number>
    <company nil="true"></company>
    <full_name>Newfirst Newlast</full_name>
    <eligible_for_card_updater type="boolean">true</eligible_for_card_updater>
    <shipping_address1 nil="true"></shipping_address1>
    <shipping_address2 nil="true"></shipping_address2>
    <shipping_city nil="true"></shipping_city>
    <shipping_state nil="true"></shipping_state>
    <shipping_zip nil="true"></shipping_zip>
    <shipping_country nil="true"></shipping_country>
    <shipping_phone_number nil="true"></shipping_phone_number>
    <payment_method_type>credit_card</payment_method_type>
    <errors>
    </errors>
    <verification_value>XXX</verification_value>
    <number>XXXX-XXXX-XXXX-1111</number>
    <fingerprint>e3cef43464fc832f6e04f187df25af497994</fingerprint>
  </payment_method>
  <created_at type="dateTime">2018-11-07T15:51:56Z</created_at>
  <updated_at type="dateTime">2018-11-07T15:51:56Z</updated_at>
</transaction>

Update a credit card’s verification value (CVV) so the card can be transacted against.

Note: A credit card must be retained in your environment in order to re-cache its CVV.

URL Parameters

Parameter Description
payment_method_token
required
The token of the payment method
format
required
One of json or xml

Request Body

Element Description
payment_method Root element
❯ credit_card Credit card element
❯❯ verification_value The verification value (CVV/CVC) of the card

Response Body

Element Description
transaction Root element
❯ token The token uniquely identifying this transaction (not the payment method) at Spreedly
❯ succeeded true if the transaction request was successfully executed, false otherwise
❯ payment_method The payment method whose CVV was updated

Transactions

GET /v1/payment_methods/56wyNnSmuA6CWYP7w0MiYCVIbW6/transactions.<format>?order=desc HTTPS/1.1
Host: core.spreedly.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

Example response has been truncated for brevity

HTTPS/1.1 200 OK
{
  "transactions": [
    {
      "on_test_gateway": true,
      "created_at": "2018-11-07T15:52:01Z",
      "updated_at": "2018-11-07T15:52:01Z",
      "succeeded": true,
      "state": "succeeded",
      "token": "JEtm28WvMsk4afcDnSF72jAcl4q",
      "transaction_type": "Purchase",
      "order_id": null,
      "ip": null,
      "description": null,
      "email": null,
      "merchant_name_descriptor": null,
      "merchant_location_descriptor": null,
      "gateway_specific_fields": null,
      "gateway_specific_response_fields": {
      },
      "gateway_transaction_id": "51",
      "gateway_latency_ms": 23,
      "amount": 100,
      "currency_code": "USD",
      "retain_on_success": false,
      "payment_method_added": false,
      "message_key": "messages.transaction_succeeded",
      "message": "Succeeded!",
      "gateway_token": "T11bJAANtTWnxl36GYjKWvbNK0g",
      "gateway_type": "test",
      "response": {
        "success": true,
        "message": "Successful purchase",
        "avs_code": null,
        "avs_message": null,
        "cvv_code": null,
        "cvv_message": null,
        "pending": false,
        "result_unknown": false,
        "error_code": null,
        "error_detail": null,
        "cancelled": false,
        "fraud_review": null,
        "created_at": "2018-11-07T15:52:01Z",
        "updated_at": "2018-11-07T15:52:01Z"
      },
      "shipping_address": {
        "name": "Newfirst Newlast",
        "address1": null,
        "address2": null,
        "city": null,
        "state": null,
        "zip": null,
        "country": null,
        "phone_number": null
      },
      "api_urls": [
        {
          "referencing_transaction": [

          ]
        }
      ],
      "payment_method": {
        "token": "1rpKvP8zOUhj4Y9EDrIoIYQzzD5",
        "created_at": "2017-06-26T17:04:38Z",
        "updated_at": "2018-11-07T15:52:01Z",
        "email": "joey@example.com",
        "data": {
          "my_payment_method_identifier": "448",
          "extra_stuff": {
            "some_other_things": "Can be anything really"
          }
        },
        "storage_state": "retained",
        "test": true,
        "metadata": {
          "key": "string value",
          "another_key": 123,
          "final_key": true
        },
        "last_four_digits": "1111",
        "first_six_digits": "411111",
        "card_type": "visa",
        "first_name": "Newfirst",
        "last_name": "Newlast",
        "month": 3,
        "year": 2032,
        "address1": null,
        "address2": null,
        "city": null,
        "state": null,
        "zip": null,
        "country": null,
        "phone_number": null,
        "company": null,
        "full_name": "Newfirst Newlast",
        "eligible_for_card_updater": null,
        "shipping_address1": null,
        "shipping_address2": null,
        "shipping_city": null,
        "shipping_state": null,
        "shipping_zip": null,
        "shipping_country": null,
        "shipping_phone_number": null,
        "payment_method_type": "credit_card",
        "errors": [

        ],
        "fingerprint": "e3cef43464fc832f6e04f187df25af497994",
        "verification_value": "",
        "number": "XXXX-XXXX-XXXX-1111"
      }
    }
  ]
}
<transactions>
  <transaction>
    <on_test_gateway type="boolean">true</on_test_gateway>
    <created_at type="dateTime">2018-11-07T15:51:57Z</created_at>
    <updated_at type="dateTime">2018-11-07T15:51:58Z</updated_at>
    <succeeded type="boolean">true</succeeded>
    <state>succeeded</state>
    <token>X8spUAkdCvKT9RoyISLDxpPBMc3</token>
    <transaction_type>Authorization</transaction_type>
    <order_id nil="true"></order_id>
    <ip nil="true"></ip>
    <description nil="true"></description>
    <email nil="true"></email>
    <merchant_name_descriptor nil="true"></merchant_name_descriptor>
    <merchant_location_descriptor nil="true"></merchant_location_descriptor>
    <gateway_specific_fields nil="true"></gateway_specific_fields>
    <gateway_specific_response_fields>
    </gateway_specific_response_fields>
    <gateway_transaction_id>68</gateway_transaction_id>
    <gateway_latency_ms type="integer">25</gateway_latency_ms>
    <amount type="integer">100</amount>
    <currency_code>USD</currency_code>
    <retain_on_success type="boolean">false</retain_on_success>
    <payment_method_added type="boolean">false</payment_method_added>
    <message key="messages.transaction_succeeded">Succeeded!</message>
    <gateway_token>T11bJAANtTWnxl36GYjKWvbNK0g</gateway_token>
    <gateway_type>test</gateway_type>
    <shipping_address>
      <name>Newfirst Newlast</name>
      <address1 nil="true"></address1>
      <address2 nil="true"></address2>
      <city nil="true"></city>
      <state nil="true"></state>
      <zip nil="true"></zip>
      <country nil="true"></country>
      <phone_number nil="true"></phone_number>
    </shipping_address>
    <response>
      <success type="boolean">true</success>
      <message>Successful authorize</message>
      <avs_code nil="true"></avs_code>
      <avs_message nil="true"></avs_message>
      <cvv_code nil="true"></cvv_code>
      <cvv_message nil="true"></cvv_message>
      <pending type="boolean">false</pending>
      <result_unknown type="boolean">false</result_unknown>
      <error_code nil="true"></error_code>
      <error_detail nil="true"></error_detail>
      <cancelled type="boolean">false</cancelled>
      <fraud_review nil="true"></fraud_review>
      <created_at type="dateTime">2018-11-07T15:51:58Z</created_at>
      <updated_at type="dateTime">2018-11-07T15:51:58Z</updated_at>
    </response>
    <api_urls>
    </api_urls>
    <payment_method>
      <token>1rpKvP8zOUhj4Y9EDrIoIYQzzD5</token>
      <created_at>2017-06-26T17:04:38Z</created_at>
      <updated_at>2018-11-07T15:51:57Z</updated_at>
      <email>joey@example.com</email>
      <data>
        <my_payment_method_identifier>448</my_payment_method_identifier>
        <extra_stuff>
          <some_other_things>Can be anything really</some_other_things>
        </extra_stuff>
      </data>
      <storage_state>retained</storage_state>
      <test type="boolean">true</test>
      <metadata>
        <key>string value</key>
        <another_key type="integer">123</another_key>
        <final_key type="boolean">true</final_key>
      </metadata>
      <last_four_digits>1111</last_four_digits>
      <first_six_digits>411111</first_six_digits>
      <card_type>visa</card_type>
      <first_name>Newfirst</first_name>
      <last_name>Newlast</last_name>
      <month type="integer">3</month>
      <year type="integer">2032</year>
      <address1 nil="true"></address1>
      <address2 nil="true"></address2>
      <city nil="true"></city>
      <state nil="true"></state>
      <zip nil="true"></zip>
      <country nil="true"></country>
      <phone_number nil="true"></phone_number>
      <company nil="true"></company>
      <full_name>Newfirst Newlast</full_name>
      <eligible_for_card_updater nil="true"></eligible_for_card_updater>
      <shipping_address1 nil="true"></shipping_address1>
      <shipping_address2 nil="true"></shipping_address2>
      <shipping_city nil="true"></shipping_city>
      <shipping_state nil="true"></shipping_state>
      <shipping_zip nil="true"></shipping_zip>
      <shipping_country nil="true"></shipping_country>
      <shipping_phone_number nil="true"></shipping_phone_number>
      <payment_method_type>credit_card</payment_method_type>
      <errors>
      </errors>
      <verification_value></verification_value>
      <number>XXXX-XXXX-XXXX-1111</number>
      <fingerprint>e3cef43464fc832f6e04f187df25af497994</fingerprint>
    </payment_method>
  </transaction>
</transactions>

Get an ordered and paginated list of transactions executed against a specific payment method.

URL Parameters

Parameter Description
payment_method_token
required
The token of the payment method whose transactions should be fetched
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)

Response Body

Notable response elements include:

Element Description
transaction(s) Root element
❯ token The token uniquely identifying this transaction at Spreedly
❯ succeeded true if the transaction request was successfully executed, false otherwise
❯ message A human-readable string indicating the result of the transaction
❯ gateway_transaction_id The id of the transaction at the gateway. To be used when corresponding with the gateway or reconciling transactions
❯ retain_on_success If the payment method was set to be retained on successful completion of the transaction. To determine if the payment method was actually retained, see the payment_method/storage_state field
❯ payment_method_added If the payment method was added as part of this transaction (i.e. a direct pass-in of the payment information) vs. using an already tokenized payment method
❯ response Unmodified details of the gateway response, including the message and error_code, if applicable. For failed transactions these fields can help determine the root cause
❯ payment_method The payment method used in this transaction
❯ merchant_profile_key The token of the Merchant Profile associated with the gateway used for the transaction