- list - List all payment methods
- create - Create payment method
- get - Get payment method
- update - Update payment method
- delete - Delete payment method
List all stored payment method.
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()
| 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. |
|
models.ListPaymentMethodsResponse
| 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 |
*/* |
Store a new payment method.
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)
| 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. |
|
models.PaymentMethod
| 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 |
*/* |
Retrieve a payment method.
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)
| 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. |
|
models.PaymentMethod
| 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 |
*/* |
Update the details of a stored payment method.
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.update(payment_method_id="ef9496d8-53a5-4aad-8ca2-00eb68334389")
# Handle response
print(res)
| 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 |
expiration_date |
OptionalNullable[str] |
➖ |
The new expiration date for the payment method. |
12/30 |
scheme_transaction_id |
OptionalNullable[str] |
➖ |
A scheme transaction identifier to associate with this payment method. Explicitly setting this field to null will also clear scheme_transaction_id_scheme as a side-effect. When setting a new value and scheme_transaction_id_scheme is both omitted from the payload and previously unset,scheme_transaction_id_scheme will be populated from the payment method's existing scheme. |
123456789012345 |
scheme_transaction_id_scheme |
OptionalNullable[models.CardScheme] |
➖ |
The scheme associated with scheme_transaction_id. Only applies to card payments. When setting a new value for scheme_transaction_id, if scheme_transaction_id_schemeis both omitted from the payload and previously unset, scheme_transaction_id_scheme will be populated from the payment method's existing scheme. |
visa |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
models.PaymentMethod
| 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 a payment method.
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 ...
| 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. |
|
| 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 |
*/* |