Skip to content

Instantly share code, notes, and snippets.

@mwoods79
Last active December 28, 2015 21:39
Show Gist options
  • Save mwoods79/7566240 to your computer and use it in GitHub Desktop.
Save mwoods79/7566240 to your computer and use it in GitHub Desktop.
Suggested API

GET /users/:id/credit_card

{
  "credit_cards": [
    "token",
    "anotherToken"
  ]
}

POST /users/:id/credit_card

{
  "credit_cards": {
    "token": "123GUID"
  }
}

returns

{
  "credit_cards": {
    "token": "123GUID"
  }
}

GET /users/:id/orders

{
  "orders" : [
    {
      "id" : "orderIdGUID",
      "total": "$12.99",
      "tax": "$0.49",
      "created_at": "2013-12-25",
      "products": [
        {
          "id": "productID"
          "purchase_type": "rent",
          "price": "$1.25"
        },
        {
          "id": "product2ID"
          "purchase_type": "buy",
          "price": "$11.25"
        }
      ]
    }
  ]
}

POST /users/:id/orders

{
  "order" : {
    "transaction_id" : "id",
    "total": "$12.99",
    "tax": "$0.49",
    "created_at": "2013-12-25",
    "products": [
      {
        "id": "productId",
        "product_type": "rent",
        "price": "$1.25"
      },
      {
        "id": "product_id",
        "product_type": "buy",
        "price": "$11.25"
      }
    ]
  }
}    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment