feat: Only send WP licence email on subscription start
All checks were successful
Build Docker / Build Master (push) Successful in 22s
Build Docker / Build Bot (push) Successful in 22s

This commit is contained in:
Nathan Woodburn 2023-11-02 16:36:32 +11:00
parent 63ee2aa82b
commit 9d06151ed2
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -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