### Install Gr4vy SDK with uv Source: https://github.com/gr4vy/gr4vy-python/blob/main/README.md Install the Gr4vy SDK using uv, a fast Python package installer. This is the recommended method for its speed and modern tooling capabilities. ```bash uv add gr4vy ``` -------------------------------- ### Install and Run Tests with Poetry Source: https://github.com/gr4vy/gr4vy-python/blob/main/README.md Use these commands to install project dependencies and run the test suite using Poetry. Ensure you have Python and Poetry installed, and the private_key.pem file downloaded. ```sh poetry install poetry run pytest ``` -------------------------------- ### Install Gr4vy SDK with pip Source: https://github.com/gr4vy/gr4vy-python/blob/main/README.md Install the Gr4vy SDK using pip, Python's default package installer. This command allows for easy installation and management of packages from PyPI. ```bash pip install gr4vy ``` -------------------------------- ### Install Gr4vy SDK with Poetry Source: https://github.com/gr4vy/gr4vy-python/blob/main/README.md Install the Gr4vy SDK using Poetry, a tool for dependency management and package publishing. It uses a single pyproject.toml file for project metadata and dependencies. ```bash poetry add gr4vy ``` -------------------------------- ### PaymentMethodCard Example Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/payoutcreatepaymentmethod.md Represents a card payment method for payouts. Replace /* values here */ with actual card details. ```python value: models.PaymentMethodCard = /* values here */ ``` -------------------------------- ### PaymentMethodStoredCard Example Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/payoutcreatepaymentmethod.md Represents a stored card payment method for payouts. Replace /* values here */ with actual stored card identifiers. ```python value: models.PaymentMethodStoredCard = /* values here */ ``` -------------------------------- ### Instantiate UserDevice Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/userdevice.md Demonstrates how to import and instantiate the UserDevice model. Unrecognized string values are captured as UnrecognizedStr. ```python from gr4vy.models import UserDevice # Open enum: unrecognized values are captured as UnrecognizedStr value: UserDevice = "desktop" ``` -------------------------------- ### Installment Configuration Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/paymentlinkssdk/README.md Specifies the number of installments a buyer is required to make. ```APIDOC ## Parameters ### Request Body - **installment_count** (OptionalNullable[int]) - Optional - The number of installments a buyer is required to make. ``` -------------------------------- ### Instantiate IntegrationClient Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/integrationclient.md Demonstrates how to import and instantiate the IntegrationClient model. Unrecognized string values are captured as IntegrationClient.UnrecognizedStr. ```python from gr4vy.models import IntegrationClient # Open enum: unrecognized values are captured as UnrecognizedStr value: IntegrationClient = "redirect" ``` -------------------------------- ### FiservInstallmentOptions Fields Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/fiservinstallmentoptions.md This section details the fields available for configuring Fiserv installment options. These fields are passed to the Fiserv API to customize installment payment behavior. ```APIDOC ## FiservInstallmentOptions ### Fields - **number_of_installments** (*OptionalNullable[int]*): Passes the `order.installmentOptions.numberOfInstallments` field to the Fiserv API. Example: 6 - **installments_interest** (*OptionalNullable[bool]*): Passes the `order.installmentOptions.installmentsInterest` field to the Fiserv API. Example: true - **installment_delay_months** (*OptionalNullable[int]*): Passes the `order.installmentOptions.installmentDelayMonths` field to the Fiserv API. Example: 1 - **merchant_advice_code_supported** (*OptionalNullable[bool]*): Passes the `order.installmentOptions.merchantAdviceCodeSupported` field to the Fiserv API. Example: true ``` -------------------------------- ### Initialize Gr4vy SDK with Global Merchant Account ID Source: https://github.com/gr4vy/gr4vy-python/blob/main/README.md Demonstrates initializing the Gr4vy SDK with a global merchant account ID, which can be overridden on a per-operation basis. It also shows how to fetch a merchant account using the client. ```python 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.merchant_accounts.get(merchant_account_id="merchant-12345") # Handle response print(res) ``` -------------------------------- ### Get Report Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/reportssdk/README.md Fetches a report by its ID. ```APIDOC ## get Fetches a report by its ID. ### Parameters #### Path Parameters - **report_id** (str) - Required - The ID of the report to retrieve. ### Response **[models.Report](../../models/report.md)** ### 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 | */* | ``` -------------------------------- ### Initialize Gr4vy Client (Synchronous) Source: https://github.com/gr4vy/gr4vy-python/blob/main/README.md Instantiate the Gr4vy client for making synchronous API requests. Ensure the private key is accessible. ```python from gr4vy import Gr4vy, auth import os with Gr4vy( id="example", server="production", merchant_account_id="default", bearer_auth=auth.with_token(open("./private_key.pem").read()) ) as g_client: res = g_client.transactions.list() assert res is not None # Handle response print(res) ``` -------------------------------- ### get Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/checkoutsessions/README.md Retrieves the details of a specific checkout session. ```APIDOC ## get ### Description Get checkout session details. ### Method GET ### Endpoint /checkout-sessions/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the checkout session to retrieve. ### Response #### Success Response (200 OK) - **id** (string) - The unique identifier for the checkout session. - **amount** (integer) - The total amount for the checkout session. - **currency** (string) - The currency code for the checkout session. - **status** (string) - The current status of the checkout session. - **created_at** (string) - The timestamp when the session was created. #### Response Example { "id": "cs_abc123", "amount": 1000, "currency": "USD", "status": "pending", "created_at": "2023-10-27T10:00:00Z" } ``` -------------------------------- ### Instantiate PayoutStatus Enum Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/payoutstatus.md Demonstrates how to import and use the PayoutStatus enum. Unrecognized string values are handled gracefully. ```python from gr4vy.models import PayoutStatus # Open enum: unrecognized values are captured as UnrecognizedStr value: PayoutStatus = "declined" ``` -------------------------------- ### Create Payment Method Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/paymentmethodssdk/README.md This snippet demonstrates how to store a new payment method using the SDK. It includes setting up the Gr4vy client and making the `create` call with a request body. ```APIDOC ## POST /payment-methods ### Description Store a new payment method. ### Method POST ### Endpoint /payment-methods ### Parameters #### Request Body - **request_body** (models.Body) - Required - The request body for creating a payment method. - **merchant_account_id** (Optional[str]) - Optional - The ID of the merchant account to use for this request. ### Request Example ```python 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.payment_methods.create(request_body={ "method": "checkout-session", "id": "4137b1cf-39ac-42a8-bad6-1c680d5dab6b", }) # Handle response print(res) ``` ### Response #### Success Response (200) **models.PaymentMethod** - The created payment method details. ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Get Payment Link Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/paymentlinkssdk/README.md Fetch the details for a payment link. ```APIDOC ## get Fetch the details for a payment link. ### Description This method retrieves the details of a specific payment link using its unique identifier. ### Method GET ### Endpoint /payment-links/{payment_link_id} ### Parameters #### Path Parameters - **payment_link_id** (str) - Required - The unique identifier for the payment link. #### Query Parameters None #### Request Body None ### Request Example ```python from gr4vy import Gr4vy import os with Gr4vy( merchant_account_id="default", bearer_auth=os.getenv("GR4VY_BEARER_AUTH", "") ) as g_client: payment_link = g_client.payment_links.get(payment_link_id="a1b2c3d4-5678-90ab-cdef-1234567890ab") # Use the payment_link object ... ``` ### Response #### Success Response (200) - **payment_link_id** (str) - The unique identifier for the payment link. - **expiry_date** (str) - The date and time when the payment link will expire. - **status** (str) - The current status of the payment link (e.g., 'open', 'paid', 'expired'). - **amount** (int) - The amount for the payment. - **currency** (str) - The currency of the payment amount. - **created_at** (str) - The date and time when the payment link was created. - **updated_at** (str) - The date and time when the payment link was last updated. - **redirect_url** (str) - The URL to redirect the customer to for payment. - **description** (str) - An optional description for the payment link. - **metadata** (dict) - Optional metadata associated with the payment link. #### Response Example ```json { "payment_link_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "expiry_date": "2023-10-27T10:00:00Z", "status": "open", "amount": 1000, "currency": "USD", "created_at": "2023-10-26T10:00:00Z", "updated_at": "2023-10-26T10:00:00Z", "redirect_url": "https://example.com/pay?id=a1b2c3d4-5678-90ab-cdef-1234567890ab", "description": "Payment for order 123", "metadata": { "order_id": "123" } } ``` ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Get Payout Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/payouts/README.md Retrieves details of a specific payout by its ID. ```APIDOC ## GET /payouts/{payout_id} ### Description Retrieves details of a specific payout by its ID. ### Method GET ### Endpoint /payouts/{payout_id} ### Parameters #### Path Parameters - **payout_id** (str) - Required - The unique identifier of the payout. ### Response #### Success Response (200) - **object** - The response object containing details of the payout. ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Initialize GiftCardServiceProvider Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/giftcardserviceprovider.md Demonstrates how to import and use the GiftCardServiceProvider enum. Unrecognized values are captured as UnrecognizedStr. ```python from gr4vy.models import GiftCardServiceProvider # Open enum: unrecognized values are captured as UnrecognizedStr value: GiftCardServiceProvider = "mock-gift-card" ``` -------------------------------- ### Get Merchant Account Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/merchantaccountssdk/README.md Retrieves a specific merchant account by its ID. ```APIDOC ## get merchant_account ### Description Get a merchant account. ### Method GET ### Endpoint /merchant-accounts/{id} ### Parameters #### Path Parameters - **id** (str) - Required - The unique identifier of the merchant account to retrieve. #### Query Parameters - **retries** (Optional[utils.RetryConfig]) - Optional - Configuration to override the default retry behavior of the client. ### Response #### Success Response (200) **models.MerchantAccount** ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Instantiate UserStatus Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/userstatus.md Demonstrates how to import and use the UserStatus enum. Unrecognized values are captured as UnrecognizedStr. ```python from gr4vy.models import UserStatus # Open enum: unrecognized values are captured as UnrecognizedStr value: UserStatus = "active" ``` -------------------------------- ### Get Transaction Refund Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/transactionsrefunds/README.md Retrieves details of a specific transaction refund. ```APIDOC ## GET /transactions/{transaction_id}/refunds/{refund_id} ### Description Get transaction refund. ### Method GET ### Endpoint /transactions/{transaction_id}/refunds/{refund_id} ### Parameters #### Path Parameters - **transaction_id** (str) - Required - The ID of the transaction - **refund_id** (str) - Required - The ID of the refund ### Response (No response schema provided in the source) ### Errors (No error details provided in the source for this specific operation, but general error types may apply from the list operation.) ``` -------------------------------- ### Get Report Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/reportssdk/README.md Retrieves the details for a specific report using its ID. ```APIDOC ## GET /reports/{report_id} ### Description Retrieves the details for a specific report using its ID. ### Method GET ### Endpoint /reports/{report_id} ### Parameters #### Path Parameters - **report_id** (str) - Required - The ID of the report to retrieve details for. #### Query Parameters - **merchant_account_id** (Optional[str]) - Optional - The ID of the merchant account to use for this request. - **retries** (Optional[utils.RetryConfig]) - Optional - Configuration to override the default retry behavior of the client. ### Response #### Success Response (200) - **models.Report** - The details of the requested report. ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Instantiate ListBuyerPaymentMethodsOrderBy Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/listbuyerpaymentmethodsorderby.md Demonstrates how to import and instantiate the ListBuyerPaymentMethodsOrderBy enum with an 'asc' value. Unrecognized string values are captured as 'UnrecognizedStr'. ```python from gr4vy.models import ListBuyerPaymentMethodsOrderBy # Open enum: unrecognized values are captured as UnrecognizedStr value: ListBuyerPaymentMethodsOrderBy = "asc" ``` -------------------------------- ### Get Checkout Session Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/checkoutsessions/README.md Retrieve the information stored on a checkout session. ```APIDOC ## GET /checkout/sessions/{session_id} ### Description Retrieve the information stored on a checkout session. ### Method GET ### Endpoint /checkout/sessions/{session_id} ### Parameters #### Path Parameters - **session_id** (str) - Required - The ID of the checkout session. #### Query Parameters - **merchant_account_id** (Optional[str]) - Optional - The ID of the merchant account to use for this request. - **retries** (Optional[utils.RetryConfig]) - Optional - Configuration to override the default retry behavior of the client. ### Response #### Success Response (200) - **CheckoutSession** - The retrieved checkout session object. ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Instantiate SubscriptionFrequencyUnit Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/subscriptionfrequencyunit.md Demonstrates how to import and assign a value to SubscriptionFrequencyUnit. This enum is open, meaning unknown values are captured as 'UnrecognizedStr' instead of raising an error. ```python from gr4vy.models import SubscriptionFrequencyUnit # Open enum: unrecognized values are captured as UnrecognizedStr value: SubscriptionFrequencyUnit = "MONTH" ``` -------------------------------- ### PazePaymentMethodCreate Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/transactioncreatepaymentmethod.md Use `PazePaymentMethodCreate` for Paze payment method integration. ```python value: models.PazePaymentMethodCreate = /* values here */ ``` -------------------------------- ### Get Transaction Settlement Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/transactionssettlements/README.md Retrieve a specific settlement for a transaction by its unique identifier. ```APIDOC ## GET /transactions/{transaction_id}/settlements/{settlement_id} ### Description Retrieve a specific settlement for a transaction by its unique identifier. ### Method GET ### Endpoint /transactions/{transaction_id}/settlements/{settlement_id} ### Parameters #### Path Parameters - **transaction_id** (str) - Required - The unique identifier of the transaction. - **settlement_id** (str) - Required - The unique identifier of the settlement. #### Query Parameters - **merchant_account_id** (Optional[str]) - Optional - The ID of the merchant account to use for this request. - **retries** (Optional[utils.RetryConfig]) - Optional - Configuration to override the default retry behavior of the client. ### Request Example ```python 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.settlements.get(transaction_id="7099948d-7286-47e4-aad8-b68f7eb44591", settlement_id="b1e2c3d4-5678-1234-9abc-1234567890ab") # Handle response print(res) ``` ### Response #### Success Response (200) **[models.Settlement](../../models/settlement.md)** ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Initialize RefundStatus Enum Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/refundstatus.md Demonstrates how to import and initialize the RefundStatus enum with a string value. Unrecognized values are handled gracefully. ```python from gr4vy.models import RefundStatus # Open enum: unrecognized values are captured as UnrecognizedStr value: RefundStatus = "processing" ``` -------------------------------- ### Get Refund Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/refundssdk/README.md Fetches the details of a specific refund using its unique ID. ```APIDOC ## GET /refunds/{refund_id} ### Description Fetches the details of a specific refund. ### Method GET ### Endpoint /refunds/{refund_id} ### Parameters #### Path Parameters - **refund_id** (str) - Required - The ID of the refund #### Query Parameters - **merchant_account_id** (Optional[str]) - Optional - The ID of the merchant account to use for this request. #### Request Body None ### Response #### Success Response (200) - **models.Refund** - The refund object ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Get Payment Service Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/paymentservicessdk/README.md Retrieves the details of a specific configured payment service by its ID. ```APIDOC ## GET /payment-services/{payment_service_id} ### Description Get the details of a configured payment service. ### Method GET ### Endpoint /payment-services/{payment_service_id} ### Parameters #### Path Parameters - **payment_service_id** (str) - Required - the ID of the payment service #### Query Parameters - **merchant_account_id** (Optional[str]) - Optional - The ID of the merchant account to use for this request. #### Request Body None ### Request Example ```python 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.payment_services.get(payment_service_id="fffd152a-9532-4087-9a4f-de58754210f0") # Handle response print(res) ``` ### Response #### Success Response (200) - **payment_service** (models.PaymentService) - Details of the payment service. #### Response Example ```json { "example": "response body" } ``` ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### List Payment Options Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/paymentoptionssdk/README.md Use this snippet to list available payment options. Ensure the GR4VY_BEARER_AUTH environment variable is set. ```python 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.payment_options.list(locale="en") # Handle response print(res) ``` -------------------------------- ### Get Merchant Account Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/merchantaccountssdk/README.md Retrieves information about a specific merchant account using its ID. ```APIDOC ## get merchant_account ### Description Get info about a merchant account in an instance. ### Method GET ### Endpoint /merchant-accounts/{merchant_account_id} ### Parameters #### Path Parameters - **merchant_account_id** (str) - Required - The ID of the merchant account. #### Query Parameters - **retries** (Optional[utils.RetryConfig]) - Optional - Configuration to override the default retry behavior of the client. ### Response #### Success Response (200) - **models.MerchantAccount** - Details of the merchant account. ### Errors - **errors.Error400** (400) - Bad Request - **errors.Error401** (401) - Unauthorized - **errors.Error403** (403) - Forbidden - **errors.Error404** (404) - Not Found - **errors.Error405** (405) - Method Not Allowed - **errors.Error409** (409) - Conflict - **errors.HTTPValidationError** (422) - Unprocessable Entity - **errors.Error425** (425) - Too Early - **errors.Error429** (429) - Too Many Requests - **errors.Error500** (500) - Internal Server Error - **errors.Error502** (502) - Bad Gateway - **errors.Error504** (504) - Gateway Timeout - **errors.APIError** (4XX, 5XX) - Generic API Error ``` -------------------------------- ### Initialize Gr4vy Client (Asynchronous) Source: https://github.com/gr4vy/gr4vy-python/blob/main/README.md Instantiate the Gr4vy client for making asynchronous API requests using asyncio. Ensure the private key is accessible. ```python import asyncio from gr4vy import Gr4vy, auth import os async def main(): async with Gr4vy( id="example", server="production", merchant_account_id="default", bearer_auth=auth.with_token(open("./private_key.pem").read()) ) as g_client: res = await g_client.transactions.list() assert res is not None # Handle response print(res) asyncio.run(main()) ``` -------------------------------- ### List Configured Reports Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/reportssdk/README.md Use this snippet to list all configured reports. It demonstrates how to initialize the Gr4vy client and iterate through paginated results. Ensure the GR4VY_BEARER_AUTH environment variable is set. ```python 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.reports.list(limit=20) while res is not None: # Handle items res = res.next() ``` -------------------------------- ### Get Gift Card Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/giftcardssdk/README.md Fetches details about a specific gift card using its ID. ```APIDOC ## get gift_card ### Description Fetch details about a gift card. ### Method GET ### Endpoint /gift-cards/{gift_card_id} ### Parameters #### Path Parameters - **gift_card_id** (str) - Required - The ID of the gift card. #### Query Parameters - **merchant_account_id** (Optional[str]) - Optional - The ID of the merchant account to use for this request. #### Other Parameters - **retries** (Optional[utils.RetryConfig]) - Optional - Configuration to override the default retry behavior of the client. ### Response #### Success Response (200) - **GiftCard** (models.GiftCard) - Details of the gift card. ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Instantiate ProductType Enum Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/producttype.md Demonstrates how to import and instantiate the ProductType enum. Unrecognized values are captured as UnrecognizedStr. ```python from gr4vy.models import ProductType # Open enum: unrecognized values are captured as UnrecognizedStr value: ProductType = "physical" ``` -------------------------------- ### Get Payment Link Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/paymentlinkssdk/README.md Retrieves the details of a specific payment link using its unique identifier. ```APIDOC ## GET /payment-links/{payment_link_id} ### Description Retrieves the details of a specific payment link. ### Method GET ### Endpoint /payment-links/{payment_link_id} ### Parameters #### Path Parameters - **payment_link_id** (str) - Required - The unique identifier for the payment link. #### Query Parameters - **merchant_account_id** (Optional[str]) - Optional - The ID of the merchant account to use for this request. - **retries** (Optional[utils.RetryConfig]) - Optional - Configuration to override the default retry behavior of the client. ### Request Example ```python 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.payment_links.get(payment_link_id="a1b2c3d4-5678-90ab-cdef-1234567890ab") # Handle response print(res) ``` ### Response #### Success Response (200) - **PaymentLink** (models.PaymentLink) - Description of the payment link details. #### Response Example ```json { "example": "response body" } ``` ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Initialize Gr4vy with Custom HTTP Client Source: https://github.com/gr4vy/gr4vy-python/blob/main/README.md Configure the Gr4vy SDK to use a custom httpx.Client instance to set default headers for all requests. ```python from gr4vy import Gr4vy import httpx http_client = httpx.Client(headers={"x-custom-header": "someValue"}) s = Gr4vy(client=http_client) ``` -------------------------------- ### Get Report Execution Details Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/executions/README.md Retrieves the details of a specific report execution using its ID. ```APIDOC ## Get Report Execution Details ### Description Retrieves the details of a specific report execution using its ID. ### Parameters #### Path Parameters - **report_execution_id** (str) - Required - The ID of the execution of a report to retrieve details for. #### Query Parameters - **merchant_account_id** (Optional[str]) - Optional - The ID of the merchant account to use for this request. #### Request Body - **retries** (Optional[utils.RetryConfig]) - Optional - Configuration to override the default retry behavior of the client. ### Response #### Success Response (200) - **models.ReportExecution** - The details of the report execution. ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Instantiate NetworkTokenStatus Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/networktokenstatus.md Demonstrates how to import and use the NetworkTokenStatus enum. Unrecognized values are captured as UnrecognizedStr. ```python from gr4vy.models import NetworkTokenStatus # Open enum: unrecognized values are captured as UnrecognizedStr value: NetworkTokenStatus = "active" ``` -------------------------------- ### AdyenAutoRescueSepaScenariosEnum Example Usage Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/adyenautorescuesepascenariosenum.md Demonstrates how to import and use the AdyenAutoRescueSepaScenariosEnum. Unrecognized values are captured as UnrecognizedStr. ```python from gr4vy.models import AdyenAutoRescueSepaScenariosEnum # Open enum: unrecognized values are captured as UnrecognizedStr value: AdyenAutoRescueSepaScenariosEnum = "AutoRescueSuccessfulFirst" ``` -------------------------------- ### Get Payment Service Definition Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/paymentservicedefinitionssdk/README.md Retrieves the definition of a specific payment service that can be configured, identified by its ID. ```APIDOC ## GET /payment-service-definitions/{payment_service_definition_id} ### Description Get the definition of a payment service that can be configured. ### Method GET ### Endpoint /payment-service-definitions/{payment_service_definition_id} ### Parameters #### Path Parameters - **payment_service_definition_id** (string) - Required - The ID of the payment service definition to retrieve. ### Request Example ```python from gr4vy import Gr4vy import os with Gr4vy( bearer_auth=os.getenv("GR4VY_BEARER_AUTH", ""), ) as g_client: res = g_client.payment_service_definitions.get(payment_service_definition_id="adyen-ideal") # Handle response print(res) ``` ### Response #### Success Response (200) **models.PaymentServiceDefinition** ``` -------------------------------- ### Instantiate VaultPaymentMethodCriteria Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/vaultpaymentmethodcriteria.md Demonstrates how to instantiate the VaultPaymentMethodCriteria enum with a value. Unrecognized values are captured as UnrecognizedStr. ```python from gr4vy.models import VaultPaymentMethodCriteria # Open enum: unrecognized values are captured as UnrecognizedStr value: VaultPaymentMethodCriteria = "ALWAYS" ``` -------------------------------- ### Instantiate ReportSpecModel Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/reportspecmodel.md Demonstrates how to import and instantiate the ReportSpecModel with a string value. Unrecognized values are captured as UnrecognizedStr. ```python from gr4vy.models import ReportSpecModel # Open enum: unrecognized values are captured as UnrecognizedStr value: ReportSpecModel = "transactions" ``` -------------------------------- ### Get Payout by ID Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/payouts/README.md Retrieves a specific payout using its ID. Ensure the GR4VY_BEARER_AUTH environment variable is set. ```python 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.payouts.get(payout_id="4344fef2-bc2f-49a6-924f-343e62f67224") # Handle response print(res) ``` -------------------------------- ### Using RedirectPaymentMethodCreateMethod Enum Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/redirectpaymentmethodcreatemethod.md Demonstrates how to import and use the RedirectPaymentMethodCreateMethod enum. Unrecognized values are captured as UnrecognizedStr. ```python from gr4vy.models import RedirectPaymentMethodCreateMethod # Open enum: unrecognized values are captured as UnrecognizedStr value: RedirectPaymentMethodCreateMethod = "abitab" ``` -------------------------------- ### Using AdyenCardAutoRescueScenariosEnum Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/models/adyencardautorescuescenariosenum.md Demonstrates how to import and use the AdyenCardAutoRescueScenariosEnum. Unrecognized values are captured as strings. ```python from gr4vy.models import AdyenCardAutoRescueScenariosEnum # Open enum: unrecognized values are captured as UnrecognizedStr value: AdyenCardAutoRescueScenariosEnum = "AutoRescueSuccessfulFirst" ``` -------------------------------- ### Transaction Currency Parameter Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/transactions/README.md Details the `currency` parameter used in transaction requests, including its type, requirements, and examples. ```APIDOC ## Parameters ### Query Parameters - **currency** (str) - Required - A supported ISO 4217 currency code. For redirect requests, this value must match the one specified for `currency` in `payment_method`. **Example 1:** EUR **Example 2:** GBP **Example 3:** USD ``` -------------------------------- ### Get Transaction Refund Source: https://github.com/gr4vy/gr4vy-python/blob/main/docs/sdks/transactionsrefunds/README.md Fetches the details of a specific refund associated with a transaction. Requires both the transaction ID and the refund ID. ```APIDOC ## GET /transactions/{transaction_id}/refunds/{refund_id} ### Description Fetch refund for a transaction. ### Method GET ### Endpoint /transactions/{transaction_id}/refunds/{refund_id} ### Parameters #### Path Parameters - **transaction_id** (str) - Required - The ID of the transaction - **refund_id** (str) - Required - The ID of the refund #### Query Parameters - **merchant_account_id** (Optional[str]) - Optional - The ID of the merchant account to use for this request. #### Request Body None ### Response #### Success Response (200) - **[models.Refund](../../models/refund.md)** - The refund details. #### Response Example ```json { "example": "response body" } ``` ### Errors - errors.Error400 (400) - errors.Error401 (401) - errors.Error403 (403) - errors.Error404 (404) - errors.Error405 (405) - errors.Error409 (409) - errors.HTTPValidationError (422) - errors.Error425 (425) - errors.Error429 (429) - errors.Error500 (500) - errors.Error502 (502) - errors.Error504 (504) - errors.APIError (4XX, 5XX) ``` -------------------------------- ### Initialize Gr4vy Client with Server URL Source: https://github.com/gr4vy/gr4vy-python/blob/main/README.md Use this to override the default server globally by passing a custom URL to the `server_url` parameter during SDK client initialization. This provides direct control over the API endpoint. ```python from gr4vy import Gr4vy import os with Gr4vy( server_url="https://api.sandbox.example.gr4vy.app", merchant_account_id="default", bearer_auth=os.getenv("GR4VY_BEARER_AUTH", ""), ) as g_client: res = g_client.account_updater.jobs.create(payment_method_ids=[ "ef9496d8-53a5-4aad-8ca2-00eb68334389", "f29e886e-93cc-4714-b4a3-12b7a718e595", ]) assert res is not None # Handle response print(res) ```