Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
- name: Set PR variables
id: vars
run: |
cd build/spec
echo ::set-output name=pr_title::"Update services"
echo ::set-output name=pr_body::"OpenAPI spec or templates produced new services on $(date +%d-%m-%Y) \
by [commit](https://github.com/Adyen/adyen-openapi/commit/$(git rev-parse HEAD))."
Expand Down
2 changes: 1 addition & 1 deletion Adyen/services/checkout/classic_checkout_sdk_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ClassicCheckoutSDKApi(AdyenServiceBase):
def __init__(self, client=None):
super(ClassicCheckoutSDKApi, self).__init__(client=client)
self.service = "checkout"
self.baseUrl = "https://checkout-test.adyen.com/v70"
self.baseUrl = "https://checkout-test.adyen.com/v71"

def payment_session(self, request, idempotency_key=None, **kwargs):
"""
Expand Down
2 changes: 1 addition & 1 deletion Adyen/services/checkout/modifications_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ModificationsApi(AdyenServiceBase):
def __init__(self, client=None):
super(ModificationsApi, self).__init__(client=client)
self.service = "checkout"
self.baseUrl = "https://checkout-test.adyen.com/v70"
self.baseUrl = "https://checkout-test.adyen.com/v71"

def cancel_authorised_payment(self, request, idempotency_key=None, **kwargs):
"""
Expand Down
2 changes: 1 addition & 1 deletion Adyen/services/checkout/orders_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class OrdersApi(AdyenServiceBase):
def __init__(self, client=None):
super(OrdersApi, self).__init__(client=client)
self.service = "checkout"
self.baseUrl = "https://checkout-test.adyen.com/v70"
self.baseUrl = "https://checkout-test.adyen.com/v71"

def orders(self, request, idempotency_key=None, **kwargs):
"""
Expand Down
2 changes: 1 addition & 1 deletion Adyen/services/checkout/payment_links_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PaymentLinksApi(AdyenServiceBase):
def __init__(self, client=None):
super(PaymentLinksApi, self).__init__(client=client)
self.service = "checkout"
self.baseUrl = "https://checkout-test.adyen.com/v70"
self.baseUrl = "https://checkout-test.adyen.com/v71"

def get_payment_link(self, linkId, idempotency_key=None, **kwargs):
"""
Expand Down
2 changes: 1 addition & 1 deletion Adyen/services/checkout/payments_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PaymentsApi(AdyenServiceBase):
def __init__(self, client=None):
super(PaymentsApi, self).__init__(client=client)
self.service = "checkout"
self.baseUrl = "https://checkout-test.adyen.com/v70"
self.baseUrl = "https://checkout-test.adyen.com/v71"

def get_result_of_payment_session(self, sessionId, idempotency_key=None, **kwargs):
"""
Expand Down
2 changes: 1 addition & 1 deletion Adyen/services/checkout/recurring_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RecurringApi(AdyenServiceBase):
def __init__(self, client=None):
super(RecurringApi, self).__init__(client=client)
self.service = "checkout"
self.baseUrl = "https://checkout-test.adyen.com/v70"
self.baseUrl = "https://checkout-test.adyen.com/v71"

def delete_token_for_stored_payment_details(self, storedPaymentMethodId, idempotency_key=None, **kwargs):
"""
Expand Down
2 changes: 1 addition & 1 deletion Adyen/services/checkout/utility_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class UtilityApi(AdyenServiceBase):
def __init__(self, client=None):
super(UtilityApi, self).__init__(client=client)
self.service = "checkout"
self.baseUrl = "https://checkout-test.adyen.com/v70"
self.baseUrl = "https://checkout-test.adyen.com/v71"

def get_apple_pay_session(self, request, idempotency_key=None, **kwargs):
"""
Expand Down
8 changes: 0 additions & 8 deletions Adyen/services/disputes.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ def delete_dispute_defense_document(self, request, idempotency_key=None, **kwarg
method = "POST"
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

def download_dispute_defense_document(self, request, idempotency_key=None, **kwargs):
"""
Download a defense document
"""
endpoint = self.baseUrl + f"/downloadDisputeDefenseDocument"
method = "POST"
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

def retrieve_applicable_defense_reasons(self, request, idempotency_key=None, **kwargs):
"""
Get applicable defense reasons
Expand Down
4 changes: 2 additions & 2 deletions Adyen/services/management/my_api_credential_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def add_allowed_origin(self, request, idempotency_key=None, **kwargs):
method = "POST"
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

