Jim Archer
Jim Archer

Reputation: 1417

Square REST API: Error issuing refund

Every time I try to refund a card, I get the JSON pasted below. This happens after I authorize a card, then capture the charge, then want to issue a partial refund. For “tender_id” I have tried both the transaction ID and the ID I am handed during the authorization. Of course for the capture there is no tender_id or id because a successful capture returns just “{}”.

I am also using sandbox credentials. The charge was done with a nonce generated with sandbox credentials as well.

What’s wrong?

Thanks...

POST to:

 https://connect.squareup.com/v2/locations/CBASEHHNorL75TjuSOAvKQLnuNYgAQ/transactions/a2905f34-c8e8-5534-7676-82e8c580e9bf/refund

With this JSON:

 {  
    "idempotency_key":"6464dc19-1703-47c0-81f9-4f0f1361eada",
    "tender_id":"291d56b3-1e73-5bff-6e8e-719fd134b83f",
    "reason":”Partial refund",
    "amount_money":{  
       "amount":4500,
       "currency":"USD"
   }
 }

Gives this reply:

 {
   "errors": [
     {
       "category": "INVALID_REQUEST_ERROR",
       "code": "NOT_FOUND",
       "detail": "Location `CBASEHHNorL75TjuSOAvKQLnuNYgAQ` does not have a transaction tender with ID `291d56b3-1e73-5bff-6e8e-719fd134b83f`."
     }
   ]
 }

UPDATE: The result from the requested GET call (in the comments to the answer) is:

 {  
    "transaction":{  
  "id":"a2905f34-c8e8-5534-7676-82e8c580e9bf",
  "location_id":"CBASEHHNorL75TjuSOAvKQLnuNYgAQ",
  "created_at":"2017-02-21T22:08:10Z",
  "tenders":[  
     {  
        "id":"a18b98c7-5ac7-51c1-618c-3b95ee124c1b",
        "location_id":"CBASEHHNorL75TjuSOAvKQLnuNYgAQ",
        "transaction_id":"a2905f34-c8e8-5534-7676-82e8c580e9bf",
        "created_at":"2017-02-21T22:08:10Z",
        "note":"Online Transaction",
        "amount_money":{  
           "amount":12500,
           "currency":"USD"
        },
        "processing_fee_money":{  
           "amount":372,
           "currency":"USD"
        },
        "type":"CARD",
        "card_details":{  
           "status":"CAPTURED",
           "card":{  
              "card_brand":"VISA",
              "last_4":"5858"
           },
           "entry_method":"KEYED"
        }
     }
  ],
  "reference_id":"63614ae8-539a-4339-b5c7-554bae64fbed",
  "product":"EXTERNAL_API"
    }
 }

Upvotes: 0

Views: 287

Answers (1)

tristansokol
tristansokol

Reputation: 4271

After you capture, have you tried listing/retrieving the transaction to get the full details, including tender ids? Could you post your response from GET /v2/locations/CBASEHHNorL75TjuSOAvKQLnuNYgAQ/transactions/a2905f34-c8e8-5534-7676-82e8c580e9bf if that doesn't work?

Upvotes: 0

Related Questions