Skip to content

Latest commit

 

History

History
211 lines (166 loc) · 18.5 KB

File metadata and controls

211 lines (166 loc) · 18.5 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 main

import(
	"context"
	"os"
	gr4vygo "github.com/gr4vy/gr4vy-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := gr4vygo.New(
        gr4vygo.WithMerchantAccountID("default"),
        gr4vygo.WithSecurity(os.Getenv("GR4VY_BEARER_AUTH")),
    )

    res, err := s.Transactions.Refunds.List(ctx, "7099948d-7286-47e4-aad8-b68f7eb44591")
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
transactionID string ✔️ The ID of the transaction 7099948d-7286-47e4-aad8-b68f7eb44591
merchantAccountID *string The ID of the merchant account to use for this request.
opts []operations.Option The options for this request.

Response

*components.Refunds, error

Errors

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

Create

Create a refund for a transaction.

Example Usage

package main

import(
	"context"
	"os"
	gr4vygo "github.com/gr4vy/gr4vy-go"
	"github.com/gr4vy/gr4vy-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := gr4vygo.New(
        gr4vygo.WithMerchantAccountID("default"),
        gr4vygo.WithSecurity(os.Getenv("GR4VY_BEARER_AUTH")),
    )

    res, err := s.Transactions.Refunds.Create(ctx, "7099948d-7286-47e4-aad8-b68f7eb44591", components.TransactionRefundCreate{}, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
transactionID string ✔️ The ID of the transaction 7099948d-7286-47e4-aad8-b68f7eb44591
transactionRefundCreate components.TransactionRefundCreate ✔️ N/A
merchantAccountID *string The ID of the merchant account to use for this request.
idempotencyKey *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
opts []operations.Option The options for this request.

Response

*components.Refund, error

Errors

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

Get

Fetch refund for a transaction.

Example Usage

package main

import(
	"context"
	"os"
	gr4vygo "github.com/gr4vy/gr4vy-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := gr4vygo.New(
        gr4vygo.WithMerchantAccountID("default"),
        gr4vygo.WithSecurity(os.Getenv("GR4VY_BEARER_AUTH")),
    )

    res, err := s.Transactions.Refunds.Get(ctx, "7099948d-7286-47e4-aad8-b68f7eb44591", "6a1d4e46-14ed-4fe1-a45f-eff4e025d211")
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description Example
ctx context.Context ✔️ The context to use for the request.
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 *string The ID of the merchant account to use for this request.
opts []operations.Option The options for this request.

Response

*components.Refund, error

Errors

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