def generate_new_client_key_for_self(self, idempotency_key=None, **kwargs):
def generate_client_key(self, idempotency_key=None, **kwargs):
"""
Generate new client key for self
Generate a client key
"""
endpoint = self.baseUrl + f"/me/generateClientKey"
method = "POST"
Expand Down
2 changes: 1 addition & 1 deletion Adyen/settings.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
LIB_NAME = "adyen-python-api-library"
LIB_VERSION = "10.0.0-beta"
LIB_VERSION = "10.0.0"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ smallServices:=binlookup dataProtection recurring storedValue terminal disputes
all: $(services) $(smallServices)

binlookup: spec=BinLookupService-v52
checkout: spec=CheckoutService-v70
checkout: spec=CheckoutService-v71
dataProtection: spec=DataProtectionService-v1
storedValue: spec=StoredValueService-v46
terminal: spec=TfmAPIService-v1
Expand Down
101 changes: 59 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
This is the officially supported Python library for using Adyen's APIs.

## Supported API versions

| API | Description | Service Name | Supported version |
|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|-------------------|
| [BIN lookup API](https://docs.adyen.com/api-explorer/BinLookup/52/overview) | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | binLookup | **v52** |
| [Balance Platform API](https://docs.adyen.com/api-explorer/balanceplatform/2/overview) | The Balance Platform API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | balancePlatform | **v2** |
| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/70/overview) | Our latest integration for accepting online payments. | checkout | **v70** |
| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/71/overview) | Our latest integration for accepting online payments. | checkout | **v71** |
| [Data Protection API](https://docs.adyen.com/development-resources/data-protection-api) | Endpoint for requesting data erasure. | dataProtection | **v1** |
| [Legal Entity Management API](https://docs.adyen.com/api-explorer/legalentity/3/overview) | Endpoint to manage legal entities | legalEntityManagement | **v3** |
| [Management API](https://docs.adyen.com/api-explorer/Management/3/overview) | Configure and manage your Adyen company and merchant accounts, stores, and payment terminals. | management | **v3** |
Expand All @@ -25,37 +26,33 @@ This is the officially supported Python library for using Adyen's APIs.

For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/).





## Prerequisites

- [Adyen test account](https://docs.adyen.com/get-started-with-adyen)
- [API key](https://docs.adyen.com/development-resources/api-credentials#generate-api-key). For testing, your API credential needs to have the [API PCI Payments role](https://docs.adyen.com/development-resources/api-credentials#roles).
- [Adyen test account](https://docs.adyen.com/get-started-with-adyen)
- [API key](https://docs.adyen.com/development-resources/api-credentials#generate-api-key). For testing, your API credential needs to have the [API PCI Payments role](https://docs.adyen.com/development-resources/api-credentials#roles).
- Python 3.6 or higher
- Packages (optional): requests or pycurl


## Installation
## Installation

### For development purposes
### For development purpose

Clone this repository and run

~~~~ bash
make install
~~~~

### For usage propose
### For usage purpose

Use pip command:

~~~~ bash
pip install Adyen
~~~~

## Using the library


### General use with API key

~~~~ python
Expand All @@ -67,84 +64,104 @@ adyen.payment.client.xapikey = "YourXapikey"
adyen.payment.client.hmac = "YourHMACkey"
adyen.payment.client.platform = "test" # Environment to use the library in.
~~~~

### Consuming Services

Every API the library supports is represented by a service object. The name of the service matching the corresponding API is listed in the [Integrations](#supported-api-versions) section of this document.

#### Using all services

~~~~python
import Adyen

adyen = Adyen.Adyen()
adyen.payment.client.xapikey = "YourXapikey"
adyen.payment.client.platform = "test" # change to live for production
request = {
"amount": {
"amount": {
"currency": "USD",
"value": 1000 # value in minor units
},
"reference": "Your order number",
"paymentMethod": {
"value": 1000 # value in minor units
},
"reference": "Your order number",
"paymentMethod": {
"type": "visa",
"encryptedCardNumber": "test_4111111111111111",
"encryptedExpiryMonth": "test_03",
"encryptedExpiryYear": "test_2030",
"encryptedSecurityCode": "test_737"
},
"shopperReference": "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
"returnUrl": "https://your-company.com/...",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
}
},
"shopperReference": "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
"returnUrl": "https://your-company.com/...",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
}
result = adyen.checkout.payments_api.payments(request)
~~~~

#### Using one of the services

~~~~python
from Adyen import checkout

checkout.client.xapikey = "YourXapikey"
checkout.client.platform = "test" # change to live for production
request = {
"amount": {
"amount": {
"currency": "USD",
"value": 1000 # value in minor units
},
"reference": "Your order number",
"paymentMethod": {
"value": 1000 # value in minor units
},
"reference": "Your order number",
"paymentMethod": {
"type": "visa",
"encryptedCardNumber": "test_4111111111111111",
"encryptedExpiryMonth": "test_03",
"encryptedExpiryYear": "test_2030",
"encryptedSecurityCode": "test_737"
},
"shopperReference": "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
"returnUrl": "https://your-company.com/...",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
}
},
"shopperReference": "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
"returnUrl": "https://your-company.com/...",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT"
}
result = checkout.payments_api.payments(request)
~~~~

#### Force HTTP library

~~~~python
import Adyen

adyen = Adyen.Adyen()
adyen.client.http_force = 'requests' # or 'pycurl'
~~~~

### Using query parameters (management API only)

Define a dictionary with query parameters that you want to use.

~~~~ python
query_parameters = {
'pageSize':10,
'pageNumber':3
}
'pageSize': 10,
'pageNumber': 3
}
~~~~

pass the dictionary to the method as an additional argument.

~~~~ python
adyen.management.account_company_level_api.get_companies(query_parameters=query_parameters)
~~~~

### Handling exceptions

Adyen service exceptions extend the AdyenError class. After you catch this exception, you can access the
class arguments for the specifics around this error or use the debug method which prints all the arguments.

~~~~python
try:
adyen.checkout.payments(request)
except Adyen.exceptions.AdyenErorr as error:
error.debug()
adyen.checkout.payments_api.payments(request)
except Adyen.exceptions.AdyenError as error:
print(error.debug())
~~~~

<details><summary>List of exceptions</summary>
<p>AdyenInvalidRequestError</p>
<p>AdyenAPIResponseError</p>
Expand All @@ -162,27 +179,27 @@ except Adyen.exceptions.AdyenErorr as error:
For a closer look at how our Python library works, clone our [example integration](https://github.com/adyen-examples/adyen-python-online-payments). This includes commented code, highlighting key features and concepts, and examples of API calls that can be made using the library.

## Feedback

We value your input! Help us enhance our API Libraries and improve the integration experience by providing your feedback. Please take a moment to fill out [our feedback form](https://forms.gle/A4EERrR6CWgKWe5r9) to share your thoughts, suggestions or ideas.

## Contributing

We encourage you to contribute to this repository, so everyone can benefit from new features, bug fixes, and any other improvements.


Have a look at our [contributing guidelines](https://github.com/Adyen/adyen-python-api-library/blob/develop/CONTRIBUTING.md) to find out how to raise a pull request.


## Support

If you have a feature request, or spotted a bug or a technical problem, [create an issue here](https://github.com/Adyen/adyen-web/issues/new/choose).

For other questions, [contact our Support Team](https://www.adyen.help/hc/en-us/requests/new?ticket_form_id=360000705420).


## Licence

This repository is available under the [MIT license](https://github.com/Adyen/adyen-python-api-library/blob/main/LICENSE.md).


## See also

* [Example integration](https://github.com/adyen-examples/adyen-python-online-payments)
* [Adyen docs](https://docs.adyen.com/)
* [API Explorer](https://docs.adyen.com/api-explorer/)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name='Adyen',
packages=find_packages(include="Adyen*"),
version='10.0.0-beta',
version='10.0.0',
maintainer='Adyen',
maintainer_email='support@adyen.com',
description='Adyen Python Api',
Expand Down