Generate Digital Codes Item

Hi;

We want to sell digital codes with Square. We will create catalog products via API. But there are 2 concepts. Gift-Card and Catalog. Our products is not a physical. Which metot should I use on API for insert item. Can you direct me? Thanks.

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Sell a Gift Card (Orders API Integration)
Catalog API Overview
Design a Catalog

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

You can use the Catalog API to create digital products in your catalog. When creating a product, you would use the CreateCatalogObject endpoint and specify the type as “ITEM”. In the “item_data” field, you would specify the details about the item.

If you want to sell digital gift cards, you would use the Gift Cards API. This allows you to create a digital gift card, activate it with an initial balance, and manage its activities.

So, if you’re selling digital codes that are not gift cards, you would use the Catalog API. If you’re selling digital gift cards, you would use the Gift Cards API.

This answer was reviewed by @Bryan-Square.

Hi, I think , ı will use catalog API for digital codes. How can I set digital code info on item_data ? Could you send me sample ? Thank you.

Where would you like it to be? For example is it going to be in the name, description_html, variation name, etc…

Here is an example item so you can see all the various fields:

{
    "object": {
        "type": "ITEM",
        "id": "IPFY5CUTXOYG3PBXHQGDKBXM",
        "updated_at": "2024-01-16T22:03:53.061Z",
        "created_at": "2019-12-26T17:13:27.337Z",
        "version": 1705442633061,
        "is_deleted": false,
        "present_at_all_locations": true,
        "item_data": {
            "name": "Hex Coffee",
            "description": "Hot Bean Juice",
            "label_color": "FBD6E4",
            "is_taxable": true,
            "visibility": "PRIVATE",
            "available_online": false,
            "available_for_pickup": false,
            "available_electronically": false,
            "category_id": "RU5WBWNYPWLERUQBCVSQQVEG",
            "ordinal": 0,
            "tax_ids": [
                "P2WTZJKP633HECJMGYHVWUU4",
                "QZR25LKZ23SLVOPWFLJ4J3MS",
                "ZPTKVRGA2UDO2OZWL6ULID3H"
            ],
            "modifier_list_info": [
                {
                    "modifier_list_id": "NEQACTCWKO4HVDJIF7R5GU4I",
                    "min_selected_modifiers": -1,
                    "max_selected_modifiers": -1,
                    "enabled": true
                }
            ],
            "variations": [
                {
                    "type": "ITEM_VARIATION",
                    "id": "UXTWXOHG5HBKM65MLIBUKMQF",
                    "updated_at": "2023-07-06T17:21:26.355Z",
                    "created_at": "2019-12-26T17:13:27.337Z",
                    "version": 1688664086355,
                    "is_deleted": false,
                    "present_at_all_locations": true,
                    "item_variation_data": {
                        "item_id": "IPFY5CUTXOYG3PBXHQGDKBXM",
                        "name": "Regular",
                        "sku": "1234891011",
                        "ordinal": 1,
                        "pricing_type": "FIXED_PRICING",
                        "price_money": {
                            "amount": 280,
                            "currency": "USD"
                        },
                        "location_overrides": [
                            {
                                "location_id": "3Z4V4WHQK64X9",
                                "track_inventory": false
                            }
                        ],
                        "sellable": true,
                        "stockable": true,
                        "subscription_plan_ids": [
                            "TBIIVKRVWDZCR3GFT73HZDL2",
                            "J27BT5MGHLJRIJIWRAGIIXQO",
                            "AEZUVJGZ2HUJNT4WBXHBBQRZ",
                            "DA442EYC7ITK75BAJS4TIW7J"
                        ],
                        "channels": [
                            "CH_f9gD2j40pQDTgUvP1vYQRt7mcu1kOBoMsIie5PlQuYC"
                        ]
                    }
                },
                {
                    "type": "ITEM_VARIATION",
                    "id": "MDTZQGRYTEAV5F5ZA3QWRSOX",
                    "updated_at": "2023-07-06T17:21:26.355Z",
                    "created_at": "2019-12-26T17:13:27.337Z",
                    "version": 1688664086355,
                    "is_deleted": false,
                    "present_at_all_locations": true,
                    "item_variation_data": {
                        "item_id": "IPFY5CUTXOYG3PBXHQGDKBXM",
                        "name": "Large",
                        "sku": "09876",
                        "ordinal": 2,
                        "pricing_type": "FIXED_PRICING",
                        "price_money": {
                            "amount": 350,
                            "currency": "USD"
                        },
                        "location_overrides": [
                            {
                                "location_id": "3Z4V4WHQK64X9",
                                "track_inventory": false
                            }
                        ],
                        "sellable": true,
                        "stockable": true,
                        "subscription_plan_ids": [
                            "TBIIVKRVWDZCR3GFT73HZDL2",
                            "J27BT5MGHLJRIJIWRAGIIXQO",
                            "AEZUVJGZ2HUJNT4WBXHBBQRZ",
                            "DA442EYC7ITK75BAJS4TIW7J"
                        ],
                        "channels": [
                            "CH_f9gD2j40pQDTgUvP1vYQRt7mcu1kOBoMsIie5PlQuYC"
                        ]
                    }
                }
            ],
            "product_type": "REGULAR",
            "skip_modifier_screen": true,
            "ecom_available": true,
            "ecom_visibility": "HIDDEN",
            "pickup_fulfillment_preferences_id": "fprefs_127djg37q08dwyf33ihh4q39x",
            "delivery_fulfillment_preferences_id": "fprefs_127djg37pbjevxpdk6ue90r9x",
            "description_html": "<p>Hot Bean Juice</p>",
            "description_plaintext": "Hot Bean Juice",
            "channels": [
                "CH_f9gD2j40pQDTgUvP1vYQRt7mcu1kOBoMsIie5PlQuYC"
            ],
            "is_archived": false
        }
    }
}

Also here’s the link to our documentation for the Catalog API that walks you through building catalog object. :slightly_smiling_face:

Thank you Bryan.

I thank this sample generic for catalog-API.
Can you send me for Digital Codes Product sample?

Regards.

Sure to create an item with one variation and title it “Digital Code” using the Square Catalog API, you will need to send a POST request to the /v2/catalog/object endpoint with the appropriate JSON payload. Below is an example of how you might structure the JSON payload.

JSON payload:

{
  "idempotency_key": "unique-key-for-this-request",
  "object": {
    "type": "ITEM",
    "id": "#digitalcode",
    "item_data": {
      "name": "Digital Code",
      "description": "A unique digital code",
      "variations": [
        {
          "type": "ITEM_VARIATION",
          "id": "#digitalcodevariation",
          "item_variation_data": {
            "name": "Default",
            "pricing_type": "FIXED_PRICING",
            "price_money": {
              "amount": 1000,
              "currency": "USD"
            }
          }
        }
      ]
    }
  }
}

:slightly_smiling_face:

Bryan

I am trying to create a digit product, not necessarily gift cards. Pls see the attached.

Thanks

Our Catalog doesn’t have a type of DIGITAL. You’ll just want to create an item an sell it as a digital item. :slightly_smiling_face: