When creating an automatic discount for specific customer groups using the API, the discount is not being automatically applied at checkout. This only happens when using the API for all steps. When creating it in the dashboard, the discount is correctly applied. Is this a bug or is something wrong in my request? Full steps are below.
I followed these steps
First I created a customer group
Request:
curl https://connect.squareup.com/v2/customers/groups \
-X POST \
-H 'Square-Version: 2024-12-18' \
-H 'Authorization: Bearer ' \
-H 'Content-Type: application/json' \
-d '{
"group": {
"name": "Gogh 10"
},
"idempotency_key": "d1f213e2-b989-4365-8e51-4537f53a4d90"
}'
Response:
{
"group": {
"id": "40K3DW3SNPESRV4VQKWAZ24YH5",
"name": "Gogh 10",
"created_at": "2025-01-20T21:17:05.047Z",
"updated_at": "2025-01-20T21:17:05Z"
}
}
Then I created a discount
Request:
curl https://connect.squareup.com/v2/catalog/object \
-X POST \
-H 'Square-Version: 2024-12-18' \
-H 'Authorization: Bearer ' \
-H 'Content-Type: application/json' \
-d '{
"idempotency_key": "86221040-60aa-4bbd-a22a-1b23667aedd5",
"object": {
"id": "#NewDiscount",
"type": "DISCOUNT",
"present_at_all_locations": true,
"discount_data": {
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"discount_type": "FIXED_AMOUNT",
"modify_tax_basis": "DO_NOT_MODIFY_TAX_BASIS",
"name": "$10 off"
}
}
}'
Response:
{
"catalog_object": {
"type": "DISCOUNT",
"id": "5IV7I6VIBSUYA3NBXPAVG25W",
"updated_at": "2025-01-20T21:19:51.314Z",
"created_at": "2025-01-20T21:19:51.314Z",
"version": 1737407991314,
"is_deleted": false,
"present_at_all_locations": true,
"discount_data": {
"name": "$10 off",
"discount_type": "FIXED_AMOUNT",
"amount_money": {
"amount": 1000,
"currency": "USD"
},
"modify_tax_basis": "DO_NOT_MODIFY_TAX_BASIS"
}
},
"id_mappings": [
{
"client_object_id": "#NewDiscount",
"object_id": "5IV7I6VIBSUYA3NBXPAVG25W"
}
]
}
Next I created a product set
Request:
curl https://connect.squareup.com/v2/catalog/object \
-X POST \
-H 'Square-Version: 2024-12-18' \
-H 'Authorization: Bearer ' \
-H 'Content-Type: application/json' \
-d '{
"idempotency_key": "1ed03019-3f6c-4dd5-98ec-2f955c7c4619",
"object": {
"id": "#NewProductSet",
"type": "PRODUCT_SET",
"present_at_all_locations": true,
"product_set_data": {
"all_products": true,
"name": "All Products"
}
}
}'
Response:
{
"catalog_object": {
"type": "PRODUCT_SET",
"id": "JTS7ODAXGMCSGZ657BGKNVL3",
"updated_at": "2025-01-20T21:21:59.491Z",
"created_at": "2025-01-20T21:21:59.491Z",
"version": 1737408119491,
"is_deleted": false,
"present_at_all_locations": true,
"product_set_data": {
"name": "All Products",
"all_products": true
}
},
"id_mappings": [
{
"client_object_id": "#NewProductSet",
"object_id": "JTS7ODAXGMCSGZ657BGKNVL3"
}
]
}
Then I created a pricing rule
Request:
curl https://connect.squareup.com/v2/catalog/object \
-X POST \
-H 'Square-Version: 2024-12-18' \
-H 'Authorization: Bearer ' \
-H 'Content-Type: application/json' \
-d '{
"idempotency_key": "eeb55eb6-1157-435b-973a-e38923ec3257",
"object": {
"id": "#NewPricingRule",
"type": "PRICING_RULE",
"present_at_all_locations": true,
"pricing_rule_data": {
"customer_group_ids_any": [
"40K3DW3SNPESRV4VQKWAZ24YH5"
],
"discount_id": "5IV7I6VIBSUYA3NBXPAVG25W",
"match_products_id": "JTS7ODAXGMCSGZ657BGKNVL3",
"name": "New Pricing Rule"
}
}
}'
Response:
{
"catalog_object": {
"type": "PRICING_RULE",
"id": "B6QIVLIFAFPTOOJJXCHBMD4C",
"updated_at": "2025-01-20T21:24:44.114Z",
"created_at": "2025-01-20T21:24:44.114Z",
"version": 1737408284114,
"is_deleted": false,
"present_at_all_locations": true,
"pricing_rule_data": {
"name": "New Pricing Rule",
"discount_id": "5IV7I6VIBSUYA3NBXPAVG25W",
"match_products_id": "JTS7ODAXGMCSGZ657BGKNVL3",
"application_mode": "AUTOMATIC",
"customer_group_ids_any": [
"40K3DW3SNPESRV4VQKWAZ24YH5"
]
}
},
"id_mappings": [
{
"client_object_id": "#NewPricingRule",
"object_id": "B6QIVLIFAFPTOOJJXCHBMD4C"
}
]
}
**Finally I added the group to a customer **
Request:
curl https://connect.squareup.com/v2/customers/XHV1GTC01130QF4WSVAH30EB3W/groups/40K3DW3SNPESRV4VQKWAZ24YH5 \
-X PUT \
-H 'Square-Version: 2024-12-18' \
-H 'Authorization: Bearer ' \
-H 'Content-Type: application/json'
Response (showed as 200)
{}
I also confirmed the group and discount is showing in customer’s profile
However the discount is not being applied at checkout. When I created the discount from the dashboard, it worked fine. Just not when going through the steps above using the API.