Well the new code both works and not at the same time. When a client paid, it all worked. When I used "paid from saved card" in the UI, it 500s out with this error:
[24-Jun-2025 23:29:29] WARNING: [pool www] child 1322341 said into stderr: "NOTICE: PHP message: PHP Warning: Undefined array key "invoice_discount" in /var/www/itflow/post/user/invoice_model.php on line 7"
[24-Jun-2025 23:29:29] WARNING: [pool www] child 1322341 said into stderr: "NOTICE: PHP message: PHP Warning: Undefined array key "recurring_discount" in /var/www/itflow/post/user/invoice_model.php on line 8"
[24-Jun-2025 23:29:46] WARNING: [pool www] child 1322341 said into stderr: "NOTICE: PHP message: PHP Fatal error: Uncaught Stripe\Exception\InvalidArgumentException: The resource ID cannot be null or whitespace. in /var/www/itflow/plugins/stripe-php/lib/Service/AbstractService.php:99"
[24-Jun-2025 23:29:46] WARNING: [pool www] child 1322341 said into stderr: "Stack trace:"
[24-Jun-2025 23:29:46] WARNING: [pool www] child 1322341 said into stderr: "#0 /var/www/itflow/plugins/stripe-php/lib/Service/BalanceTransactionService.php(50): Stripe\Service\AbstractService->buildPath()"
[24-Jun-2025 23:29:46] WARNING: [pool www] child 1322341 said into stderr: "#1 /var/www/itflow/post/user/invoice.php(1065): Stripe\Service\BalanceTransactionService->retrieve()"
[24-Jun-2025 23:29:46] WARNING: [pool www] child 1322341 said into stderr: "#2 /var/www/itflow/post.php(49): require_once('...')"
[24-Jun-2025 23:29:46] WARNING: [pool www] child 1322341 said into stderr: "#3 {main}"
[24-Jun-2025 23:29:46] WARNING: [pool www] child 1322341 said into stderr: " thrown in /var/www/itflow/plugins/stripe-php/lib/Service/AbstractService.php on line 99"