Collections Retry a refund
Retry a refund
Sends a failed refund again. It works only while the collection's `onramp_status` is `refund_failed`, and `refund_id` must be one of the collection's refunds from List refunds. The response and webhooks are the same as for Refund a collection.
Api-Key
Path parameters
NameDescription
idThe collection's
transaction_idrefund_idThe failed refund's
refund_idHeaders
NameDescription
Idempotency-KeyRequired for POST requests. Reuse it only to retry the same request. Gravv stores a 400 with the key for 24 hours, so use a new key after you fix a rejected body.
Response
Returns 200 OK. The refund was sent again
NameDescription
dataShow 4 child attributesobject
successtransaction_idThe collection's
transaction_idrefund_idThe refund's ID. Use it to retry the refund if it fails.
statussucceeded means the money is on its way back to the card and the collection is refunded. pending means the refund is in progress and the collection is refund_pending.
Possible values: pending, succeeded
errorErrors
| Status | Meaning |
|---|---|
| 200 | The refund was sent again |
| 400 | The retry was refused. A refund_id that is not on this collection returns refund not found for this transaction: resource not found. A collection that is not refund_failed returns cannot perform 'retry_refund' in state '<status>': …. |
Was this page helpful? Yes No
Previous
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl --request POST \
--url 'https://api.gravv.xyz/v1/collections/07b655cc-3dbd-4f6c-a16c-4657946d2e08/refunds/8c1e4b2a-7f3d-4a6e-b9c0-2d5f8e1a7b34/retry' \
--header 'Api-Key: <api-key>' \
--header 'Idempotency-Key: order_789_attempt_1'
const response = await fetch('https://api.gravv.xyz/v1/collections/07b655cc-3dbd-4f6c-a16c-4657946d2e08/refunds/8c1e4b2a-7f3d-4a6e-b9c0-2d5f8e1a7b34/retry', {
method: 'POST',
headers: {
'Api-Key': '<api-key>',
'Idempotency-Key': 'order_789_attempt_1',
},
});
const data = await response.json();
console.log(response.status, data);
import requests
url = "https://api.gravv.xyz/v1/collections/07b655cc-3dbd-4f6c-a16c-4657946d2e08/refunds/8c1e4b2a-7f3d-4a6e-b9c0-2d5f8e1a7b34/retry"
headers = {
"Api-Key": "<api-key>",
"Idempotency-Key": "order_789_attempt_1",
}
response = requests.post(url, headers=headers)
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("POST", "https://api.gravv.xyz/v1/collections/07b655cc-3dbd-4f6c-a16c-4657946d2e08/refunds/8c1e4b2a-7f3d-4a6e-b9c0-2d5f8e1a7b34/retry", nil)
if err != nil {
panic(err)
}
req.Header.Set("Api-Key", "<api-key>")
req.Header.Set("Idempotency-Key", "order_789_attempt_1")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status)
fmt.Println(string(body))
}
require "net/http"
require "uri"
uri = URI("https://api.gravv.xyz/v1/collections/07b655cc-3dbd-4f6c-a16c-4657946d2e08/refunds/8c1e4b2a-7f3d-4a6e-b9c0-2d5f8e1a7b34/retry")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
request = Net::HTTP::Post.new(uri)
request["Api-Key"] = "<api-key>"
request["Idempotency-Key"] = "order_789_attempt_1"
response = http.request(request)
puts response.code
puts response.body
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.gravv.xyz/v1/collections/07b655cc-3dbd-4f6c-a16c-4657946d2e08/refunds/8c1e4b2a-7f3d-4a6e-b9c0-2d5f8e1a7b34/retry',
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Api-Key: <api-key>',
'Idempotency-Key: order_789_attempt_1',
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
echo $status, PHP_EOL, $response, PHP_EOL;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.gravv.xyz/v1/collections/07b655cc-3dbd-4f6c-a16c-4657946d2e08/refunds/8c1e4b2a-7f3d-4a6e-b9c0-2d5f8e1a7b34/retry"))
.header("Api-Key", "<api-key>")
.header("Idempotency-Key", "order_789_attempt_1")
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.gravv.xyz/v1/collections/07b655cc-3dbd-4f6c-a16c-4657946d2e08/refunds/8c1e4b2a-7f3d-4a6e-b9c0-2d5f8e1a7b34/retry");
request.Headers.TryAddWithoutValidation("Api-Key", "<api-key>");
request.Headers.TryAddWithoutValidation("Idempotency-Key", "order_789_attempt_1");
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Responseapplication/json
200400OK
{
"data": {
"success": true,
"transaction_id": "07b655cc-3dbd-4f6c-a16c-4657946d2e08",
"refund_id": "8c1e4b2a-7f3d-4a6e-b9c0-2d5f8e1a7b34",
"status": "pending"
},
"error": null
}
{
"data": null,
"error": "refund not found for this transaction: resource not found"
}