mutation paymentRefundAuthenticated
Refunds a payment, in full or in part, through the provider that took it.
What a successful response means depends on that provider. NMI answers synchronously, so the refund is COMPLETED. CLP accepts the refund and settles it later, so the refund is RECEIVED and completes when the provider confirms it. Plaid payments cannot be refunded through this API yet.
A refund the provider refuses is an error rather than a result. Supply an idempotencyKey so a retried request returns the refund the first request created instead of issuing a second one.
Returns PaymentRefund!
Arguments
| Argument | Type | Description |
|---|---|---|
input | PaymentRefundInput! |
Example request
curl -X POST 'https://graph.clientloop.com/' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{
"query": "mutation PaymentRefund($input: PaymentRefundInput!) { paymentRefund(input: $input) { id payment provider amount currency processorReference reference status requestedAt } }",
"variables": {
"input": {
"payment": "abc123"
}
}
}'const response = await fetch('https://graph.clientloop.com/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <api-key>',
},
body: JSON.stringify({
query: `
mutation PaymentRefund($input: PaymentRefundInput!) {
paymentRefund(input: $input) {
id
payment
provider
amount
currency
processorReference
reference
status
requestedAt
}
}
`,
variables: {
"input": {
"payment": "abc123"
}
},
}),
});
const { data, errors } = await response.json();<?php
$body = <<<'JSON'
{
"query": "mutation PaymentRefund($input: PaymentRefundInput!) { paymentRefund(input: $input) { id payment provider amount currency processorReference reference status requestedAt } }",
"variables": {
"input": {
"payment": "abc123"
}
}
}
JSON;
$ch = curl_init('https://graph.clientloop.com/');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer <api-key>',
],
CURLOPT_POSTFIELDS => $body,
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
var body = """
{
"query": "mutation PaymentRefund($input: PaymentRefundInput!) { paymentRefund(input: $input) { id payment provider amount currency processorReference reference status requestedAt } }",
"variables": {
"input": {
"payment": "abc123"
}
}
}
""";
var request = HttpRequest.newBuilder(URI.create("https://graph.clientloop.com/"))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <api-key>")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());using System.Net.Http;
using System.Text;
var body = """
{
"query": "mutation PaymentRefund($input: PaymentRefundInput!) { paymentRefund(input: $input) { id payment provider amount currency processorReference reference status requestedAt } }",
"variables": {
"input": {
"payment": "abc123"
}
}
}
""";
using var client = new HttpClient();
using var content = new StringContent(body, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Add("Authorization", "Bearer <api-key>");
var response = await client.PostAsync("https://graph.clientloop.com/", content);
var result = await response.Content.ReadAsStringAsync();Types
input PaymentRefundInput
| Field | Type | Description |
|---|---|---|
payment | ID! | The payment to refund. |
amount | Amount | Amount to refund, as a decimal string. Omit to refund everything still refundable on the payment. Must not exceed the amount captured less any refund already issued. |
reference | String | Optional reference of your own for reconciling the refund. |
idempotencyKey | String | Optional caller-supplied key that makes the call idempotent. Repeating a call with the same key and org is answered as the first call was — with the refund it created, or with its rejection — and never refunds again. A repeat that names a different payment or amount is rejected. Strongly recommended: without it a retried request issues a second refund whenever the amount still fits the balance. |
type PaymentRefund
| Field | Type | Description |
|---|---|---|
id | ID! | Unique id of the refund. |
payment | ID! | The payment the refund was issued against. |
provider | PaymentProvider! | The provider the payment was taken through, which is the one refunding it. |
amount | Amount! | Amount refunded, as a decimal string. |
currency | Currency! | Currency of the refund; always the currency of the payment. |
processorReference | String | The provider's own reference for the refund, when it returned one. |
reference | String | The reference supplied when the refund was requested. |
status | PaymentRefundStatus! | |
requestedAt | DateTime! | When the refund was requested. |
scalar Amount
A monetary amount with up to two decimal places. Ex. 111.11
enum PaymentProvider
NMIPlaidCLP
scalar Currency
Three letter ISO 4217 currency code. Ex. USD
enum PaymentRefundStatus
REQUESTED— The provider's answer is not known: the refund may or may not have gone through. Check it before retrying.RECEIVED— The provider accepted the refund. The money has not moved yet.COMPLETED— The refund is complete.FAILED— The provider rejected the refund.REVERSED— A completed refund was pulled back by the provider.
scalar DateTime
ISO 8601 formatted date time. Ex. 2023-11-23T14:30:00Z