# PAY.JP Python SDK

A Python client library for the PAY.JP v2 API. This SDK provides a convenient way to interact with PAY.JP's payment processing services from Python applications.

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 2.0.0
- Package version: 1.0.9
- Generator version: 7.14.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.

Python 3.8+

## Installation & Usage

### pip

```sh
pip install payjpv2
```

### uv

```sh
uv add payjpv2
```

### Setuptools

```sh
python setup.py install --user
```

Then import the package:

```python
import payjpv2
```

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```python
import os
import payjpv2

# Configure Bearer authentication with API key
configuration = payjpv2.Configuration(
    access_token=os.environ.get("PAYJP_API_KEY"),
)

with payjpv2.ApiClient(configuration) as api_client:
    customers_api = payjpv2.CustomersApi(api_client)

    try:
        # Create a customer
        create_request = payjpv2.CustomerCreateRequest(
            email="test@example.com",
            description="Test customer",
        )
        customer = customers_api.create_customer(create_request)
        print(f"Created customer: {customer.id}")

        # List customers
        customer_list = customers_api.get_all_customers(limit=10)
        for c in customer_list.data:
            print(f"  - {c.id} ({c.email or 'no email'})")

    except payjpv2.ApiException as e:
        print(f"API Exception: {e}")
```

## Documentation for API Endpoints

