Upgrade account only if payment is settled

This commit is contained in:
DariusIII
2024-01-03 20:59:38 +01:00
parent 74df599dac
commit 679b44add8
2 changed files with 2 additions and 2 deletions
@@ -97,7 +97,7 @@ class BtcPaymentController extends BasePageController
}
$payload = json_decode($request->getContent(), true);
// We have received a payment for an invoice and user should be upgraded to a paid plan based on order
if ($payload['type'] === 'InvoiceReceivedPayment' || $payload['type'] === 'InvoicePaymentSettled') {
if ($payload['type'] === 'InvoicePaymentSettled') {
preg_match('/(?P<role>\w+(\s\+\+)?)[\s](?P<addYears>\d+)/i', $payload['metadata']['itemDesc'], $matches);
if (empty($matches)) {
Log::error('Could not parse BTCPay webhook: '.$payload['metadata']['itemDesc']);
+1 -1
View File
@@ -385,7 +385,7 @@ Route::post('btcpay/webhook', function (Illuminate\Http\Request $request) {
}
$payload = json_decode($request->getContent(), true);
// We have received a payment for an invoice and user should be upgraded to a paid plan based on order
if ($payload['type'] === 'InvoiceReceivedPayment' || $payload['type'] === 'InvoicePaymentSettled') {
if ($payload['type'] === 'InvoicePaymentSettled') {
preg_match('/(?P<role>\w+(\s\+\+)?)[\s](?P<addYears>\d+)/i', $payload['metadata']['itemDesc'], $matches);
if (empty($matches)) {
Log::error('Could not parse BTCPay webhook: '.$payload['metadata']['itemDesc']);