# Subscription callbacks

SensePass sends callbacks about any change regarding subscription item.

The callback endpoint can be configured using "callbackURL" field on ["Init" API](https://docs.sensepass.com/sensepay/transaction-api/payment-flows/subscription) of subscriptions.

### Callback Structure

1. Main model structure is identical to [transaction status model](https://docs.sensepass.com/sensepay/transaction-api/payment-flows/transaction-status)
2. "parentTransaction" field was added for subscriptions, this field represents the orginal subscription transaction information
3. "parentTransaction.subscription" field was added with the subscription object, according to [Subscription Model](https://docs.sensepass.com/sensepay/transaction-api/models/subscription-model)

### Callback example

```json
{
    "TransactionNumber": "926868c423s1f582de89c1fa3b43ad7de2bb745c17f27d5d30c37e65",
    "date": "2024-05-05T14:45:29.673Z",
    "amount": "10",
    "baseAmount": "10",
    "currency": "USD",
    "status": 5,
    "statusName": "Transaction Approved",
    "timeoutDate": "2024-05-05T14:46:27.536Z",
    "maxInstallments": 1,
    "reason": null,
    "methodType": 0,
    "businessId": "715288992006428",
    "businessName": "Merchant Name",
    "pos": "Merchant",
    "businessOwnerPhone": "4233434789342",
    "businessCountry": "United States",
    "businessCity": "NY",
    "businessState": "NY",
    "businessStreet": "14 Ave.",
    "businessAddress": "NY",
    "businessLocaleName": "USA",
    "branchNumber": "1",
    "branchId": "1",
    "branch": {
        "number": "1",
        "rules": {}
    },
    "locale": {
        "name": "USA",
        "currency": "USD",
        "timezone": "America/New_York",
        "timezoneNumber": "-5",
        "phoneNumberPrefix": "1",
        "countryIso": "US",
        "language": "en"
    },
    "metadata": {
        "receiptMode": "3",
        "receiptSaveUid": "975d3b8c-3c08-4dfc-a4f6-8b077f75164e"
    },
    "products": [],
    "productsSum": {
        "allAmountSum": "0.00",
        "allTipSum": "NaN",
        "allVatSum": "0.00",
        "allTotalSum": "0.00",
        "allDiscountSum": "0.00",
        "allDiscountedAmountSum": "0.00"
    },
    "parentTransaction": {
        "TransactionNumber": "ff836e3fe344e4566483f9bd242fe62bb8d04fdfed3cc2c68f3ccc9f",
        "date": "2024-03-18T21:00:34.554Z",
        "amount": "178390",
        "baseAmount": "10",
        "currency": "USD",
        "status": 5,
        "statusName": "Transaction Approved",
        "timeoutDate": "2024-03-18T21:02:34.623Z",
        "maxInstallments": 1,
        "reason": null,
        "methodType": 5,
        "locale": {
            "language": "en"
        },
        "subscription": {
            "id": "3e8101b7-4aac-4578-acbb-fd4f2e328a98",
            "active": true,
            "created": "2024-03-18T21:00:34.595Z",
            "updated": "2024-05-05T14:45:27.536Z",
            "expires": null,
            "count": 18461,
            "failure": 333,
            "success": 18127,
            "start_date": "2024-05-01T10:45:00.000Z",
            "interval": "1minute",
            "intervalObj": {
                "amount": 1,
                "unit": "minute"
            },
            "status": "active",
            "customer": {}
        },
        "paymentProcessRequestID": "ec36e27f-4945-4607-8088-eaa75927cb76",
        "paymentMethodImages": {}
    },
    "paymentProcessRequestID": "10186870604",
    "confirmation": {
        "approvedBy": "Cardknox Sandbox",
        "dateApproval": "2024-05-05T14:45:30.767Z",
        "approvalDate": "2024-05-05T14:45:30.767Z",
        "paymentType": "Regular",
        "sensePassReferenceId": "rv3t47ofka376obsrhyd",
        "paymentMethodCode": 25,
        "paymentMethodName": "Credit Card (Sensepass PCI)",
        "paymentMethodLogo": "https://pay.sandbox.sensepass.com/publicAssets/payment-method/cardknox.png",
        "providerId": "6wMjGG7cJ5KPTvzLOXKTIJjwdREImIsJGNpmGckfBiU=",
        "requestID": "10186870604",
        "amount": 10,
        "confirmationNumber": "174-69844A",
        "fullConfirmationCode": "174-69844A",
        "providerName": "Cardknox Sandbox",
        "cardType": "VISA",
        "lastFourDigits": "1111",
        "cardMask": "444433******1111",
        "expiration": "0127",
        "cardExpiration": "0127",
        "paymentMethod": "Credit Card",
        "Credit Card": {
            "cardType": "VISA",
            "lastFourDigits": "1111",
            "mask": "444433******1111",
            "expiration": "0127"
        },
        "extraDetails": {
            "email": null
        }
    },
    "confirmationNumber": "174-69844A",
    "confirmations": [
        {
            "approvedBy": "Cardknox Sandbox",
            "dateApproval": "2024-05-05T14:45:30.767Z",
            "approvalDate": "2024-05-05T14:45:30.767Z",
            "paymentType": "Regular",
            "sensePassReferenceId": "rv3t47ofka376obsrhyd",
            "paymentMethodCode": 25,
            "paymentMethodName": "Credit Card (Sensepass PCI)",
            "paymentMethodLogo": "https://pay.sandbox.sensepass.com/publicAssets/payment-method/cardknox.png",
            "providerId": "6wMjGG7cJ5KPTvzLOXKTIJjwdREImIsJGNpmGckfBiU=",
            "requestID": "10186870604",
            "amount": 10,
            "confirmationNumber": "174-69844A",
            "fullConfirmationCode": "174-69844A",
            "providerName": "Cardknox Sandbox",
            "cardType": "VISA",
            "lastFourDigits": "1111",
            "cardMask": "444433******1111",
            "expiration": "0127",
            "cardExpiration": "0127",
            "paymentMethod": "Credit Card",
            "Credit Card": {
                "cardType": "VISA",
                "lastFourDigits": "1111",
                "mask": "444433******1111",
                "expiration": "0127"
            },
            "extraDetails": {
                "email": null
            }
        }
    ],
    "balance": 10,
    "clientPhoneNumber": null,
    "clientEmail": null,
    "callbackType": "transaction_status"
}
```
