I am trying to activate a gift card in sandbox after order is created.
First off, is activating gift cards in sandbox even possible? I really don’t want to switch over to production to test…
I have an order ID and line item uid from the order and am calling everything exactly as the api explorer has it as well. I get the same response from the api explorer. I’m using the php sdk but here is the curl call with some things scrubbed out for security
curl https://connect.squareupsandbox.com/v2/gift-cards/activities \
-X POST \
-H 'Square-Version: 2022-10-19' \
-H 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"gift_card_activity": {
"type": "ACTIVATE",
"activate_activity_details": {
"amount_money": {
"currency": "USD",
"amount": 1000
},
"order_id": "xNF3nHJ58QTYPqEsY5i17FRw8gYZY",
"line_item_uid": "GJxjlfcjN83MWujDM1vg1C"
},
"location_id": "<xxxxxxxxxxx>",
"gift_card_gan": "7783320006361414"
},
"idempotency_key": "778a5ec9-d61f-4def-84f2-b1457ae9ef97"
}'
I’m getting back this error from the call:
400 Response
cache-control: no-cache
content-length: 178
content-type: application/json
date: Mon, 14 Nov 2022 22:41:58 GMT
square-version: 2022-10-19
{
"errors": [
{
"code": "BAD_REQUEST",
"detail": "Provide either order_id and line_item_uid OR provide amount and buyer_payment_instrument_id",
"category": "INVALID_REQUEST_ERROR"
}
]
}