PATCH
https://api.myidvirtual.com
/
customer
/
extend
/
{userID}
curl -X PATCH "https://api.vpn.tv/customer/extend/user123" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "credits": 1
  }'
{
  "success": true,
  "customer": {
    "id": "user123",
    "email": "[email protected]",
    "username": "customer_user",
    "expirationDate": "2024-12-31T23:59:59.000Z",
    "previousExpirationDate": "2024-11-30T23:59:59.000Z",
    "daysExtended": 30,
    "isActive": true,
    "screens": 3
  },
  "message": "Customer subscription extended successfully",
}

Overview

This endpoint allows authorized users to extend a customer’s subscription expiration date. When the date is extended, the customer automatically receives a renewal notification email. This is commonly used for subscription renewals, promotional extensions, or customer service adjustments.

Authentication

This endpoint requires JWT authentication. Include your bearer token in the Authorization header.

Authorization

Access is controlled by role-based permissions:
  • ADMIN: Full access to extend any customer
  • MASTER: Full access to extend any customer
  • RESALE: Can extend customers under their management

Path Parameters

userID
string
required
The unique user ID of the customer whose subscription will be extended

Request Body

credits
number
required
Number of credits to add equals 30 days signature to the current expiration date

Response

success
boolean
Indicates if the extension was successful
customer
object
Updated customer object with new expiration date
message
string
Success message confirming the extension
emailSent
boolean
Indicates if the renewal notification email was sent
curl -X PATCH "https://api.vpn.tv/customer/extend/user123" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "credits": 1
  }'
{
  "success": true,
  "customer": {
    "id": "user123",
    "email": "[email protected]",
    "username": "customer_user",
    "expirationDate": "2024-12-31T23:59:59.000Z",
    "previousExpirationDate": "2024-11-30T23:59:59.000Z",
    "daysExtended": 30,
    "isActive": true,
    "screens": 3
  },
  "message": "Customer subscription extended successfully",
}

Error Handling

Status CodeDescriptionSolution
200SuccessSubscription extended successfully
400Bad RequestCheck extension days value (1-365)
401UnauthorizedCheck your JWT token validity
403ForbiddenVerify your role permissions
404Not FoundVerify the user ID exists
409ConflictCustomer has reached maximum extension limit
500Internal Server ErrorContact support if persistent

Implementation Notes

Extension Limits

  • Minimum Extension: 30 day
  • Maximum Extension: 365 days per operation
  • Maximum Total: Customers can have up to 2 years of future subscription
  • Cumulative: Multiple extensions are allowed

Email Notifications

  • Automatic renewal notification email is sent by default
  • Email template includes new expiration date and renewal details
  • Email delivery is handled asynchronously
  • Failed email delivery doesn’t affect the extension operation

Account Reactivation

  • If a customer’s account is expired, extending the date automatically reactivates it
  • isActive status is updated to true when extension makes the account current
  • VPN access is restored immediately upon reactivation

Audit Trail

All extension operations are logged with:
  • User who performed the extension
  • Timestamp of operation

Business Rules

  • Extensions are calculated from the current expiration date, not the current date
  • If the customer is already expired, extension starts from the current date
  • System administrators can override extension limits

Performance Considerations

  • Database operations are atomic to prevent race conditions
  • Email sending is queued for background processing