Skip to main content
POST
/
transactions
/
{transaction_id}
/
refunds
C#
using Gr4vy;
using Gr4vy.Models.Components;

var sdk = new Gr4vySDK(
    id: "mattilda",
    server: SDKConfig.Server.Sandbox,
    bearerAuthSource: Auth.WithToken(privateKey),
    merchantAccountId: "default"
);

var res = await sdk.Transactions.Refunds.CreateAsync(
    transactionId: "7099948d-7286-47e4-aad8-b68f7eb44591",
    transactionRefundCreate: new TransactionRefundCreate() {}
);

// handle response
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "transaction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "status": "processing",
  "currency": "<string>",
  "amount": 49999999,
  "target_type": "payment-method",
  "reconciliation_id": "<string>",
  "transaction_reconciliation_id": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "type": "refund",
  "payment_service_refund_id": "refund_xYqd43gySMtori",
  "reason": "Refund due to user request.",
  "target_id": "07e70d14-a0c0-4ff5-bd4a-509959af0e4d",
  "external_identifier": "refund-12345",
  "transaction_external_identifier": "transaction-12345",
  "creator": {
    "email_address": "[email protected]",
    "id": "07e70d14-a0c0-4ff5-bd4a-509959af0e4d",
    "name": "Jhon Doe"
  }
}
This endpoint requires the transactions.write scope.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-gr4vy-merchant-account-id
string | null

The ID of the merchant account to use for this request.

Example:

"default"

Path Parameters

transaction_id
string<uuid>
required

The ID of the transaction

Body

application/json
amount
integer | null

The amount to refund, in the smallest currency unit (e.g., cents). If omitted, a full refund will be requested.

Required range: 0 <= x <= 99999999
Example:

1299

reason
string | null

An optional reason to attach extra context to the refund request.

Maximum string length: 100
Example:

"Refund due to user request."

external_identifier
string | null

An external identifier that can be used to match the refund against your own records.

Required string length: 1 - 300
Example:

"refund-12345"

Response

Successful Response

id
string<uuid>
required

The unique identifier for the refund.

transaction_id
string<uuid>
required

The ID of the transaction associated with this refund.

status
enum<string>
required

The status of the refund.

Available options:
processing,
succeeded,
failed,
declined,
voided
currency
string
required

The ISO 4217 currency code for this refund. Will always match that of the associated transaction.

amount
integer
required

The amount of this refund, in the smallest currency unit (for example, cents or pence).

Required range: 0 <= x <= 99999999
target_type
enum<string>
required

The type of the instrument that was refunded.

Available options:
payment-method
reconciliation_id
string
required

The base62 encoded refund ID. This represents a shorter version of this refund's id which is sent to payment services, anti-fraud services, and other connectors. You can use this ID to reconcile a payment service's refund against our system.

transaction_reconciliation_id
string
required

The base62 encoded transaction ID. This represents a shorter version of the related transaction's id which is sent to payment services, anti-fraud services, and other connectors. You can use this ID to reconcile a payment service's transaction against our system.

created_at
string<date-time>
required

The date this refund was created at.

updated_at
string<date-time>
required

The date this refund was last updated at.

type
string
default:refund

Always refund.

Allowed value: "refund"
payment_service_refund_id
string | null

The payment service's unique ID for the refund.

Required string length: 1 - 300
Example:

"refund_xYqd43gySMtori"

reason
string | null

The reason for this refund. Could be a multiline string.

Example:

"Refund due to user request."

target_id
string<uuid> | null

The optional ID of the instrument that was refunded. This may be null if the instrument was not stored.

Example:

"07e70d14-a0c0-4ff5-bd4a-509959af0e4d"

external_identifier
string | null

An external identifier that can be used to match the refund against your own records.

Example:

"refund-12345"

transaction_external_identifier
string | null

An external identifier that can be used to match the transaction against your own records.

Example:

"transaction-12345"

creator
Creator · object

The user that created this resource

Example:
{
"email_address": "[email protected]",
"id": "07e70d14-a0c0-4ff5-bd4a-509959af0e4d",
"name": "Jhon Doe"
}