Skip to content

Latest commit

 

History

History
178 lines (130 loc) · 20.4 KB

File metadata and controls

178 lines (130 loc) · 20.4 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

from gr4vy import Gr4vy
import os


with Gr4vy(
    merchant_account_id="default",
    bearer_auth=os.getenv("GR4VY_BEARER_AUTH", ""),
) as g_client:

    res = g_client.transactions.refunds.list(transaction_id="7099948d-7286-47e4-aad8-b68f7eb44591")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
transaction_id str ✔️ The ID of the transaction 7099948d-7286-47e4-aad8-b68f7eb44591
merchant_account_id Optional[str] The ID of the merchant account to use for this request. default
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.Refunds

Errors

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

create

Create a refund for a transaction.

Example Usage

from gr4vy import Gr4vy
import os


with Gr4vy(
    merchant_account_id="default",
    bearer_auth=os.getenv("GR4VY_BEARER_AUTH", ""),
) as g_client:

    res = g_client.transactions.refunds.create(transaction_id="7099948d-7286-47e4-aad8-b68f7eb44591")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
transaction_id str ✔️ The ID of the transaction 7099948d-7286-47e4-aad8-b68f7eb44591
merchant_account_id Optional[str] The ID of the merchant account to use for this request. default
idempotency_key OptionalNullable[str] 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
amount OptionalNullable[int] The amount to refund, in the smallest currency unit (e.g., cents). If omitted, a full refund will be requested. 1299
target_type Optional[models.RefundTargetType] N/A
target_id OptionalNullable[str] The optional ID of the instrument to refund for. This is only required when the target_type is set to gift-card-redemption. 7a6c366d-9205-45ab-8021-0d9ee37f20f2
reason OptionalNullable[str] An optional reason to attach extra context to the refund request. Refund due to user request.
external_identifier OptionalNullable[str] An external identifier that can be used to match the refund against your own records. refund-12345
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.Refund

Errors

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

get

Fetch refund for a transaction.

Example Usage

from gr4vy import Gr4vy
import os


with Gr4vy(
    merchant_account_id="default",
    bearer_auth=os.getenv("GR4VY_BEARER_AUTH", ""),
) as g_client:

    res = g_client.transactions.refunds.get(transaction_id="7099948d-7286-47e4-aad8-b68f7eb44591", refund_id="6a1d4e46-14ed-4fe1-a45f-eff4e025d211")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
transaction_id str ✔️ The ID of the transaction 7099948d-7286-47e4-aad8-b68f7eb44591
refund_id str ✔️ The ID of the refund 6a1d4e46-14ed-4fe1-a45f-eff4e025d211
merchant_account_id Optional[str] The ID of the merchant account to use for this request. default
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.Refund

Errors

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