@@ -112,6 +112,11 @@ private static string GetPaddleConfigurationError(string paddleEnvironment, stri
112112 return null ;
113113 }
114114
115+ private static string GetPaddleCheckoutProductId ( Resgrid . Model . Plan plan )
116+ {
117+ return plan ? . GetExternalKey ( ) ?? string . Empty ;
118+ }
119+
115120 [ HttpGet ]
116121 [ Authorize ]
117122 public async Task < IActionResult > SelectRegistrationPlan ( string discountCode = null )
@@ -782,10 +787,15 @@ public async Task<IActionResult> GetPaddleCheckout(int id, int count, string dis
782787 return BadRequest ( "Invalid entity pack count." ) ;
783788
784789 var plan = await _subscriptionsService . GetPlanByIdAsync ( id ) ;
790+ var paddleProductId = GetPaddleCheckoutProductId ( plan ) ;
791+
792+ if ( string . IsNullOrWhiteSpace ( paddleProductId ) )
793+ return StatusCode ( StatusCodes . Status500InternalServerError , "Paddle checkout is not configured for this plan." ) ;
794+
785795 var paddleCustomerId = await _departmentSettingsService . GetPaddleCustomerIdForDepartmentAsync ( DepartmentId ) ;
786796 var department = await _departmentsService . GetDepartmentByIdAsync ( DepartmentId ) ;
787797 var user = _usersService . GetUserById ( UserId ) ;
788- var checkout = await _subscriptionsService . CreatePaddleCheckoutForSub ( DepartmentId , paddleCustomerId , plan . GetExternalKey ( ) , plan . PlanId , user . Email , department . Name , count , discountCode ) ;
798+ var checkout = await _subscriptionsService . CreatePaddleCheckoutForSub ( DepartmentId , paddleCustomerId , paddleProductId , plan . PlanId , user . Email , department . Name , count , discountCode ) ;
789799
790800 bool hasActiveSub = false ;
791801 if ( ! string . IsNullOrWhiteSpace ( paddleCustomerId ) )
@@ -797,6 +807,7 @@ public async Task<IActionResult> GetPaddleCheckout(int id, int count, string dis
797807
798808 return Json ( new
799809 {
810+ TransactionId = checkout ? . TransactionId ,
800811 PriceId = checkout ? . PriceId ,
801812 CustomerId = checkout ? . CustomerId ,
802813 Environment = checkout ? . Environment ,
0 commit comments