Skip to content

Latest commit

 

History

History
231 lines (169 loc) · 16.6 KB

File metadata and controls

231 lines (169 loc) · 16.6 KB

PaymentMethods

Overview

Available Operations

  • list - List all payment methods
  • create - Create payment method
  • get - Get payment method
  • delete - Delete payment method

list

List all stored payment method.

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.payment_methods.list(cursor="ZXhhbXBsZTE", limit=20, buyer_id="fe26475d-ec3e-4884-9553-f7356683f7f9", buyer_external_identifier="buyer-12345", external_identifier="payment-method-12345")

    while res is not None:
        # Handle items

        res = res.next()

Parameters

Parameter Type Required Description Example
cursor OptionalNullable[str] A pointer to the page of results to return. ZXhhbXBsZTE
limit Optional[int] The maximum number of items that are at returned. 20
buyer_id OptionalNullable[str] The ID of the buyer to filter payment methods by. fe26475d-ec3e-4884-9553-f7356683f7f9
buyer_external_identifier OptionalNullable[str] The external identifier of the buyer to filter payment methods by. buyer-12345
status List[models.PaymentMethodStatus] N/A
external_identifier OptionalNullable[str] The external identifier of the payment method to filter by. payment-method-12345
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.ListPaymentMethodsResponse

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 payment method.

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.payment_methods.create(request_body={
        "method": "checkout-session",
        "id": "4137b1cf-39ac-42a8-bad6-1c680d5dab6b",
    })

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
request_body models.Body ✔️ 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.PaymentMethod

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

Retrieve a payment method.

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.payment_methods.get(payment_method_id="ef9496d8-53a5-4aad-8ca2-00eb68334389")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
payment_method_id str ✔️ The ID of the payment method ef9496d8-53a5-4aad-8ca2-00eb68334389
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.PaymentMethod

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

Delete a payment method.

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.payment_methods.delete(payment_method_id="ef9496d8-53a5-4aad-8ca2-00eb68334389")

    # Use the SDK ...

Parameters

Parameter Type Required Description Example
payment_method_id str ✔️ The ID of the payment method ef9496d8-53a5-4aad-8ca2-00eb68334389
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 */*