Closed Benedict-arowo closed 1 month ago
Allow users to upgrade or downgrade their subscription plans seamlessly.
Functional API endpoint for updating subscriptions with robust error handling.
[ ] Implement API Endpoint:
[ ] Validate Input Data:
[ ] Use Payment Gateway API:
[ ] Implement Payment Confirmation Service:
Authentication
Design API Endpoint for Subscription Updates:
Implement Validation for Input Parameters:
Integrate with Payment Gateway API for Subscription Updates:
Handle Errors Gracefully and Provide Appropriate Responses:
Implement Payment Confirmation Service:
Subscription Update:
Endpoint: PUT /api/subscriptions/{subscriptionId}
/api/subscriptions/{subscriptionId}
Request Body:
{ "newPlanId": "String" "userId": "String" "paymentId": "String" }
Response (Success):
{ "message": "Subscription updated successfully.", "subscription": { "id": "String", "plan": { "id": "String" "interval": "String", "currency": "String", "amount": "String", "description": "String" ... } "status": "String" } }
Response (Error):
{ "message": "Failed to update subscription.", "status_code": 400, "error": "String" }
Error Handling:
Service Description:
Implement a service that listens for payment confirmation events from the payment gateway (e.g., webhooks).
Ensure the service triggers the subscription update process when a new payment is confirmed.
Service Implementation Steps:
this is not a clear ticket, because a subscription is not updated without a new payment.
Will review accordingly.
GitHub Issue: Develop API Endpoint to Update Existing Subscriptions through the Payment Gateway
Purpose
Allow users to upgrade or downgrade their subscription plans seamlessly.
Expected Outcome
Functional API endpoint for updating subscriptions with robust error handling.
Requirements
[ ] Implement API Endpoint:
[ ] Validate Input Data:
[ ] Use Payment Gateway API:
[ ] Implement Payment Confirmation Service:
Acceptance Criteria
Authentication
Design API Endpoint for Subscription Updates:
Implement Validation for Input Parameters:
Integrate with Payment Gateway API for Subscription Updates:
Handle Errors Gracefully and Provide Appropriate Responses:
Implement Payment Confirmation Service:
Endpoints
Subscription Update:
Endpoint: PUT
/api/subscriptions/{subscriptionId}
Request Body:
Response (Success):
Response (Error):
Testing
Error Handling:
Payment Confirmation Service
Service Description:
Implement a service that listens for payment confirmation events from the payment gateway (e.g., webhooks).
Ensure the service triggers the subscription update process when a new payment is confirmed.
Service Implementation Steps: