Billing Credentials API v2

REST API for a User's billing credentials. A billing credential is the user's billing address and credit card information. However, only the last 4 digits of the credit card is revealed. OAuth must be setup before making these API calls. See the OAuth 2.0 page for more details.

This REST API supports JSON format.


Request format

http://www.shoppable.com/api/v2/billing_credentails/:billing_credentail_id?access_token=YOUR_ACCESS_TOKEN

Examples

Ruby example using OAuth2 and HTTParty retrieving all billing credentials.

  # Retrieve access token from session.  You may have saved it in the DB.
  access_token = session[:access_token]

  api_url = "http://www.shoppable.com/api/v2/billing_credentails?access_token=" + access_token.to_s
  billing_credentails = HTTParty.get(api_url, :options => { :headers => { 'Content-Type' => 'application/json' } }).to_json

Ruby on rails example using HTTParty creating a new billing credential.

  access_token = session[:access_token]

  api_url = "http://www.shoppable.com/api/v2/billing_credentials?access_token=" + access_token.to_s

  billing_credential = HTTParty.post(api_url,
    :options => {
      :headers => { 'Content-Type' => 'application/json' } },
    :body => {
      :billing_credential => {
        "billing_city"=>"New York",
        "billing_company"=>nil,
        "billing_country"=>"US",
        "billing_email"=>"john+test132@shoppable.com",
        "billing_first_name"=>"john",
        "billing_last_name"=>"wei",
        "billing_phone"=>"12312314",
        "billing_postal_code"=>"10009",
        "billing_state"=>"NY",
        "billing_street1"=>"123 fake street",
        "billing_street2"=>"10a",
        "card_exp_month"=>"4",
        "card_exp_year"=>"2017",
        "card_first_name"=>"john",
        "card_last_digits"=>"1111",
        "card_last_name"=>"wei",
        "card_number" =>"411111111111111",
        "card_security_code"=>"123"
      }
    }
  )

REST Actions

Action Description Method URL Parameters
Index Get all billing addresses of the user GET http://www.shoppable.com/api/v2/billing_credentials
  • access_token
Show Get a single billing address of the user GET http://www.shoppable.com/api/v2/billing_credentials/:billing_credential_id
  • access_token
  • billing_credential_id
Create Create a new billing credential POST http://www.shoppable.com/api/v2/billing_credentials
  • access_token
  • billing address object
Delete Delete a billing address DELETE http://www.shoppable.com/api/v2/billing_credentials/:billing_credential_id
  • access_token
  • billing_credential_id

Request parameters

Parameter Type Description
access_token

REQUIRED

URL Param Access token provided through the OAuth service.
billing_credential_id

REQUIRED

URL Param The id of the billing credential.
billing_credentials[card_first_name] Data Param First name of the card holder.
billing_credentials[card_last_name] Data Param Last name of the card holder.
billing_credentials[card_number] Data Param Credit card number.
billing_credentials[card_security_code] Data Param Security code of the credit card.
billing_credentials[billing_first_name] Data Param First name of the billing address registered individual.
billing_credentials[billing_last_name] Data Param Last name of the billing address registered individual.
billing_credentials[billing_phone] Data Param Billing address phone number.
billing_credentials[billing_street1] Data Param Billing street address line 1.
billing_credentials[billing_street2] Data Param Billing street address line 2.
billing_credentials[billing_city] Data Param Billing address city.
billing_credentials[billing_state] Data Param Billing address state.
billing_credentials[billing_postal_code] Data Param Billing address zip code.
billing_credentials[billing_country] Data Param Billing address country.
billing_credentials[billing_email] Data Param Email of the billing address user, if different from current email's user.
billing_credentials[card_exp_month] Data Param Credit card expiration month.
billing_credentials[card_exp_year] Data Param Credit card expiration year.

Example response

All the shipping addresses of the current user.

[
  {
    "billing_city":"New York",
    "billing_country":"US",
    "billing_email":"john+test132@shoppable.com",
    "billing_first_name":"john",
    "billing_last_name":"wei",
    "billing_phone":"1111111111",
    "billing_postal_code":"10009",
    "billing_state":"NY",
    "billing_street1":"123 fake street",
    "billing_street2":"10a",
    "card_first_name":"john",
    "card_last_digits":"1111",
    "card_last_name":"wei",
    "created_at":"2015-02-05T18:09:39Z",
    "id":90,
    "payment_method":null,
    "updated_at":"2015-02-05T18:09:39Z",
    "user_id":130
  }
]