How To Buy

We will go through the entire process and buy an item via API. In particular, we will buy a 'Brainstorm' Magic: the Gathering card from the 'Commander 2018' expansion set. We will:

  • Find the Product
  • Add the Product to the Cart
  • Purchase the Cart

You can also use our How to buy Postman Collection .

The 'Commander 2018' expansion set has id 8. You can look for expansion set ids by searching on the table below, or you can use our GET https://api.cardtrader.com/api/v2/expansions endpoint.

Find Product

We call GET https://api.cardtrader.com/api/v2/marketplace/products?expansion_id=8 to get the list of Products for sale. The 'Commander 2018' expansion set has id 8.

The result json is an object grouped by blueprint id. Each object is an array of Products. Search in the json for the specific Product you want to buy. Each Product has its own price, condition, vendor, available quantity, and so on.

Here we will buy the Product with id 110419919. This is the Product we are looking for - a near mint, English, 'Commander 2018' Brainstorm for 40 cents.

If you know that the Brainstorm card is the blueprint with id 327, you can also directly fetch the products using that blueprint_id. Use blueprint_id=327 as parameter. You can get the list of blueprints and the ids by using this API call.

curl -X GET https://api.cardtrader.com/api/v2/marketplace/products?expansion_id=8 \
  -H "Authorization: Bearer [YOUR_AUTH_TOKEN]"
{
  "327": [
    {
      "image": "82.png",
      "hub_sha": "2c1b9f9f015559b756bbc5d413a6ac8d",
      "uploaded_images": [

      ],
      "quantity": 1,
      "description": "",
      "price_cents": 40,
      "bundled_quantity": 1,
      "blueprint_id": 327,
      "properties_hash": {
                "condition": "Near Mint",
                "mtg_card_colors": "U",
                "tournament_legal": true,
                "collector_number": "82",
                "cmc": "1.0",
                "signed": false,
                "mtg_foil": false,
                "mtg_language": "en",
                "altered": false,
                "mtg_rarity": "Uncommon"
            }+ Properties,
      "expansion": {
                "code": "c18",
                "released_at": "2018-08-09T00:00:00Z",
                "id": 8,
                "translated_name": null
            }+ Expansion,
      "graded": false,
      "id": 110419919,
      "tag": "",
      "bundle_size": 1,
      "on_vacation": false,
      "user": {
                "country_code": "IT",
                "too_many_request_for_cancel_as_seller": false,
                "user_type": "normal",
                "max_sellable_in24h_quantity": null,
                "id": 10626,
                "slug": "seller_slug",
                "username": "seller_username",
                "can_sell_via_hub": true
            }+ User,
      "price_currency": "EUR",
      "name_en": "Brainstorm",
      "price": {
                "cents": 40,
                "currency": "USD",
                "currency_symbol": "$",
                "formatted": "$0.40"
            }+ Price,
      "seller_in_cart": null,
      "translated_name": "Brainstorm",
      "shipped_to_country": false
    }
  ]
}

Add the Product to the Cart

Add the Product 105234025 to the Cart with POST https://api.cardtrader.com/api/v2/cart/add. Specify the quantity. Specify via_cardtrader_zero=true if you want to buy via CardTrader Zero. If so, make sure the Product is available via CardTrader Zero otherwise you will get an error while adding to the cart.

Specify the shipping address and the billing address.

curl -X POST https://api.cardtrader.com/api/v2/cart/add \
  -H "Authorization: Bearer [YOUR_AUTH_TOKEN]" \
  -d '{
  "product_id": 105234025,
  "quantity": 1,
  "via_cardtrader_zero": true,
  "billing_address": {
    "name": "Name",
    "street": "Address street",
    "zip": "50143",
    "city": "firenze",
    "state_or_province": "FI",
    "country_code": "IT"
  },
  "shipping_address": {
    "name": "Name",
    "street": "Address street",
    "zip": "50143",
    "city": "firenze",
    "state_or_province": "FI",
    "country_code": "IT"
  }
}'
{
  "id": 173757,
  "subcarts": [
    {
      "id": 908392,
      "seller": {
        "id": 34089,
        "username": "CT Connect"
      },
      "cart_items": [
        {
          "quantity": 1,
          "price_cents": 40,
          "price_currency": "USD",
          "product": {
            "id": 105234025,
            "name_en": "Brainstorm"
          }
        }
      ]
    }
  ],
  "subtotal": {
    "cents": 40,
    "currency_iso": "USD"
  },
  "safeguard_fee_amount": {
    "cents": 0,
    "currency_iso": "USD"
  },
  "ct_zero_fee_amount": {
    "cents": 4,
    "currency_iso": "USD"
  },
  "payment_method_fee_percentage_amount": {
    "cents": 0,
    "currency_iso": "USD"
  },
  "payment_method_fee_fixed_amount": {
    "cents": 0,
    "currency_iso": "USD"
  },
  "shipping_cost": {
    "cents": 0,
    "currency_iso": "USD"
  },
  "billing_address": null,
  "shipping_address": null
}

