Skip to content

Latest commit

 

History

History
229 lines (167 loc) · 19.3 KB

File metadata and controls

229 lines (167 loc) · 19.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

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.gift_cards.get(gift_card_id="356d56e5-fe16-42ae-97ee-8d55d846ae2e")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
gift_card_id str ✔️ The ID of the gift card. 356d56e5-fe16-42ae-97ee-8d55d846ae2e
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.GiftCard

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

delete

Removes a gift card from our system.

Example Usage

from gr4vy import Gr4vy
import os


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

    g_client.gift_cards.delete(gift_card_id="356d56e5-fe16-42ae-97ee-8d55d846ae2e")

    # Use the SDK ...

Parameters

Parameter Type Required Description Example
gift_card_id str ✔️ The ID of the gift card. 356d56e5-fe16-42ae-97ee-8d55d846ae2e
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.

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

Store a new gift card in the vault.

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.gift_cards.create(number="4123455541234561234", pin="1234")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
number str ✔️ The 16-19 digit number for the gift card. 4123455541234561234
pin str ✔️ The PIN for this gift card. 1234
merchant_account_id Optional[str] The ID of the merchant account to use for this request. default
buyer_id OptionalNullable[str] The ID of the buyer to associate this gift card to. If this field is provided then the buyer_external_identifier field needs to be unset. fe26475d-ec3e-4884-9553-f7356683f7f9
buyer_external_identifier OptionalNullable[str] The external_identifier of the buyer to associate this gift card to. If this field is provided then the buyer_id field needs to be unset. buyer-12345
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.GiftCard

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

list

Browser all gift cards.

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.gift_cards.list(limit=20)

    while res is not None:
        # Handle items

        res = res.next()

Parameters

Parameter Type Required Description Example
buyer_external_identifier OptionalNullable[str] N/A
buyer_id OptionalNullable[str] N/A
cursor OptionalNullable[str] N/A
limit Optional[int] N/A
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.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.APIError 4XX, 5XX */*