• Example searches: “transaction”, “CreateOrder”, “/v2/locations”, “inventory”, “delete customer”

You are viewing an old version of the API
Clone order BETA

POST /v2/orders/clone

Creates a new order, in the DRAFT state, by duplicating an existing order.

The newly created order has only the core fields (such as line items, taxes, and discounts) copied from the original order.


Permissions
ORDERS_WRITE
Guide
Clone an order
Try in API Explorer
Name Description
order_id
string

Required

The ID of the order to clone.

version
integer (32-bit)

An optional order version for concurrency protection.

If a version is provided, it must match the latest stored version of the order to clone. If a version is not provided, the API clones the latest version.

idempotency_key
string

A value you specify that uniquely identifies this clone request.

If you are unsure whether a particular order was cloned successfully, you can reattempt the call with the same idempotency key without worrying about creating duplicate cloned orders. The originally cloned order is returned.

For more information, see Idempotency.

Response Fields

Name Description
order
Order

The cloned order.

errors
Error [ ]

Any errors that occurred during the request.

Examples

You are viewing an old version of the API
POST /v2/orders/clone
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
  • Node.js
curl https://connect.squareup.com/v2/orders/clone \
  -X POST \
  -H 'Square-Version: 2022-01-20' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "order_id": "ZAISEM52YcpmcWAzERDOyiWS123",
    "version": 3,
    "idempotency_key": "UNIQUE_STRING"
  }'
Response JSON
{
  "order": {
    "id": "CAISENgvlJ6jLWAzERDzjyHVybY",
    "location_id": "057P5VYJ4A5X1",
    "line_items": [
      {
        "uid": "8uSwfzvUImn3IRrvciqlXC",
        "name": "New York Strip Steak",
        "quantity": "1",
        "applied_taxes": [
          {
            "uid": "aKG87ArnDpvMLSZJHxWUl",
            "tax_uid": "state-sales-tax",
            "applied_money": {
              "amount": 136,
              "currency": "USD"
            }
          }
        ],
        "applied_discounts": [
          {
            "uid": "jWdgP1TpHPFBuVrz81mXVC",
            "discount_uid": "membership-discount",
            "applied_money": {
              "amount": 8,
              "currency": "USD"
            }
          },
          {
            "uid": "jnZOjjVY57eRcQAVgEwFuC",
            "discount_uid": "labor-day-sale",
            "applied_money": {
              "amount": 79,
              "currency": "USD"
            }
          }
        ],
        "base_price_money": {
          "amount": 1599,
          "currency": "USD"
        },
        "gross_sales_money": {
          "amount": 1599,
          "currency": "USD"
        },
        "total_tax_money": {
          "amount": 136,
          "currency": "USD"
        },
        "total_discount_money": {
          "amount": 87,
          "currency": "USD"
        },
        "total_money": {
          "amount": 1648,
          "currency": "USD"
        },
        "variation_total_price_money": {
          "amount": 1599,
          "currency": "USD"
        }
      },
      {
        "uid": "v8ZuEXpOJpb0bazLuvrLDB",
        "name": "New York Steak",
        "quantity": "2",
        "catalog_object_id": "BEMYCSMIJL46OCDV4KYIKXIB",
        "variation_name": "Larger",
        "modifiers": [
          {
            "uid": "Lo3qMMckDluu9Qsb58d4CC",
            "catalog_object_id": "CHQX7Y4KY6N5KINJKZCFURPZ",
            "name": "Well",
            "base_price_money": {
              "amount": 50,
              "currency": "USD"
            },
            "total_price_money": {
              "amount": 100,
              "currency": "USD"
            }
          }
        ],
        "applied_taxes": [
          {
            "uid": "v1dAgrfUVUPTnVTf9sRPz",
            "tax_uid": "state-sales-tax",
            "applied_money": {
              "amount": 374,
              "currency": "USD"
            }
          }
        ],
        "applied_discounts": [
          {
            "uid": "nUXvdsIItfKko0dbYtY58C",
            "discount_uid": "membership-discount",
            "applied_money": {
              "amount": 22,
              "currency": "USD"
            }
          },
          {
            "uid": "qSdkOOOernlVQqsJ94SPjB",
            "discount_uid": "labor-day-sale",
            "applied_money": {
              "amount": 224,
              "currency": "USD"
            }
          },
          {
            "uid": "y7bVl4njrWAnfDwmz19izB",
            "discount_uid": "one-dollar-off",
            "applied_money": {
              "amount": 100,
              "currency": "USD"
            }
          }
        ],
        "base_price_money": {
          "amount": 2200,
          "currency": "USD"
        },
        "gross_sales_money": {
          "amount": 4500,
          "currency": "USD"
        },
        "total_tax_money": {
          "amount": 374,
          "currency": "USD"
        },
        "total_discount_money": {
          "amount": 346,
          "currency": "USD"
        },
        "total_money": {
          "amount": 4528,
          "currency": "USD"
        },
        "variation_total_price_money": {
          "amount": 4400,
          "currency": "USD"
        }
      }
    ],
    "taxes": [
      {
        "uid": "state-sales-tax",
        "name": "State Sales Tax",
        "type": "ADDITIVE",
        "percentage": "9",
        "applied_money": {
          "amount": 510,
          "currency": "USD"
        },
        "scope": "ORDER"
      }
    ],
    "discounts": [
      {
        "uid": "membership-discount",
        "catalog_object_id": "DB7L55ZH2BGWI4H23ULIWOQ7",
        "name": "Membership Discount",
        "type": "FIXED_PERCENTAGE",
        "percentage": "0.5",
        "applied_money": {
          "amount": 30,
          "currency": "USD"
        },
        "scope": "ORDER"
      },
      {
        "uid": "labor-day-sale",
        "name": "Labor Day Sale",
        "type": "FIXED_PERCENTAGE",
        "percentage": "5",
        "applied_money": {
          "amount": 303,
          "currency": "USD"
        },
        "scope": "ORDER"
      },
      {
        "uid": "one-dollar-off",
        "name": "Sale - $1.00 off",
        "type": "FIXED_AMOUNT",
        "amount_money": {
          "amount": 100,
          "currency": "USD"
        },
        "applied_money": {
          "amount": 100,
          "currency": "USD"
        },
        "scope": "LINE_ITEM"
      }
    ],
    "created_at": "2020-01-17T20:47:53.293Z",
    "updated_at": "2020-01-17T20:47:53.293Z",
    "state": "DRAFT",
    "version": 1,
    "reference_id": "my-order-001",
    "total_money": {
      "amount": 6176,
      "currency": "USD"
    },
    "total_tax_money": {
      "amount": 510,
      "currency": "USD"
    },
    "total_discount_money": {
      "amount": 433,
      "currency": "USD"
    },
    "total_tip_money": {
      "amount": 0,
      "currency": "USD"
    },
    "total_service_charge_money": {
      "amount": 0,
      "currency": "USD"
    },
    "net_amounts": {
      "total_money": {
        "amount": 6176,
        "currency": "USD"
      },
      "tax_money": {
        "amount": 510,
        "currency": "USD"
      },
      "discount_money": {
        "amount": 433,
        "currency": "USD"
      },
      "tip_money": {
        "amount": 0,
        "currency": "USD"
      },
      "service_charge_money": {
        "amount": 0,
        "currency": "USD"
      }
    },
    "source": {
      "name": "My App"
    }
  }
}