Skip to content

Latest commit

 

History

History
79 lines (62 loc) · 10.4 KB

File metadata and controls

79 lines (62 loc) · 10.4 KB

Transactions.Refunds.All

Overview

Available Operations

  • Create - Create batch transaction refund

Create

Create a refund for all instruments on 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.All.Create(ctx, "7099948d-7286-47e4-aad8-b68f7eb44591", nil, &components.TransactionRefundAllCreate{
        Reason: gr4vygo.Pointer("Refund due to user request."),
        ExternalIdentifier: gr4vygo.Pointer("refund-12345"),
    })
    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.
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
transactionRefundAllCreate *components.TransactionRefundAllCreate N/A
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 */*