Skip to content

Latest commit

 

History

History
248 lines (186 loc) · 45.6 KB

File metadata and controls

248 lines (186 loc) · 45.6 KB

PaymentLinks

Overview

Available Operations

  • create - Add a payment link
  • list - List all payment links
  • expire - Expire a payment link
  • get - Get payment link

create

Create a new payment link.

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_links.create(amount=1299, country="DE", currency="EUR", store=True)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
amount int ✔️ The amount for the payment link. 1299
country str ✔️ The country code for the payment link. Example 1: DE
Example 2: GB
Example 3: US
currency str ✔️ The currency code for the payment link. Example 1: EUR
Example 2: GBP
Example 3: USD
merchant_account_id Optional[str] The ID of the merchant account to use for this request. default
buyer OptionalNullable[models.GuestBuyer] The guest buyer for the payment link.
expires_at date The expiration date and time for the payment link. 2024-06-01T00:00:00.000Z
connection_options OptionalNullable[models.TransactionConnectionOptions] Connection options for the payment link.
external_identifier OptionalNullable[str] The merchant reference for the payment link. external-12345
statement_descriptor OptionalNullable[models.StatementDescriptor] The statement descriptor for the payment link.
locale OptionalNullable[str] The locale for the payment link. Example 1: en
Example 2: en-GB
Example 3: pt
Example 4: pt-BR
Example 5: es
merchant_name OptionalNullable[str] The merchant's display name. ACME Inc.
merchant_url OptionalNullable[str] The merchant's website URL. https://merchant.example.com
merchant_banner_url OptionalNullable[str] The merchant's banner image URL. https://merchant.example.com/banner.png
merchant_color OptionalNullable[str] The merchant's brand color. #FF5733
merchant_message OptionalNullable[str] A message from the merchant. Thank you for your purchase!
merchant_terms_and_conditions_url OptionalNullable[str] URL to the merchant's terms and conditions. https://merchant.example.com/terms
merchant_favicon_url OptionalNullable[str] URL to the merchant's favicon. https://merchant.example.com/favicon.ico
intent Optional[models.TransactionIntent] N/A
return_url OptionalNullable[str] The return URL after payment completion. https://merchant.example.com/return
cart_items List[models.CartItem] The cart items for the payment link.
metadata Dict[str, Any] Arbitrary metadata for the payment link. {
"order_id": "ORD-12345"
}
payment_source Optional[models.TransactionPaymentSource] The way payment method information made it to this transaction.
store Optional[bool] Whether to store the payment method for future use. true
buyer_id OptionalNullable[str] The ID of the buyer to associate the payment method with. Note: When buyer_id is provided, the payment link should be treated as a secret as it will allow the user to manage payment methods for the associated buyer. a1b2c3d4-5678-90ab-cdef-1234567890ab
installment_count OptionalNullable[int] The number of installments a buyer is required to make.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.PaymentLink

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

List all created payment links.

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

    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 returned. 20
buyer_search List[str] Filters the results to only get the items for which some of the buyer data contains exactly the provided buyer_search values. [
"John",
"London"
]
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.ListPaymentLinksResponse

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

expire

Expire an existing payment link.

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_links.expire(payment_link_id="a1b2c3d4-5678-90ab-cdef-1234567890ab")

    # Use the SDK ...

Parameters

Parameter Type Required Description Example
payment_link_id str ✔️ The unique identifier for the payment link. a1b2c3d4-5678-90ab-cdef-1234567890ab
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 */*

get

Fetch the details for a payment link.

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_links.get(payment_link_id="a1b2c3d4-5678-90ab-cdef-1234567890ab")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
payment_link_id str ✔️ The unique identifier for the payment link. a1b2c3d4-5678-90ab-cdef-1234567890ab
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.PaymentLink

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