Has the Square refund API stopped working?

196 Views Asked by At

Has the refund stopped working for transactions created using the Point of Sale API (iOS)?

We've been using the Square Connect V2 API for a while now for refunds, we haven't migrated yet to the Payments API.

We process online payments through the Payment Form and in-person payments using the POS SDK (iOS) and have been refunding all the transactions without a problem using the, now deprecated, create-refund endpoint.

But now all of the sudden the refund for in-person transactions started replying with the error Unknown payment with id XXXXXXXXXXX even when issuing the refund through the new Payments API.

When I call the list payments method, all the online transactions have an equivalent payment and the refund works, but for in-person transactions, there is no equivalent payment record.

Example request: Using deprecated Transactions API

curl https://connect.squareup.com/v2/locations/LOCATION_ID/transactions/TRANSACTION_ID/refund \
-x POST \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-d '{"amount_money":{"currency":"USD","amount":100},"reason":"requested_by_customer","tender_id":"XXXXXXXXXXX","idempotency_key":"some-idempotency”}'

Response when refunding an online transaction:

{"refund":{"id":"ZZZZZZZZZZZZZZZZZZZZ_YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY","location_id":"LOCATION_ID","transaction_id":"TRANSACTION_ID","tender_id":"XXXXXXXXXXX","created_at":"2020-01-28T19:20:27.672Z","reason":"requested_by_customer","amount_money":{"amount":100,"currency":"USD"},"status":"PENDING"}}

Response when refunding an in-person transaction:

{"errors":[{"category":"INVALID_REQUEST_ERROR","code":"BAD_REQUEST","detail":"Unknown payment with id XXXXXXXXXXX"}]}

Example request: Using Payments API

curl https://connect.squareup.com/v2/refunds \
-x POST \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-d '{"amount_money":{"currency":"USD","amount":100},"reason":"requested_by_customer","payment_id":"XXXXXXXXXXX","idempotency_key":"some-idempotency"}'

Response when refunding an online transaction:

{"refund": {"id": "ZZZZZZZZZZZZZZZZZZZZ_YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY","status": "PENDING","amount_money": {"amount": 100,"currency": "USD"},"payment_id": "XXXXXXXXXXX","order_id": "ORDER_ID","created_at": "2020-01-28T19:32:21.780Z","updated_at": "2020-01-28T19:32:21.970Z","location_id": "LOCATION_ID","reason": "requested_by_customer"}}

Response when refunding an in-person transaction:

{"errors": [{"code": "BAD_REQUEST","detail": "Unknown payment with id XXXXXXXXXXX","category": "INVALID_REQUEST_ERROR"}]}
0

There are 0 best solutions below