Skip to content

Latest commit

 

History

History
208 lines (157 loc) · 16.9 KB

File metadata and controls

208 lines (157 loc) · 16.9 KB

Transactions.Refunds

Overview

Available Operations

  • list - List transaction refunds
  • create - Create transaction refund
  • get - Get transaction refund

list

List refunds for a transaction.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.ListTransactionRefundsResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Gr4vy sdk = Gr4vy.builder()
                .merchantAccountId("default")
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        ListTransactionRefundsResponse res = sdk.transactions().refunds().list()
                .transactionId("7099948d-7286-47e4-aad8-b68f7eb44591")
                .call();

        if (res.refunds().isPresent()) {
            System.out.println(res.refunds().get());
        }
    }
}

Parameters

Parameter Type Required Description Example
transactionId String ✔️ The ID of the transaction 7099948d-7286-47e4-aad8-b68f7eb44591
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.

Response

ListTransactionRefundsResponse

Errors

Error Type Status Code Content Type
models/errors/Error400 400 application/json
models/errors/Error401 401 application/json
models/errors/Error403 403 application/json
models/errors/Error404 404 application/json
models/errors/Error405 405 application/json
models/errors/Error409 409 application/json
models/errors/HTTPValidationError 422 application/json
models/errors/Error425 425 application/json
models/errors/Error429 429 application/json
models/errors/Error500 500 application/json
models/errors/Error502 502 application/json
models/errors/Error504 504 application/json
models/errors/APIException 4XX, 5XX */*

create

Create a refund for a transaction.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.components.TransactionRefundCreate;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.CreateTransactionRefundResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Gr4vy sdk = Gr4vy.builder()
                .merchantAccountId("default")
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        CreateTransactionRefundResponse res = sdk.transactions().refunds().create()
                .transactionId("7099948d-7286-47e4-aad8-b68f7eb44591")
                .transactionRefundCreate(TransactionRefundCreate.builder()
                    .build())
                .call();

        if (res.refund().isPresent()) {
            System.out.println(res.refund().get());
        }
    }
}

Parameters

Parameter Type Required Description Example
transactionId String ✔️ The ID of the transaction 7099948d-7286-47e4-aad8-b68f7eb44591
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.
idempotencyKey JsonNullable<String> A unique key that identifies this request. Providing this header will make this an idempotent request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid collisions. request-12345
transactionRefundCreate TransactionRefundCreate ✔️ N/A

Response

CreateTransactionRefundResponse

Errors

Error Type Status Code Content Type
models/errors/Error400 400 application/json
models/errors/Error401 401 application/json
models/errors/Error403 403 application/json
models/errors/Error404 404 application/json
models/errors/Error405 405 application/json
models/errors/Error409 409 application/json
models/errors/HTTPValidationError 422 application/json
models/errors/Error425 425 application/json
models/errors/Error429 429 application/json
models/errors/Error500 500 application/json
models/errors/Error502 502 application/json
models/errors/Error504 504 application/json
models/errors/APIException 4XX, 5XX */*

get

Fetch refund for a transaction.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.GetTransactionRefundResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Gr4vy sdk = Gr4vy.builder()
                .merchantAccountId("default")
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        GetTransactionRefundResponse res = sdk.transactions().refunds().get()
                .transactionId("7099948d-7286-47e4-aad8-b68f7eb44591")
                .refundId("6a1d4e46-14ed-4fe1-a45f-eff4e025d211")
                .call();

        if (res.refund().isPresent()) {
            System.out.println(res.refund().get());
        }
    }
}

Parameters

Parameter Type Required Description Example
transactionId String ✔️ The ID of the transaction 7099948d-7286-47e4-aad8-b68f7eb44591
refundId String ✔️ The ID of the refund 6a1d4e46-14ed-4fe1-a45f-eff4e025d211
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.

Response

GetTransactionRefundResponse

Errors

Error Type Status Code Content Type
models/errors/Error400 400 application/json
models/errors/Error401 401 application/json
models/errors/Error403 403 application/json
models/errors/Error404 404 application/json
models/errors/Error405 405 application/json
models/errors/Error409 409 application/json
models/errors/HTTPValidationError 422 application/json
models/errors/Error425 425 application/json
models/errors/Error429 429 application/json
models/errors/Error500 500 application/json
models/errors/Error502 502 application/json
models/errors/Error504 504 application/json
models/errors/APIException 4XX, 5XX */*