Skip to content

Latest commit

 

History

History
259 lines (189 loc) · 12.3 KB

File metadata and controls

259 lines (189 loc) · 12.3 KB

GiftCards

Overview

Available Operations

  • get - Get gift card
  • delete - Delete a gift card
  • create - Create gift card
  • list - List gift cards

get

Fetch details about a gift card.

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->giftCards->get(
    giftCardId: '356d56e5-fe16-42ae-97ee-8d55d846ae2e'
);

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

Parameters

Parameter Type Required Description Example
giftCardId string ✔️ The ID of the gift card. 356d56e5-fe16-42ae-97ee-8d55d846ae2e
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?GetGiftCardResponse

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 */*

delete

Removes a gift card from our system.

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->giftCards->delete(
    giftCardId: '356d56e5-fe16-42ae-97ee-8d55d846ae2e'
);

if ($response->statusCode === 200) {
    // handle response
}

Parameters

Parameter Type Required Description Example
giftCardId string ✔️ The ID of the gift card. 356d56e5-fe16-42ae-97ee-8d55d846ae2e
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?DeleteGiftCardResponse

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

Store a new gift card in the vault.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

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

$giftCardCreate = new Gr4vy\GiftCardCreate(
    number: '4123455541234561234',
    pin: '1234',
);

$response = $sdk->giftCards->create(
    giftCardCreate: $giftCardCreate
);

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

Parameters

Parameter Type Required Description Example
giftCardCreate GiftCardCreate ✔️ N/A
merchantAccountId ?string The ID of the merchant account to use for this request. default

Response

?CreateGiftCardResponse

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 */*

list

Browser all gift cards.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Gr4vy;

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

$request = new Gr4vy\ListGiftCardsRequest();

$responses = $sdk->giftCards->list(
    request: $request
);


foreach ($responses as $response) {
    if ($response->statusCode === 200) {
        // handle response
    }
}

Parameters

Parameter Type Required Description
$request Gr4vy\ListGiftCardsRequest ✔️ The request object to use for the request.

Response

?ListGiftCardsResponse

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 */*