# Subscription Management

The E-Commerce Payment Gateway (EGW) plays a critical role in enabling and processing recurring payments for subscription-based services. While full subscription lifecycle management (e.g., plan creation, trial handling, invoicing) is typically handled by external systems or merchant platforms, the EGW provides essential functionality to ensure secure, compliant, and reliable recurring payment processing.

## Initial Payment and Tokenization

* Processes the initial payment securely, applying Strong Customer Authentication (SCA) where required.
* Replaces sensitive card data with a secure token, which the merchant can store for future use—ensuring PCI DSS compliance.
* Returns the token to the merchant for use in subsequent Merchant-Initiated Transactions (MITs).

## Recurring Payment Execution

* Executes follow-up charges based on billing instructions from the merchant’s backend or subscription management system.
* Supported transaction types:
  * Card MITs (Merchant-Initiated Transactions)
  * A2A recurring payments via SEPA Direct Debit, Variable Recurring Payments (VRP), or mandate-based models
* Payments can be triggered via:
  * API calls
  * Scheduled jobs or background billing services

## Strong Customer Authentication (SCA) Handling

* Supports PSD2 SCA requirements:
  * Applies SCA during the initial transaction using 3D Secure 2.x
  * Handles recurring MIT exemptions for subsequent charges
* EGW flags MIT transactions to optimize exemption handling and minimize friction

## Failed Payment Handling and Retry Support

* Built-in support for retry logic in the event of failed recurring charges (e.g., insufficient funds)
* Configurable rules (e.g., retry up to 3 times within 7 days)
* Fully integrated via API and merchant-side logic

## Real-Time Notifications and Webhooks

* Sends real-time status updates to merchant systems upon transaction completion or failure
* Enables automated workflows:
  * Trigger dunning processes for unpaid invoices
  * Update subscription status based on payment outcome
  * Notify customers of success/failure events


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.ecomm.api.tietoevry.com/features/subscription-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
