Skip to content

Latest commit

 

History

History
199 lines (144 loc) · 14.8 KB

File metadata and controls

199 lines (144 loc) · 14.8 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

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();



$response = $sdk->transactions->refunds->list(
    transactionId: '7099948d-7286-47e4-aad8-b68f7eb44591'
);

if ($response->refunds !== null) {
    // handle response
}

Parameters

Parameter Type Required Description Example
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. default

Response

?ListTransactionRefundsResponse

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\APIException 4XX, 5XX */*

create

Create a refund for a transaction.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$transactionRefundCreate = new Gr4vy\TransactionRefundCreate();

$response = $sdk->transactions->refunds->create(
    transactionId: '7099948d-7286-47e4-aad8-b68f7eb44591',
    transactionRefundCreate: $transactionRefundCreate

);

if ($response->refund !== null) {
    // handle response
}

Parameters

Parameter Type Required Description Example
transactionId string ✔️ The ID of the transaction 7099948d-7286-47e4-aad8-b68f7eb44591
transactionRefundCreate TransactionRefundCreate ✔️ N/A
merchantAccountId ?string The ID of the merchant account to use for this request. default
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

Response

?CreateTransactionRefundResponse

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\APIException 4XX, 5XX */*

get

Fetch refund for a transaction.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

$sdk = Gr4vy\SDK::builder()
    ->setMerchantAccountId('default')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();



$response = $sdk->transactions->refunds->get(
    transactionId: '7099948d-7286-47e4-aad8-b68f7eb44591',
    refundId: '6a1d4e46-14ed-4fe1-a45f-eff4e025d211'

);

if ($response->refund !== null) {
    // handle response
}

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 ?string The ID of the merchant account to use for this request. default

Response

?GetTransactionRefundResponse

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\APIException 4XX, 5XX */*