<filename>server/lambdas/stripe/paymentIntent/post/postPaymentIntent.py
import json
import stripe

stripe.api_key = "<KEY>"


def postPaymentIntent(event, context):
    data = json.loads(event['body'])

    response_value = {
        'statusCode': 500,
        'body': json.dumps({"message": "Payment Failed",
                            "success": False}),
        'headers': {
            'Content-Type': 'application/json',
            'Access-Control-Allow-Origin': '*'
        }
    }
    try:
        stripe.PaymentIntent.create(
            amount=data['amount'],
            currency=data['currency'],
            description=data['description'],
            payment_method=data['payment_method'],
            confirm=True,
        )
        response_value = {
            'statusCode': 200,
            'body': json.dumps({"message": "Payment Successful",
                                "success": True}),
        }
    except Exception as e:
        print(e)

    return response_value

<filename>server/lambdas/stripe/paymentIntent/post/postPaymentIntent.py
import json
import stripe

stripe.api_key = "<KEY>"


def postPaymentIntent(event, context):
    data = json.loads(event['body'])

    response_value = {
        'statusCode': 500,
        'body': json.dumps({"message": "Payment Failed",
                            "success": False}),
        'headers': {
            'Content-Type': 'application/json',
            'Access-Control-Allow-Origin': '*'
        }
    }
    try:
        stripe.PaymentIntent.create(
            amount=data['amount'],
            currency=data['currency'],
            description=data['description'],
            payment_method=data['payment_method'],
            confirm=True,
        )
        response_value = {
            'statusCode': 200,
            'body': json.dumps({"message": "Payment Successful",
                                "success": True}),
        }
    except Exception as e:
        print(e)

    return response_value
