hoodpay package

Subpackages

Submodules

hoodpay.hoodpay module

class hoodpay.hoodpay.HoodPay(api_key: str, business_id: int)

Bases: object

Represents a HoodPay API client.

cancel_payment(payment_id: str) dict

Cancel a payment.

Parameters

payment_id: str

The ID of the payment.

async cancel_payment_async(payment_id: str) dict

Cancel a payment asynchronously.

Parameters

payment_id: str

The ID of the payment.

create_payment(currency: str, amount: float, name: Optional[str] = None, description: Optional[str] = None, customer_email: Optional[str] = None, customer_ip: Optional[str] = None, customer_user_agent: Optional[str] = None, redirect_url: Optional[str] = None, notify_url: Optional[str] = None) dict

Create a payment.

Parameters

currency: str

The currency of the payment.

amount: float

The amount of the payment.

name: Optional[str]

The name of the payment. Defaults to None.

description: Optional[str]

The description of the payment. Defaults to None.

customer_email: Optional[str]

The email of the customer. Defaults to None.

customer_ip: Optional[str]

The IP address of the customer. Defaults to None.

customer_user_agent: Optional[str]

The user agent of the customer. Defaults to None.

redirect_url: Optional[str]

The URL to redirect the customer to after payment. Defaults to None.

notify_url: Optional[str]

The URL to notify after payment. Defaults to None.

async create_payment_async(currency: str, amount: float, name: Optional[str] = None, description: Optional[str] = None, customer_email: Optional[str] = None, customer_ip: Optional[str] = None, customer_user_agent: Optional[str] = None, redirect_url: Optional[str] = None, notify_url: Optional[str] = None) dict

Create a payment asynchronously.

Parameters

currency: str

The currency of the payment.

amount: float

The amount of the payment.

name: Optional[str]

The name of the payment. Defaults to None.

description: Optional[str]

The description of the payment. Defaults to None.

customer_email: Optional[str]

The email of the customer. Defaults to None.

customer_ip: Optional[str]

The IP address of the customer. Defaults to None.

customer_user_agent: Optional[str]

The user agent of the customer. Defaults to None.

redirect_url: Optional[str]

The URL to redirect the customer to after payment. Defaults to None.

notify_url: Optional[str]

The URL to notify after payment. Defaults to None.

create_webhook(url: Optional[str] = None, description: Optional[str] = None, events: Optional[list] = None) dict

Creates a webhook for the business.

Parameters

url: Optional[str]

The URL to send the webhook to. Defaults to None.

description: Optional[str]

The description of the webhook. Defaults to None.

events: Optional[list]

The events to send the webhook for. Defaults to None.

async create_webhook_async(url: Optional[str] = None, description: Optional[str] = None, events: Optional[list] = None) dict

Creates a webhook for the business asynchronously.

Parameters

url: Optional[str]

The URL to send the webhook to. Defaults to None.

description: Optional[str]

The description of the webhook. Defaults to None.

events: Optional[list]

The events to send the webhook for. Defaults to None.

delete_webhook(webhook_id: int) dict

Deletes a webhook for the business.

Parameters

webhook_id: int

The ID of the webhook.

async delete_webhook_async(webhook_id: int) dict

Deletes a webhook for the business asynchronously.

Parameters

webhook_id: int

The ID of the webhook.

fill_customer_email(payment_id: int, email: str) dict

Fill the customer email for a payment.

Parameters

payment_id: int

The ID of the payment.

email: str

The email to fill.

async fill_customer_email_async(payment_id: int, email: str) dict

Fill the customer email for a payment asynchronously.

Parameters

payment_id: int

The ID of the payment.

email: str

The email to fill.

get_businesses() dict

Returns a list of businesses for the authenticated user.

async get_businesses_async() dict

Returns a list of businesses for the authenticated user asynchronously.

get_payment(payment_id: int) dict

Get a payment by its ID.

Parameters

payment_id: int

The ID of the payment.

async get_payment_async(payment_id: int) dict

Get a payment by its ID asynchronously.

Parameters

payment_id: int

The ID of the payment.

get_payments(page_number: Optional[int] = None, page_size: Optional[int] = None, from_time: Optional[int] = None, status: Optional[str] = None, payment_method: Optional[str] = 'DIRECT_CRYPTO', from_amount: Optional[float] = None, to_amount: Optional[float] = None, search_string: Optional[str] = None) dict

Get a list of payments that belong to a specific business.

Parameters

page_number: Optional[int]

The page number to get. Defaults to None.

page_size: Optional[int]

The number of payments to get per page. Defaults to None.

from_time: Optional[int]

The time to get payments from. Defaults to None.

status: Optional[str]

The status of the payments to get. Defaults to None.

payment_method: Optional[str]

The payment method to get payments for. Defaults to “DIRECT_CRYPTO”.

from_amount: Optional[float]

The minimum amount of the payments to get. Defaults to None.

to_amount: Optional[float]

The maximum amount of the payments to get. Defaults to None.

search_string: Optional[str]

The search string to use to filter payments. Defaults to None.

async get_payments_async(page_number: Optional[int] = None, page_size: Optional[int] = None, from_time: Optional[datetime] = None, status: Optional[str] = None, payment_method: Optional[str] = 'DIRECT_CRYPTO', from_amount: Optional[float] = None, to_amount: Optional[float] = None, search_string: Optional[str] = None) dict

Get a list of payments that belong to a specific business asynchronously.

Parameters

page_number: Optional[int]

The page number to get. Defaults to None.

page_size: Optional[int]

The number of payments to get per page. Defaults to None.

from_time: Optional[datetime]

The time to get payments from. Defaults to None.

status: Optional[str]

The status of the payments to get. Defaults to None.

payment_method: Optional[str]

The payment method to get payments for. Defaults to “DIRECT_CRYPTO”.

from_amount: Optional[float]

The minimum amount of the payments to get. Defaults to None.

to_amount: Optional[float]

The maximum amount of the payments to get. Defaults to None.

search_string: Optional[str]

The search string to use to filter payments. Defaults to None.

get_webhooks() dict

Receives the webhooks settings for the business

async get_webhooks_async() dict

Receives the webhooks settings for the business asynchronously

reset_webhook_secret() dict

Resets the webhook secret for the business

async reset_webhook_secret_async() dict

Resets the webhook secret for the business asynchronously.

select_payment_method(payment_id: int, payment_method: str) dict

Select a payment method for a payment.

Parameters

payment_id: int

The ID of the payment.

payment_method: str

The payment method to select.

async select_payment_method_async(payment_id: int, payment_method: str) dict

Select a payment method for a payment asynchronously.

Parameters

payment_id: int

The ID of the payment.

payment_method: str

The payment method to select.

Module contents