### Example Subscription Creation (JSON) Source: https://docs.easypay.pt/_bundle/openapi_download= An example JSON payload for creating a subscription with detailed customer information, payment method, value, frequency, and SDD mandate details. This example demonstrates a full subscription setup. ```json { "capture": { "transaction_key": "Transaction Key", "descriptive": "subscription" }, "retries": 2, "customer": { "email": "john.doe@example.com", "key": "Customer Key", "language": "PT" }, "key": "Payment Key Key", "max_captures": 12, "start_time": "2025-08-06 11:07", "expiration_time": "2099-08-06 11:07", "value": 10.99, "frequency": "1M", "method": "DD", "sdd_mandate": { "iban": "PT50002700000001234567833", "name": "John Doe", "email": "john.doe@example.com", "phone": "911234567", "account_holder": "John Doe", "key": "SDD Mandate key", "max_num_debits": "12" } } ``` -------------------------------- ### Get Subscription Details - JSON Example Source: https://docs.easypay.pt/_bundle/openapi_download= This JSON example demonstrates the structure of a successful response when retrieving details for a specific subscription. It includes subscription parameters, customer information, payment method details, and a list of associated transactions. ```json { "id": "458b2fc4-3092-4de3-abd4-fe1600c09420", "key": "subscription 02536985", "expiration_time": "2099-01-15 00:00", "start_time": "2027-01-15 00:00", "frequency": "1M", "retries": 2, "max_captures": 12, "failover": false, "capture_now": true, "unlimited_payments": false, "customer": { "id": "e66c4f80-3dc6-11eb-b378-0242ac130002", "name": "João Silva", "email": "joao.silva@test.com", "phone": "+351911234567", "fiscal_number": "123456789", "key": "customer_key_123", "phone_indicators": { "country_calling_code": "+351", "national_destination_code": "91", "subscriber_number": "1234567" } }, "method": { "type": "CC", "status": "active", "url": "https://cc.easypay.pt/v3/public/card-details/cec55ab6-bda3-4ab3-af22-04d2ad2c046a", "last_four": "2222", "card_type": "VISA", "expiration_date": "07/29" }, "transactions": [ { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "key": "payment 123456", "status": "paid", "date": "2025-08-05 13:44:29", "currency": "EUR", "value": 10.55 } ], "currency": "EUR", "value": 10.55, "created_at": "2025-08-05 13:44:29" } ``` -------------------------------- ### API Request Examples (Bash) Source: https://docs.easypay.pt/docs/products/pay-by-link Demonstrates how to retrieve payment link data using the Easypay API via GET requests. Examples show how to fetch all links, filter by status (e.g., 'FINALIZED'), and filter by date range using query parameters. ```bash # Get all links GET /link # Filter by status GET /link?status=FINALIZED # Filter by date range GET /link?created_after=2024-01-01&created_before=2024-01-31 ``` -------------------------------- ### Use Case Example: Cloud Service Setup - JSON Source: https://docs.easypay.pt/docs/products/frequent-payments Example JSON payload for setting up a frequent payment for a pay-as-you-go cloud service, with a total maximum value and unlimited payments set to false. ```json { "method": "cc", "max_value": 5000.00, "unlimited_payments": false } ``` -------------------------------- ### Use Case Example: Prepaid Mobile Top-Up Setup - JSON Source: https://docs.easypay.pt/docs/products/frequent-payments Example JSON payload for setting up a frequent payment for mobile top-ups, with defined minimum and maximum top-up values. ```json { "method": "mbw", "min_value": 5.00, "max_value": 50.00 } ``` -------------------------------- ### Use Case Example: Ride-Sharing Setup - JSON Source: https://docs.easypay.pt/docs/products/frequent-payments Example JSON payload for setting up a frequent payment for a ride-sharing service, including minimum and maximum values per capture. ```json { "method": "cc", "min_value": 5.00, "max_value": 200.00 } ``` -------------------------------- ### Create Subscription Payment - Bash Example Source: https://docs.easypay.pt/docs/guides/payment-types This snippet demonstrates how to create a subscription payment using a POST request to the /subscription endpoint. It includes parameters for frequency, value, payment method, customer details, start time, maximum captures, retries, and failover. ```bash POST /subscription { "frequency": "1M", "value": 29.99, "method": "cc", "customer": { ... }, "start_time": "2024-01-01", "max_captures": 12, // Optional: 12 months "retries": 3, "failover": true } ``` -------------------------------- ### Create Full Subscription Example Source: https://docs.easypay.pt/_bundle/openapi_download= A comprehensive example demonstrating all available fields for creating a subscription, including capture details, customer information, currency, and advanced options like failover and retries. ```json { "frequent_id": "4c67e74b-a256-4e0a-965d-97bf5d01bd50", "capture": { "transaction_key": "string", "account": { "id": "22ea3cc9-424b-489a-91b7-8955f643dc93" }, "descriptive": "Descriptive Example" }, "expiration_time": "2017-12-12 16:05", "currency": "EUR", "customer": { "id": "22ea3cc9-424b-489a-91b7-8955f643dc93", "name": "Customer Example", "email": "customer@example.com", "phone": "911234567", "phone_indicative": "+351", "fiscal_number": "PT123456789", "key": "Example Key", "language": "PT" }, "key": "Example Key", "value": 17.5, "frequency": "1D", "max_captures": 10, "start_time": "2017-12-12 16:05", "failover": true, "capture_now": true, "retries": 2, "method": "CC", "sdd_mandate": { "id": "12345678901", "iban": "PT50002700000001234567833", "key": "Key Example", "name": "Name Example", "email": "customer@example.com", "phone": "911234567", "account_holder": "Acount Name Example", "country_code": "PT", "max_num_debits": "12" } } ``` -------------------------------- ### Use Case Example: Food Delivery Setup - JSON Source: https://docs.easypay.pt/docs/products/frequent-payments Example JSON payload for setting up a frequent payment for a food delivery service, defining minimum and maximum values per order. ```json { "method": "cc", "min_value": 10.00, "max_value": 150.00 } ``` -------------------------------- ### Create Subscription with Credit Card (CC) Source: https://docs.easypay.pt/_bundle/openapi_download= Example of creating a subscription using a Credit Card (CC) payment method. This includes setting the expiration time, start time, value, and frequency of payments. ```json { "expiration_time": "2022-12-04 12:00", "max_captures": 2, "start_time": "2022-12-04 12:00", "value": 17.55, "frequency": "1D", "method": "CC" } ``` -------------------------------- ### Patch Account Configuration Example Source: https://docs.easypay.pt/_bundle/openapi_download= Provides an example of the JSON payload for updating account configurations. This includes URLs for various notification types and redirects. ```json { "generic": "https://www.easypay.pt/generic", "authorisation": "https://www.easypay.pt/authorisation", "transaction": "https://www.easypay.pt/transaction", "visa_fwd": "https://www.easypay.pt/visa_fwd", "visa_detail": "https://www.easypay.pt/visa_detail" } ``` -------------------------------- ### Ledger Entry Details Example Source: https://docs.easypay.pt/_bundle/openapi_download= An example of ledger entry details, including operation ID, key, and method. ```APIDOC ### Ledger Entry Details Example #### Description An example of ledger entry details, including operation ID, key, and method. #### Example ```json { "operation_id": "7bca9e29-21a3-4e23-a1f5-50bb605e2360", "operation_key": "Merchant identification key", "method": "CC" } ``` ``` -------------------------------- ### Create Checkout Request Example Source: https://docs.easypay.pt/_bundle/openapi_download= Shows an example of a checkout request, detailing payment methods, type, capture settings, expiration time, currency, and direct debit mandate information. ```json { "type": [ "single" ], "payment": { "methods": [ "MB", "CC", "MBW", "DD", "VI", "AP", "GP", "SW" ], "type": "sale", "capture": { "descriptive": "Descriptive Example" }, "expiration_time": "2025-06-12 11:24", "currency": "EUR", "key": "Example Key", "sdd_mandate": { "iban": "PT50002700000001234567833", "name": "Name Example", "email": "customer@example.com", "phone": "911234567" } } } ``` -------------------------------- ### Update Frequent Payment Example Source: https://docs.easypay.pt/_bundle/openapi_download= An example demonstrating how to update a frequent payment configuration. This includes setting the status, expiration time, currency, customer details, transaction limits, and SDD mandate information. ```json { "status": "active", "expiration_time": "2038-12-12 16:05", "currency": "EUR", "customer": { "id": "22ea3cc9-424b-489a-91b7-8955f643dc93", "name": "Customer Example", "email": "customer@example.com", "phone": "911234567", "phone_indicative": "+351", "fiscal_number": "PT123456789", "key": "Key Example", "language": "PT" }, "key": "Example Key", "max_value": 20, "min_value": 2, "unlimited_payments": false, "sdd_mandate": { "id": "12345678901", "iban": "PT50002700000001234567833", "key": "Key Example", "name": "Name Example", "email": "customer@example.com", "phone": "911234567", "account_holder": "Account Name Example", "country_code": "PT", "max_num_debits": "12" } } ``` -------------------------------- ### Installment Plan Configuration (JSON) Source: https://docs.easypay.pt/docs/products/subscriptions Configuration for a 12-month installment payment plan. This example sets a monthly charge of 83.33, starting on a specific date, with a maximum of 12 captures. ```json { "frequency": "1M", "value": 83.33, "method": "dd", "start_time": "2024-01-01", "max_captures": 12 // Total: €999.96 } ``` -------------------------------- ### Example Subscription Status Update (JSON) Source: https://docs.easypay.pt/_bundle/openapi_download= This JSON example illustrates updating a subscription's status to 'active' along with other details like capture, expiration time, currency, customer information, value, frequency, and SDD mandate. It shows a common scenario for activating a subscription. ```json { "status": "active", "capture": { "transaction_key": "string", "account": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08" }, "descriptive": "string" }, "expiration_time": "2039-12-12 16:05", "currency": "EUR", "customer": { "name": "Jonh Doe", "email": "user@example.com", "phone": "962496235", "phone_indicative": "351", "fiscal_number": "PT277712580", "key": "01J1PKR2RPHJNJQGFWGDYXY0KM", "language": "PT" }, "key": "Example Key", "value": 12.55, "frequency": "1D", "max_captures": 0, "unlimited_payments": true, "start_time": "2025-12-12 16:05", "failover": false, "retries": 0, "sdd_mandate": { "id": "c6056234-a3f9-42de-b944-3ed793fcb6bb", "iban": "PT50000747199140461443823", "key": "01J1PKR2RPHJNJQGFWGDYXY0KM", "name": "string", "email": "string", "phone": "string", "account_holder": "string", "country_code": "string", "max_num_debits": "string", "billing_entity": "PT16103627" } } ``` -------------------------------- ### Create Payment Responses (VI, MB, CC, MBW) Source: https://docs.easypay.pt/_bundle/openapi_download= These examples demonstrate successful responses for creating different payment methods. They include status, messages, unique identifiers, and method-specific details such as IBAN for VI, entity and reference for MB, URL for CC, and status for MBW. The customer and capture details are also provided. ```json { "Created Visa/Mastercard with success": { "value": { "status": "ok", "message": [ "Your request was successfully created" ], "id": "52a29de3-c337-4681-acc5-9e16a1bcbc76", "method": { "type": "VI", "status": "pending", "iban": "PT50123400009900032909922" }, "customer": { "id": "9d66ceba-8daf-4f9e-af59-747b0d196096" }, "capture": { "id": "833259eb-343d-4f4d-aac8-4797a7b2bfe6" } } }, "Created Multibanco with success": { "value": { "status": "ok", "message": [ "Your request was successfully created" ], "id": "e95dec61-fa63-461a-8e5b-ea42c4755bac", "method": { "type": "MB", "status": "pending", "entity": "11683", "reference": "663000450", "expiration_date": "07/17" }, "customer": { "id": "fba21a72-70fc-4e15-92e0-bcc967dfb750" }, "capture": { "id": "2a2b6501-b3eb-4b88-8e43-beb3d348fef0" }, "multibanco": { "product": "CHECKDIGIT", "start_time": "2025-07-25T10:22:53Z", "expiration_time": "2025-08-24T10:22:52Z" } } }, "Created Credit Card with success": { "value": { "status": "ok", "message": [ "Your request was successfully created" ], "id": "66d50369-1e80-4a6e-8346-ae7bc7e88355", "method": { "type": "CC", "status": "pending", "url": "https://cc.test.easypay.pt/v3/public/card-details/66d50369-1e80-4a6e-8346-ae7bc7e88355" }, "customer": { "id": "b929f784-3cd3-4a6d-b712-4e9f17e7fa2f" }, "capture": { "id": "15962a97-3c67-41bf-8db7-f8e0cddc16b5" } } }, "Created MB Way with success": { "value": { "status": "ok", "message": [ "Your request was successfully created" ], "id": "1c21f592-e0a3-4da4-9bac-2c56069b807e", "method": { "type": "MBW", "status": "success" }, "customer": { "id": "e162c103-ce92-4a55-b39a-38f72a77d899" }, "capture": { "id": "ad0e3276-6ebc-48ee-bb27-9a2a39d8a986" } } } } ``` -------------------------------- ### Payment Configuration Example (JSON) Source: https://docs.easypay.pt/_bundle/openapi_download= This JSON object defines the configuration for a payment, including details about the account holder, payment limits, frequency, capture settings, and specific payment methods like Multibanco. It also includes order and customer information. ```json { "account_holder": "Account Name Example" }, "max_value": 20, "min_value": 2, "unlimited_payments": false, "frequency": "1W", "max_captures": 10, "start_time": "2025-06-12 11:24", "failover": true, "capture_now": true, "retries": 2, "multibanco": { "product": "SPG", "start_time": "2025-07-25T10:22:53Z", "expiration_time": "2025-08-24T10:22:52Z" } }, "order": { "items": [ { "description": "Item in Shopping Cart", "quantity": 2, "key": "Example Key", "value": 17.5 } ], "key": "Example Key", "value": 17.5 }, "customer": { "name": "Customer Example", "email": "customer@example.com", "phone": "911234567" } } ``` -------------------------------- ### Example Easypay Authenticated API Request (cURL) Source: https://docs.easypay.pt/docs/authentication This cURL command demonstrates how to make a GET request to the Easypay API, including the necessary AccountId and ApiKey headers for authentication. ```bash curl -L -X GET 'https://api.test.easypay.pt/2.0/single/5eca7446-14e9-47bb-aabb-5ee237159b8b' \ -H 'AccountId: 2b0f63e2-9fb5-4e52-aca0-b4bf0339bbe6' \ -H 'ApiKey: eae4aa59-8e5b-4ec2-887d-b02768481a92' ``` -------------------------------- ### Alternative Payment Configuration Example (JSON) Source: https://docs.easypay.pt/_bundle/openapi_download= An alternative structure for a payment configuration, specifying a single payment type with details on capture, expiration, currency, and customer information. This example also includes order items and specific Multibanco settings. ```json { "value": { "type": "single", "payment": { "methods": [ "MBW" ], "type": "sale", "capture": { "transaction_key": "string", "capture_date": "2026-05-15", "account": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08" }, "splits": { "split_key": "01J1PKR2RPHJNJQGFWGDYXY0KM", "split_descriptive": "Payment of Invoice Nº 1982652", "value": 15.32, "account": { "id": "c6056234-a3f9-42de-b944-3ed793fcb6bb" }, "margin_value": 0, "margin_account": { "id": "c6056234-a3f9-42de-b944-3ed793fcb6bb" }, "clearing_period": "7D" }, "descriptive": "Small description of the capture" }, "expiration_time": "2027-12-12 16:05", "currency": "EUR", "key": "string", "max_value": 0.5, "min_value": 0.5, "unlimited_payments": true, "frequency": "1D", "max_captures": 0, "start_time": "2019-08-24", "failover": true, "capture_now": true, "retries": 0, "multibanco": { "expiration_time": "string", "start_time": "string", "product": "CHECKDIGIT" } }, "order": { "items": [ { "description": "Description Example", "quantity": 2, "key": "Key Example", "value": 10.55 } ], "key": "Example Key", "value": 50.78 }, "customer": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "John Doe", "email": "example@easypay.pt", "phone": "911234567", "phone_indicative": "+351", "language": "EN", "fiscal_number": "PT268826145", "key": "Key Example" } } } ``` -------------------------------- ### Quarterly Service Configuration (JSON) Source: https://docs.easypay.pt/docs/products/subscriptions Configuration for quarterly billing of a service. This example sets a charge of 299.99 every three months, starting on a specific date, with unlimited payment attempts. ```json { "frequency": "3M", "value": 299.99, "method": "cc", "start_time": "2024-01-01", "unlimited_payments": true } ``` -------------------------------- ### SaaS Subscription Configuration (JSON) Source: https://docs.easypay.pt/docs/products/subscriptions Configuration for a monthly SaaS subscription. This example sets a recurring charge of 49.99 every month, starting on a specified date, with unlimited payment attempts. ```json { "frequency": "1M", "value": 49.99, "method": "cc", "start_time": "2024-01-01", "unlimited_payments": true, "retries": 3 } ``` -------------------------------- ### Update Subscription - JSON Example Source: https://docs.easypay.pt/_bundle/openapi_download= This JSON example illustrates a successful response after updating a subscription. It confirms the operation with a 'status' of 'ok' and includes the updated subscription details in the 'message' field, mirroring the structure of a subscription detail response. ```json { "status": "ok", "message": { "id": "458b2fc4-3092-4de3-abd4-fe1600c09420", "key": "subscription 02536985", "expiration_time": "2099-01-15 00:00", "start_time": "2027-01-15 00:00", "frequency": "1M", "retries": 2, "max_captures": 12, "failover": false, "capture_now": true, "unlimited_payments": false, "customer": { "id": "e66c4f80-3dc6-11eb-b378-0242ac130002", "name": "João Silva", "email": "joao.silva@test.com", "phone": "+351911234567", "fiscal_number": "123456789", "key": "customer_key_123", "phone_indicators": { "country_calling_code": "+351", "national_destination_code": "91", "subscriber_number": "1234567" } }, "method": { "type": "CC", "status": "active", "url": "https://cc.easypay.pt/v3/public/card-details/cec55ab6-bda3-4ab3-af22-04d2ad2c046a", "last_four": "2222", "card_type": "VISA", "expiration_date": "07/29" }, "transactions": [ { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "key": "payment 123456", "status": "paid", "date": "2025-08-05 13:44:29", "currency": "EUR", "value": 10.55 } ], "currency": "EUR", "value": 10.55, "created_at": "2025-08-05 13:44:29" } } ``` -------------------------------- ### GET /void/details Source: https://docs.easypay.pt/_bundle/openapi_download= Retrieves details for a void operation. This endpoint is used to get specific information about a previously initiated void transaction. ```APIDOC ## GET /void/details ### Description Retrieves details for a void operation. This endpoint is used to get specific information about a previously initiated void transaction. ### Method GET ### Endpoint /void/details ### Parameters #### Query Parameters - **id** (string) - Required - The unique identifier of the void operation. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the void operation. - **key** (string) - A reference key for the void operation. - **status** (string) - The current status of the void operation (e.g., "paid", "failed"). - **date** (string) - The date and time when the void operation was processed. - **currency** (string) - The currency of the transaction associated with the void. - **value** (number) - The amount of the transaction that was voided. #### Response Example ```json { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "key": "payment 123456", "status": "paid", "date": "2025-08-05 13:44:29", "currency": "EUR", "value": 10.55 } ``` ``` -------------------------------- ### Create Subscription (Bash) Source: https://docs.easypay.pt/docs/products/subscriptions Initiates a new subscription with specified details. Requires frequency, value, currency, payment method, start time, customer information, and capture description. Optional parameters include max captures, retries, and failover. ```bash POST /subscription { "frequency": "1M", "value": 29.99, "currency": "EUR", "method": "cc", "start_time": "2024-02-01 00:00", "max_captures": 12, "customer": { "name": "John Doe", "email": "john@example.com" }, "capture": { "descriptive": "Monthly SaaS Subscription" }, "retries": 3, "failover": true } ``` -------------------------------- ### Specific Error Types and Examples Source: https://docs.easypay.pt/docs/error-handling Details on common error types, their causes, example responses, and resolution steps. ```APIDOC ## Error Types ### Authentication Error (403) **Possible Causes**: - Missing or invalid `AccountId` or `ApiKey` headers. - Account has been blocked. - Insufficient permissions for the requested action. **Example**: ```json { "status": "error", "message": "Authentication Error: Invalid AccountId or ApiKey", "code": "AUTHENTICATION_ERROR" } ``` **Resolution**: Verify your credentials and ensure your account is active. ### Invalid Content Type Error (415) **Cause**: You provided an invalid or unsupported `Content-Type` header. **Example**: ```json { "status": "error", "message": "Invalid Content Type Error: Unsupported content type", "code": "INVALID_CONTENT_TYPE" } ``` **Resolution**: Set the `Content-Type` header to `application/json`. ### Invalid JSON Error (400) **Cause**: The request body contains malformed JSON. **Example**: ```json { "status": "error", "message": "Invalid JSON Error: Unexpected token", "code": "INVALID_JSON" } ``` **Resolution**: Validate your JSON payload before sending the request. ### Invalid Params Error (400) **Cause**: Required parameters are missing or invalid. **Example**: ```json { "status": "error", "message": "Invalid Params Error: Field 'value' is required", "code": "INVALID_PARAMS", "doc_url": "https://docs.easypay.pt/errors/INVALID_PARAMS" } ``` **Resolution**: Review the error message and ensure all required parameters are provided with valid values. ### Internal Error (500) **Cause**: An unexpected error occurred on Easypay's servers. **Example**: ```json { "status": "error", "message": "Internal Error: An unexpected error occurred", "code": "INTERNAL_ERROR" } ``` **Resolution**: Retry the request. If the problem persists, contact support. ``` -------------------------------- ### GET /config - Get Account Config Source: https://docs.easypay.pt/openapi/config/get_config Retrieves the configuration settings for the authenticated Easypay account. This includes various notification URLs and account identifiers. ```APIDOC ## GET /config ### Description Retrieves the configuration settings for the authenticated Easypay account. This includes various notification URLs and account identifiers. ### Method GET ### Endpoint /config ### Parameters #### Query Parameters - **accountId** (string) - Required - The account ID for authentication. - **apiKey** (string) - Required - The API key for authentication. ### Request Example ``` GET /config?accountId=YOUR_ACCOUNT_ID&apiKey=YOUR_API_KEY ``` ### Response #### Success Response (200) - **generic** (string) - URL for generic notification. - **authorisation** (string) - URL for authorisation notification. - **transaction** (string) - URL for transaction notification. - **visa_fwd** (string) - URL for redirect clients on credit card forward. - **visa_detail** (string) - URL for credit card payment detail. - **account** (string) - The UUID of the related account. Example: "b2080452-bad1-4455-8ae7-9f5ea552a274" - **client_id** (string) - The id of the related client. Example: "EASYP030002" - **payment_methods** (array) - The available payments for the related account. #### Response Example (200) ```json { "generic": "https://example.com/notify/generic", "authorisation": "https://example.com/notify/auth", "transaction": "https://example.com/notify/transaction", "visa_fwd": "https://example.com/redirect/visa", "visa_detail": "https://example.com/payment/visa", "account": "b2080452-bad1-4455-8ae7-9f5ea552a274", "client_id": "EASYP030002", "payment_methods": ["credit_card", "paypal"] } ``` #### Error Response (403) - **status** (string, required) - **message** (array, required) - An array of human-readable messages included in the response. These messages provide detailed information about the success of the operation or explain the reasons for any failure. This field is always present in the response to ensure clarity and transparency regarding the outcome of the API request. #### Error Response (429) - **status** (string, required) - **message** (array, required) - An array of human-readable messages included in the response. These messages provide detailed information about the success of the operation or explain the reasons for any failure. This field is always present in the response to ensure clarity and transparency regarding the outcome of the API request. #### Error Response (500) - **status** (string, required) - **message** (array, required) - An array of human-readable messages included in the response. These messages provide detailed information about the success of the operation or explain the reasons for any failure. This field is always present in the response to ensure clarity and transparency regarding the outcome of the API request. ``` -------------------------------- ### Idempotency Request Example Source: https://docs.easypay.pt/docs/idempotency Example of how to make an idempotent POST request to the Easypay API using the `Idempotency-Key` header. ```APIDOC ## POST /2.0/single ### Description This endpoint allows for single transaction processing (e.g., sales) and supports idempotency to prevent duplicate operations. ### Method POST ### Endpoint `https://api.test.easypay.pt/2.0/single` ### Headers - **AccountId** (string) - Required - Your Easypay account ID. - **ApiKey** (string) - Required - Your Easypay API key. - **Idempotency-Key** (string) - Required - A unique identifier for the request. Use UUIDs or ULIDs. Max length: 50 characters. - **Content-Type** (string) - Required - Must be `application/json`. ### Request Body - **type** (string) - Required - The type of transaction (e.g., "sale"). - **value** (number) - Required - The transaction amount. - **currency** (string) - Required - The transaction currency (e.g., "EUR"). - **method** (string) - Required - The payment method (e.g., "cc"). ### Request Example ```json { "type": "sale", "value": 10.00, "currency": "EUR", "method": "cc" } ``` ### Response #### Success Response (200) - **status** (string) - The status of the transaction. - **message** (string) - A message describing the transaction result. - **transactionId** (string) - The unique identifier for the transaction. #### Response Example ```json { "status": "success", "message": "Transaction processed successfully", "transactionId": "txn_12345abcde" } ``` #### Replay Response Header - **Idempotency-Replay** (boolean) - `true` if the response is a replay of a previous request with the same `Idempotency-Key`. ``` -------------------------------- ### Retry Header Example (HTTP) Source: https://docs.easypay.pt/docs/error-handling An example of the `X-Easypay-Should-Retry` header in an HTTP response. A value of `true` indicates that the request can be safely retried. ```http X-Easypay-Should-Retry: true ``` -------------------------------- ### Switching Between Environments with cURL Source: https://docs.easypay.pt/docs/environments Demonstrates how to make API requests to both the Test and Production environments using cURL. The key difference is the base URL and the credentials used (Test vs. Production AccountId and ApiKey). ```bash curl -L -X POST 'https://api.test.easypay.pt/2.0/single' \ -H 'AccountId: ' \ -H 'ApiKey: ' \ -H 'Content-Type: application/json' \ --data-raw '{ ... }' ``` ```bash curl -L -X POST 'https://api.prod.easypay.pt/2.0/single' \ -H 'AccountId: ' \ -H 'ApiKey: ' \ -H 'Content-Type: application/json' \ --data-raw '{ ... }' ``` -------------------------------- ### Create MBWAY Frequent Authorisation Example Source: https://docs.easypay.pt/_bundle/openapi_download= An example of creating a frequent authorization using MBway. This includes the transaction key, descriptive text for the bank statement, and the transaction value. ```json { "transaction_key": "string", "descriptive": "Descriptive Example", "value": 10.5 } ``` -------------------------------- ### Create Subscription with Direct Debit (DD) Source: https://docs.easypay.pt/_bundle/openapi_download= Example of creating a subscription using a Direct Debit (DD) payment method. This requires additional details for the SDD mandate, including IBAN, customer information, and mandate key. ```json { "max_captures": 2, "start_time": "2022-12-04 12:00", "value": 17.5, "frequency": "1Y", "method": "DD", "sdd_mandate": { "iban": "PT50002700000001234567833", "name": "Frequent Payment DD", "email": "customer@example.com", "phone": "911234567", "account_holder": "Account Name Example", "key": "Sdd Mandate key" } } ```