> ## Documentation Index
> Fetch the complete documentation index at: https://developer.transactbridge.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration with Merchant API

## Coupon Integration

Coupons allow merchants to offer discounted subscription pricing to customers. A coupon is applied during subscription creation using the `discount` object in Create subscription API.

### Steps For Integration

* Merchant creates and validates the coupon at their end in their own system.
* Merchant passes the coupon details in couponDetails object in <a href="https://docs.transactbridge.com/#307dc665-ae10-4e43-8853-5b7f04961825">Create Susbcription API</a>, while creating the  subscription.
* This couponDetails object will define how the discount should be applied.
* This object has different keys such as coupon-name, discount type, discount quote amount, duration type, period unit, period etc.
* Transact Bridge receives the coupon information.
* Merchant renders the Hosted checkout page( with the help of redirect url received in response of create subscription API) with coupon already applied.
* The customer completes the payment using the discounted amount.

### Supported Discount Types

The subscription platform supports the following discount configurations:

| Type               | Description                                                         |
| ------------------ | ------------------------------------------------------------------- |
| **One-time**       | Applied only to the first billing cycle.                            |
| **Limited Period** | Applied for a specified number of billing cycles.                   |
| **Lifetime**       | Applied to every billing cycle until the subscription is cancelled. |

### Integration Flow

```mermaid theme={null}
flowchart LR

A["Create<br/>Coupon"]
B["Create<br/>Subscription"]
C["Attach<br/>Discount"]
D["Customer<br/>Checkout"]
E["Subscription<br/>Activated"]
F["Invoice<br/>Generated"]
G["Discount<br/>Applied"]
 
A --> B --> C --> D --> E --> F --> G
```

### Request Example

```json theme={null}
{
  "couponDetails":{
        "coupon": "TEST",
        "applicable" : true,
        "discountType": "FIX",
        "discountQuoteAmount": "100",
        "durationType" : "LIMITED_PERIOD",
        "periodUnit": "MNTH",
        "period": 6
    },
}
```
