From 9d06151ed2026a8c7ba675ed5db9473aae1d0aa1 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Thu, 2 Nov 2023 16:36:32 +1100 Subject: [PATCH] feat: Only send WP licence email on subscription start --- master/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/master/main.py b/master/main.py index c695878..f781ea0 100644 --- a/master/main.py +++ b/master/main.py @@ -277,7 +277,14 @@ def stripeapi(): return jsonify({'success': 'false'}) if event.type == 'payment_intent.succeeded': + # Only for payments for licences payment_intent = event.data.object + if payment_intent['amount'] != 1000: + return jsonify({'success': 'true'}) + + if payment_intent['description'] != "Subscription creation": + return jsonify({'success': 'true'}) + # Get email email = payment_intent['receipt_email'] # Create licence key