每次我嘗試退還一張卡時,都會粘貼下面的JSON。這發生在我授權卡後,然後獲取費用,然後想要發出部分退款。對於「tender_id」,我已經在授權期間嘗試了交易ID和我交給的ID。當然,對於捕獲,沒有tender_id或id,因爲成功的捕獲只返回「{}」。Square REST API:發佈退款時出錯
我也在使用沙盒憑證。該收費是使用沙盒憑證生成的隨機數完成的。
怎麼了?
謝謝...
POST到:
https://connect.squareup.com/v2/locations/CBASEHHNorL75TjuSOAvKQLnuNYgAQ/transactions/a2905f34-c8e8-5534-7676-82e8c580e9bf/refund
有了這個JSON:
{
"idempotency_key":"6464dc19-1703-47c0-81f9-4f0f1361eada",
"tender_id":"291d56b3-1e73-5bff-6e8e-719fd134b83f",
"reason":」Partial refund",
"amount_money":{
"amount":4500,
"currency":"USD"
}
}
給出了這樣的答覆:
{
"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:從結果請求GET調用(在com發言:答案)是:
{
"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"
}
}
通常退款只能在原始交易完成後的特定時間段後進行。這張卡什麼時候收費?嘗試在昨天收取的卡上退款。 –
我其實想到了這一點,但文檔中沒有說這是事實。如果是這種情況,並且所需的延遲時間超過幾分鐘,我會遇到問題。 –
唯一的時間限制是網絡連接到我們系統的時間。你應該幾乎可以即時退款。 – tristansokol