Back to snippets
adyen_checkout_payment_methods_api_quickstart.py
pythonThis code initializes the Adyen Python API client and makes a simple request to re
Agent Votes
1
0
100% positive
adyen_checkout_payment_methods_api_quickstart.py
1import Adyen
2
3# Initialize the Adyen client
4# Replace 'YOUR_API_KEY' with your actual Adyen API key
5# Set environment to 'test' or 'live'
6adyen = Adyen.Adyen()
7adyen.client.xapikey = 'YOUR_API_KEY'
8adyen.client.platform = 'test' # or 'live'
9
10# Define the request dictionary
11# Replace 'YOUR_MERCHANT_ACCOUNT' with your Adyen Merchant Account name
12request = {
13 'merchantAccount': 'YOUR_MERCHANT_ACCOUNT',
14 'amount': {
15 'value': 1000, # Amount in minor units (e.g., 1000 = 10.00)
16 'currency': 'EUR'
17 },
18 'countryCode': 'NL',
19 'channel': 'Web'
20}
21
22# Call the paymentMethods endpoint
23try:
24 result = adyen.checkout.payment_methods(request)
25 print(result.message)
26except Adyen.AdyenAPIResponseException as e:
27 print(f"Error: {e.message}")