All URIs are relative to *https://api.pay.jp*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*BalancesApi* | [**create_balance_url**](docs/BalancesApi.md#create_balance_url) | **POST** /v2/balances/{balance_id}/balance_urls | Create Balance Url
*BalancesApi* | [**get_all_balances**](docs/BalancesApi.md#get_all_balances) | **GET** /v2/balances | Get All Balances
*BalancesApi* | [**get_balance**](docs/BalancesApi.md#get_balance) | **GET** /v2/balances/{balance_id} | Get Balance
*CheckoutSessionsApi* | [**create_checkout_session**](docs/CheckoutSessionsApi.md#create_checkout_session) | **POST** /v2/checkout/sessions | Create Checkout Session
*CheckoutSessionsApi* | [**get_all_checkout_session_line_items**](docs/CheckoutSessionsApi.md#get_all_checkout_session_line_items) | **GET** /v2/checkout/sessions/{checkout_session_id}/line_items | Get All Checkout Session Line Items
*CheckoutSessionsApi* | [**get_all_checkout_sessions**](docs/CheckoutSessionsApi.md#get_all_checkout_sessions) | **GET** /v2/checkout/sessions | Get All Checkout Sessions
*CheckoutSessionsApi* | [**get_checkout_session**](docs/CheckoutSessionsApi.md#get_checkout_session) | **GET** /v2/checkout/sessions/{checkout_session_id} | Get Checkout Session
*CheckoutSessionsApi* | [**update_checkout_session**](docs/CheckoutSessionsApi.md#update_checkout_session) | **POST** /v2/checkout/sessions/{checkout_session_id} | Update Checkout Session
*CustomersApi* | [**create_customer**](docs/CustomersApi.md#create_customer) | **POST** /v2/customers | Create Customer
*CustomersApi* | [**delete_customer**](docs/CustomersApi.md#delete_customer) | **DELETE** /v2/customers/{customer_id} | Delete Customer
*CustomersApi* | [**get_all_customers**](docs/CustomersApi.md#get_all_customers) | **GET** /v2/customers | Get All Customers
*CustomersApi* | [**get_customer**](docs/CustomersApi.md#get_customer) | **GET** /v2/customers/{customer_id} | Get Customer
*CustomersApi* | [**get_customer_payment_methods**](docs/CustomersApi.md#get_customer_payment_methods) | **GET** /v2/customers/{customer_id}/payment_methods | Get Customer Payment Methods
*CustomersApi* | [**update_customer**](docs/CustomersApi.md#update_customer) | **POST** /v2/customers/{customer_id} | Update Customer
*EventsApi* | [**get_all_events**](docs/EventsApi.md#get_all_events) | **GET** /v2/events | Get All Events
*EventsApi* | [**get_event**](docs/EventsApi.md#get_event) | **GET** /v2/events/{event_id} | Get Event
*PaymentDisputesApi* | [**get_all_payment_disputes**](docs/PaymentDisputesApi.md#get_all_payment_disputes) | **GET** /v2/payment_disputes | Get All Payment Disputes
*PaymentDisputesApi* | [**get_payment_dispute**](docs/PaymentDisputesApi.md#get_payment_dispute) | **GET** /v2/payment_disputes/{payment_dispute_id} | Get Payment Dispute
*PaymentRefundsApi* | [**create_payment_refund**](docs/PaymentRefundsApi.md#create_payment_refund) | **POST** /v2/payment_refunds | Create Payment Refund
*PaymentRefundsApi* | [**get_all_payment_refunds**](docs/PaymentRefundsApi.md#get_all_payment_refunds) | **GET** /v2/payment_refunds | Get All Payment Refunds
*PaymentRefundsApi* | [**get_payment_refund**](docs/PaymentRefundsApi.md#get_payment_refund) | **GET** /v2/payment_refunds/{payment_refund_id} | Get Payment Refund
*PaymentRefundsApi* | [**update_payment_refund**](docs/PaymentRefundsApi.md#update_payment_refund) | **POST** /v2/payment_refunds/{payment_refund_id} | Update Payment Refund
*PaymentFlowsApi* | [**cancel_payment_flow**](docs/PaymentFlowsApi.md#cancel_payment_flow) | **POST** /v2/payment_flows/{payment_flow_id}/cancel | Cancel Payment Flow
*PaymentFlowsApi* | [**capture_payment_flow**](docs/PaymentFlowsApi.md#capture_payment_flow) | **POST** /v2/payment_flows/{payment_flow_id}/capture | Capture Payment Flow
*PaymentFlowsApi* | [**confirm_payment_flow**](docs/PaymentFlowsApi.md#confirm_payment_flow) | **POST** /v2/payment_flows/{payment_flow_id}/confirm | Confirm Payment Flow
*PaymentFlowsApi* | [**create_payment_flow**](docs/PaymentFlowsApi.md#create_payment_flow) | **POST** /v2/payment_flows | Create Payment Flow
*PaymentFlowsApi* | [**get_all_payment_flows**](docs/PaymentFlowsApi.md#get_all_payment_flows) | **GET** /v2/payment_flows | Get All Payment Flows
*PaymentFlowsApi* | [**get_payment_flow**](docs/PaymentFlowsApi.md#get_payment_flow) | **GET** /v2/payment_flows/{payment_flow_id} | Get Payment Flow
*PaymentFlowsApi* | [**get_payment_flow_refunds**](docs/PaymentFlowsApi.md#get_payment_flow_refunds) | **GET** /v2/payment_flows/{payment_flow_id}/refunds | Get Payment Flow Refunds
*PaymentFlowsApi* | [**update_payment_flow**](docs/PaymentFlowsApi.md#update_payment_flow) | **POST** /v2/payment_flows/{payment_flow_id} | Update Payment Flow
*PaymentMethodConfigurationsApi* | [**get_all_payment_method_configurations**](docs/PaymentMethodConfigurationsApi.md#get_all_payment_method_configurations) | **GET** /v2/payment_method_configurations | Get All Payment Method Configurations
*PaymentMethodConfigurationsApi* | [**get_payment_method_configuration**](docs/PaymentMethodConfigurationsApi.md#get_payment_method_configuration) | **GET** /v2/payment_method_configurations/{payment_method_configuration_id} | Get Payment Method Configuration
*PaymentMethodConfigurationsApi* | [**update_payment_method_configuration**](docs/PaymentMethodConfigurationsApi.md#update_payment_method_configuration) | **POST** /v2/payment_method_configurations/{payment_method_configuration_id} | Update Payment Method Configuration
*PaymentMethodsApi* | [**attach_payment_method**](docs/PaymentMethodsApi.md#attach_payment_method) | **POST** /v2/payment_methods/{payment_method_id}/attach | Attach Payment Method
*PaymentMethodsApi* | [**create_payment_method**](docs/PaymentMethodsApi.md#create_payment_method) | **POST** /v2/payment_methods | Create Payment Method
*PaymentMethodsApi* | [**detach_payment_method**](docs/PaymentMethodsApi.md#detach_payment_method) | **POST** /v2/payment_methods/{payment_method_id}/detach | Detach Payment Method
*PaymentMethodsApi* | [**get_all_payment_methods**](docs/PaymentMethodsApi.md#get_all_payment_methods) | **GET** /v2/payment_methods | Get All Payment Methods
*PaymentMethodsApi* | [**get_payment_method**](docs/PaymentMethodsApi.md#get_payment_method) | **GET** /v2/payment_methods/{payment_method_id} | Get Payment Method
*PaymentMethodsApi* | [**get_payment_method_by_card**](docs/PaymentMethodsApi.md#get_payment_method_by_card) | **GET** /v2/payment_methods/cards/{card_id} | Get Payment Method By Card
*PaymentMethodsApi* | [**update_payment_method**](docs/PaymentMethodsApi.md#update_payment_method) | **POST** /v2/payment_methods/{payment_method_id} | Update Payment Method
*PaymentTransactionsApi* | [**get_all_payment_transactions**](docs/PaymentTransactionsApi.md#get_all_payment_transactions) | **GET** /v2/payment_transactions | Get All Payment Transactions
*PaymentTransactionsApi* | [**get_payment_transaction**](docs/PaymentTransactionsApi.md#get_payment_transaction) | **GET** /v2/payment_transactions/{payment_transaction_id} | Get Payment Transaction
*PricesApi* | [**create_price**](docs/PricesApi.md#create_price) | **POST** /v2/prices | Create Price
*PricesApi* | [**get_all_prices**](docs/PricesApi.md#get_all_prices) | **GET** /v2/prices | Get All Prices
*PricesApi* | [**get_price**](docs/PricesApi.md#get_price) | **GET** /v2/prices/{price_id} | Get Price
*PricesApi* | [**update_price**](docs/PricesApi.md#update_price) | **POST** /v2/prices/{price_id} | Update Price
*ProductsApi* | [**create_product**](docs/ProductsApi.md#create_product) | **POST** /v2/products | Create Product
*ProductsApi* | [**delete_product**](docs/ProductsApi.md#delete_product) | **DELETE** /v2/products/{product_id} | Delete Product
*ProductsApi* | [**get_all_products**](docs/ProductsApi.md#get_all_products) | **GET** /v2/products | Get All Products
*ProductsApi* | [**get_product**](docs/ProductsApi.md#get_product) | **GET** /v2/products/{product_id} | Get Product
*ProductsApi* | [**update_product**](docs/ProductsApi.md#update_product) | **POST** /v2/products/{product_id} | Update Product
*SetupFlowsApi* | [**cancel_setup_flow**](docs/SetupFlowsApi.md#cancel_setup_flow) | **POST** /v2/setup_flows/{setup_flow_id}/cancel | Cancel Setup Flow
*SetupFlowsApi* | [**create_setup_flow**](docs/SetupFlowsApi.md#create_setup_flow) | **POST** /v2/setup_flows | Create Setup Flow
*SetupFlowsApi* | [**get_all_setup_flows**](docs/SetupFlowsApi.md#get_all_setup_flows) | **GET** /v2/setup_flows | Get All Setup Flows
*SetupFlowsApi* | [**get_setup_flow**](docs/SetupFlowsApi.md#get_setup_flow) | **GET** /v2/setup_flows/{setup_flow_id} | Get Setup Flow
*SetupFlowsApi* | [**update_setup_flow**](docs/SetupFlowsApi.md#update_setup_flow) | **POST** /v2/setup_flows/{setup_flow_id} | Update Setup Flow
*StatementsApi* | [**create_statement_url**](docs/StatementsApi.md#create_statement_url) | **POST** /v2/statements/{statement_id}/statement_urls | Create Statement Url
*StatementsApi* | [**get_all_statements**](docs/StatementsApi.md#get_all_statements) | **GET** /v2/statements | Get All Statements
*StatementsApi* | [**get_statement**](docs/StatementsApi.md#get_statement) | **GET** /v2/statements/{statement_id} | Get Statement
*TaxRatesApi* | [**create_tax_rate**](docs/TaxRatesApi.md#create_tax_rate) | **POST** /v2/tax_rates | Create Tax Rate
*TaxRatesApi* | [**get_all_tax_rates**](docs/TaxRatesApi.md#get_all_tax_rates) | **GET** /v2/tax_rates | Get All Tax Rates
*TaxRatesApi* | [**get_tax_rate**](docs/TaxRatesApi.md#get_tax_rate) | **GET** /v2/tax_rates/{tax_rate_id} | Get Tax Rate
*TaxRatesApi* | [**update_tax_rate**](docs/TaxRatesApi.md#update_tax_rate) | **POST** /v2/tax_rates/{tax_rate_id} | Update Tax Rate
*TermsApi* | [**get_all_terms**](docs/TermsApi.md#get_all_terms) | **GET** /v2/terms | Get All Terms
*TermsApi* | [**get_term**](docs/TermsApi.md#get_term) | **GET** /v2/terms/{term_id} | Get Term


## Documentation For Models

 - [ApplePayConfigRequest](docs/ApplePayConfigRequest.md)
 - [BalanceListResponse](docs/BalanceListResponse.md)
 - [BalanceResponse](docs/BalanceResponse.md)
 - [BalanceState](docs/BalanceState.md)
 - [BalanceURLResponse](docs/BalanceURLResponse.md)
 - [BankInfoResponse](docs/BankInfoResponse.md)
 - [CaptureMethod](docs/CaptureMethod.md)
 - [CardConfigRequest](docs/CardConfigRequest.md)
 - [CheckoutSessionCreateRequest](docs/CheckoutSessionCreateRequest.md)
 - [CheckoutSessionCustomerDetailsAddressResponse](docs/CheckoutSessionCustomerDetailsAddressResponse.md)
 - [CheckoutSessionCustomerDetailsResponse](docs/CheckoutSessionCustomerDetailsResponse.md)
 - [CheckoutSessionDetailsResponse](docs/CheckoutSessionDetailsResponse.md)
 - [CheckoutSessionLineItemDataResponse](docs/CheckoutSessionLineItemDataResponse.md)
 - [CheckoutSessionLineItemListResponse](docs/CheckoutSessionLineItemListResponse.md)
 - [CheckoutSessionListResponse](docs/CheckoutSessionListResponse.md)
 - [CheckoutSessionMode](docs/CheckoutSessionMode.md)
 - [CheckoutSessionPaymentMethodOptionsCardRequest](docs/CheckoutSessionPaymentMethodOptionsCardRequest.md)
 - [CheckoutSessionPaymentMethodOptionsRequest](docs/CheckoutSessionPaymentMethodOptionsRequest.md)
 - [CheckoutSessionStatus](docs/CheckoutSessionStatus.md)
 - [CheckoutSessionSubmitType](docs/CheckoutSessionSubmitType.md)
 - [CheckoutSessionUIMode](docs/CheckoutSessionUIMode.md)
 - [CheckoutSessionUpdateRequest](docs/CheckoutSessionUpdateRequest.md)
 - [Country](docs/Country.md)
 - [Currency](docs/Currency.md)
 - [CustomerCreateRequest](docs/CustomerCreateRequest.md)
 - [CustomerCreation](docs/CustomerCreation.md)
 - [CustomerListResponse](docs/CustomerListResponse.md)
 - [CustomerResponse](docs/CustomerResponse.md)
 - [CustomerUpdateRequest](docs/CustomerUpdateRequest.md)
 - [DisplayPreferenceRequest](docs/DisplayPreferenceRequest.md)
 - [ErrorResponse](docs/ErrorResponse.md)
 - [EventListResponse](docs/EventListResponse.md)
 - [EventResponse](docs/EventResponse.md)
 - [LineItemRequest](docs/LineItemRequest.md)
 - [Locale](docs/Locale.md)
 - [MetadataValue](docs/MetadataValue.md)
 - [PayPayConfigRequest](docs/PayPayConfigRequest.md)
 - [PaymentDisputeListResponse](docs/PaymentDisputeListResponse.md)
 - [PaymentDisputeReason](docs/PaymentDisputeReason.md)
 - [PaymentDisputeResponse](docs/PaymentDisputeResponse.md)
 - [PaymentDisputeStatus](docs/PaymentDisputeStatus.md)
 - [PaymentFlowCancelRequest](docs/PaymentFlowCancelRequest.md)
 - [PaymentFlowCancellationReason](docs/PaymentFlowCancellationReason.md)
 - [PaymentFlowCaptureRequest](docs/PaymentFlowCaptureRequest.md)
 - [PaymentFlowConfirmRequest](docs/PaymentFlowConfirmRequest.md)
 - [PaymentFlowCreateRequest](docs/PaymentFlowCreateRequest.md)
 - [PaymentFlowDataRequest](docs/PaymentFlowDataRequest.md)
 - [PaymentFlowListResponse](docs/PaymentFlowListResponse.md)
 - [PaymentFlowPaymentMethodOptionsCardRequest](docs/PaymentFlowPaymentMethodOptionsCardRequest.md)
 - [PaymentFlowPaymentMethodOptionsRequest](docs/PaymentFlowPaymentMethodOptionsRequest.md)
 - [PaymentFlowResponse](docs/PaymentFlowResponse.md)
 - [PaymentFlowStatus](docs/PaymentFlowStatus.md)
 - [PaymentFlowUpdateRequest](docs/PaymentFlowUpdateRequest.md)
 - [PaymentMethodApplePayCreateRequest](docs/PaymentMethodApplePayCreateRequest.md)
 - [PaymentMethodApplePayUpdateRequest](docs/PaymentMethodApplePayUpdateRequest.md)
 - [PaymentMethodAttachRequest](docs/PaymentMethodAttachRequest.md)
 - [PaymentMethodBillingAddressRequest](docs/PaymentMethodBillingAddressRequest.md)
 - [PaymentMethodBillingAddressResponse](docs/PaymentMethodBillingAddressResponse.md)
 - [PaymentMethodBillingDetailsRequest](docs/PaymentMethodBillingDetailsRequest.md)
 - [PaymentMethodBillingDetailsResponse](docs/PaymentMethodBillingDetailsResponse.md)
 - [PaymentMethodCardBillingDetailsRequest](docs/PaymentMethodCardBillingDetailsRequest.md)
 - [PaymentMethodCardCreateRequest](docs/PaymentMethodCardCreateRequest.md)
 - [PaymentMethodCardDetailsResponse](docs/PaymentMethodCardDetailsResponse.md)
 - [PaymentMethodCardResponse](docs/PaymentMethodCardResponse.md)
 - [PaymentMethodCardUpdateRequest](docs/PaymentMethodCardUpdateRequest.md)
 - [PaymentMethodConfigurationDetailsResponse](docs/PaymentMethodConfigurationDetailsResponse.md)
 - [PaymentMethodConfigurationDisplayPreference](docs/PaymentMethodConfigurationDisplayPreference.md)
 - [PaymentMethodConfigurationListResponse](docs/PaymentMethodConfigurationListResponse.md)
 - [PaymentMethodConfigurationSettingResponse](docs/PaymentMethodConfigurationSettingResponse.md)
 - [PaymentMethodConfigurationUpdateRequest](docs/PaymentMethodConfigurationUpdateRequest.md)
 - [PaymentMethodCreateCardDetailsRequest](docs/PaymentMethodCreateCardDetailsRequest.md)
 - [PaymentMethodCreateRequest](docs/PaymentMethodCreateRequest.md)
 - [PaymentMethodListResponse](docs/PaymentMethodListResponse.md)
 - [PaymentMethodPayPayCreateRequest](docs/PaymentMethodPayPayCreateRequest.md)
 - [PaymentMethodPayPayResponse](docs/PaymentMethodPayPayResponse.md)
 - [PaymentMethodPayPayUpdateRequest](docs/PaymentMethodPayPayUpdateRequest.md)
 - [PaymentMethodResponse](docs/PaymentMethodResponse.md)
 - [PaymentMethodTypes](docs/PaymentMethodTypes.md)
 - [PaymentMethodUpdateRequest](docs/PaymentMethodUpdateRequest.md)
 - [PaymentRefundCreateRequest](docs/PaymentRefundCreateRequest.md)
 - [PaymentRefundListResponse](docs/PaymentRefundListResponse.md)
 - [PaymentRefundReason](docs/PaymentRefundReason.md)
 - [PaymentRefundResponse](docs/PaymentRefundResponse.md)
 - [PaymentRefundStatus](docs/PaymentRefundStatus.md)
 - [PaymentRefundUpdateRequest](docs/PaymentRefundUpdateRequest.md)
 - [PaymentTransactionListResponse](docs/PaymentTransactionListResponse.md)
 - [PaymentTransactionResponse](docs/PaymentTransactionResponse.md)
 - [PaymentTransactionType](docs/PaymentTransactionType.md)
 - [PriceCreateRequest](docs/PriceCreateRequest.md)
 - [PriceDetailsResponse](docs/PriceDetailsResponse.md)
 - [PriceListResponse](docs/PriceListResponse.md)
 - [PriceType](docs/PriceType.md)
 - [PriceUpdateRequest](docs/PriceUpdateRequest.md)
 - [ProductCreateRequest](docs/ProductCreateRequest.md)
 - [ProductDeletedResponse](docs/ProductDeletedResponse.md)
 - [ProductDetailsResponse](docs/ProductDetailsResponse.md)
 - [ProductListResponse](docs/ProductListResponse.md)
 - [ProductUpdateRequest](docs/ProductUpdateRequest.md)
 - [SetupFlowCancelRequest](docs/SetupFlowCancelRequest.md)
 - [SetupFlowCancellationReason](docs/SetupFlowCancellationReason.md)
 - [SetupFlowCreateRequest](docs/SetupFlowCreateRequest.md)
 - [SetupFlowDataRequest](docs/SetupFlowDataRequest.md)
 - [SetupFlowListResponse](docs/SetupFlowListResponse.md)
 - [SetupFlowPaymentMethodOptionsCardRequest](docs/SetupFlowPaymentMethodOptionsCardRequest.md)
 - [SetupFlowPaymentMethodOptionsRequest](docs/SetupFlowPaymentMethodOptionsRequest.md)
 - [SetupFlowResponse](docs/SetupFlowResponse.md)
 - [SetupFlowStatus](docs/SetupFlowStatus.md)
 - [SetupFlowUpdateRequest](docs/SetupFlowUpdateRequest.md)
 - [StatementItemResponse](docs/StatementItemResponse.md)
 - [StatementListResponse](docs/StatementListResponse.md)
 - [StatementResponse](docs/StatementResponse.md)
 - [StatementSubject](docs/StatementSubject.md)
 - [StatementType](docs/StatementType.md)
 - [StatementURLResponse](docs/StatementURLResponse.md)
 - [TaxRateCreateRequest](docs/TaxRateCreateRequest.md)
 - [TaxRateDetailsResponse](docs/TaxRateDetailsResponse.md)
 - [TaxRateListResponse](docs/TaxRateListResponse.md)
 - [TaxRateUpdateRequest](docs/TaxRateUpdateRequest.md)
 - [TermListResponse](docs/TermListResponse.md)
 - [TermResponse](docs/TermResponse.md)
 - [Usage](docs/Usage.md)


<a id="documentation-for-authorization"></a>
## Documentation For Authorization


Authentication schemes defined for the API:
<a id="HTTPBasic"></a>
### HTTPBasic

- **Type**: HTTP basic authentication

<a id="HTTPBearer"></a>
### HTTPBearer

- **Type**: Bearer authentication


## Author

support@pay.jp


