首页 > 解决方案 > Square 退款 API 是否停止工作?

问题描述

使用 POS API (iOS) 创建的交易是否已停止退款?

一段时间以来,我们一直在使用Square Connect V2 API进行退款,我们还没有迁移到Payments API

我们通过支付表单处理在线支付,并使用POS SDK (iOS)进行当面支付,并且使用现已弃用的create-refund端点对所有交易进行退款,没有任何问题。

但是现在突然之间,Unknown payment with id XXXXXXXXXXX即使通过新的 Payments API 发出退款,当面交易的退款也开始回复错误。

当我调用列表付款方式时,所有在线交易都有对等付款并且退款有效,但对于面对面交易,没有对等付款记录。

示例请求:使用已弃用的 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”}'

在线交易退款时的响应:

{"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"}}

退还当面交易时的响应:

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

示例请求:使用 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"}'

在线交易退款时的响应:

{"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"}}

退还当面交易时的响应:

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

标签: square

解决方案


推荐阅读