Purchase the Cart

POST https://api.cardtrader.com/api/v2/cart/purchase and you are done!

Before purchasing, make sure you have a credit card/debit card attached to your account or enough credit on your wallet.

Please check our API documentation to learn more.

Please check our How to sell guide to know how to sell.

curl -X POST https://api.cardtrader.com/api/v2/cart/purchase \
  -H "Authorization: Bearer [YOUR_AUTH_TOKEN]"
[
  {
    "order_as": "buyer",
    "seller": {
      "id": 34089,
      "username": "CT Connect",
      "email": "cardtradereu@cardtrader.com",
      "phone": "+393756388134"
    },
    "cancel_requester": null,
    "id": null,
    "code": "2021092067fb74",
    "state": "pending",
    "size": 1,
    "paid_at": null,
    "sent_at": null,
    "cancelled_at": null,
    "presale_ended_at": "2012-10-04T00:00:00.000Z",
    "fee_percentage": "5.0",
    "packing_number": null,
    "order_shipping_address": {
            "id": null,
            "name": "name name",
            "street": "street",
            "zip": "50143",
            "city": "firenze",
            "state_or_province": "FI",
            "country_code": "IT",
            "vat_number": null,
            "note": null,
            "created_at": null,
            "updated_at": null,
            "country": "Italy"
        }+ Order Shipping Address,
    "order_billing_address": {
            "id": null,
            "name": "name name",
            "street": "street 3",
            "zip": "50143",
            "city": "firenze",
            "state_or_province": "FI",
            "country_code": "IT",
            "vat_number": null,
            "note": null,
            "created_at": null,
            "updated_at": null,
            "country": "Italy"
        }+ Order Billing Address,
    "total": {
      "cents": 20,
      "currency": "USD"
    },
    "via_cardtrader_zero": true,
    "buyer_total": {
      "cents": 17,
      "currency": "EUR"
    },
    "fee_amount": {
      "cents": 1,
      "currency": "USD"
    },
    "subtotal": {
      "cents": 20,
      "currency": "USD"
    },
    "buyer_subtotal": {
      "cents": 17,
      "currency": "EUR"
    },
    "formatted_subtotal": "€0.17",
    "formatted_total": "€0.17",
    "presale": false,
    "order_shipping_method": {
            "id": null,
            "name": null,
            "tracked": null,
            "tracking_code": null,
            "max_estimate_shipping_days": null,
            "formatted_price": "$0.00",
            "price": {
                "cents": 0,
                "currency": "USD"
            },
            "buyer_price": {
                "cents": 0,
                "currency": "EUR"
            },
            "formatted_buyer_price": "€0.00"
        }+ Order Shipping Method,
    "order_items": [
    {
        "id": null,
        "product_id": 144162,
        "blueprint_id": 15028,
        "category_id": 1,
        "game_id": 1,
        "name": "Brainstorm",
        "expansion": "Commander 2018",
        "quantity": 1,
        "bundle_size": 1,
        "description": "",
        "tag": "",
        "graded": false,
        "user_data_field": null,
        "properties": {
            "condition": "Slightly Played",
            "mtg_language": "it",
            "mtg_foil": false,
            "signed": false,
            "altered": false,
            "mtg_rarity": "Uncommon",
            "collector_number": "6",
            "cmc": "4.0",
            "mtg_card_colors": "W"
        },
        "price": {
            "cents": 20,
            "currency": "USD"
        },
        "buyer_price": {
            "cents": 17,
            "currency": "EUR"
        },
        "formatted_price": "€0.17",
        "mkm_id": null,
        "tcg_player_id": null,
        "scryfall_id": null
    }
]+ Order Items
  }
]