Cannot Pass Parameter to Page Flow Via dmx.parse

I have some javascript which uses some dmx.parse commands… the full code is below.

I am trying to make use of the javascript value result.error.message.

My previous code used this successfully to set the value of a variable in Wappler:

 dmx.parse('stripe_error_message.setValue("Sorry, there was an error processing your card payment: ' + result.error.message + '");');

I am now trying to pass this value into a flow so I can do more complex processing, but the value is not being passed in. The code I am using, as you can see below, is:

 dmx.parse("flow_stripe_error.run({stripe_error_message: result.error.message})");

This code is calling the flow, but the value of result.error.message is not being passed through.

Is this a Wappler bug, or am I doing something wrong here?

Best wishes,
Antony.

Full code:

<script>
    // ===================== STRIPE Pay Now - Form Submission ===============================

var form = document.getElementById('payment_form');

form.addEventListener('submit', function (ev) {
	console.log("Submitting Stripe Form...");
	dmx.parse("stripe_error_message.setValue('');");
    ev.preventDefault();
    stripe.confirmCardPayment(dmx.parse("stripe_client_secret.value"), {
        payment_method: {
            card: card,
            billing_details: {
                name: dmx.parse("to_be_paid_by.value"),
            }
        }
    }).then(function (result) {
        if (result.error) {
            // Show error to your customer (e.g., insufficient funds)
			console.log("There was an error processing the card details with Stripe...");
			console.log(result.error.message);
      dmx.parse("flow_stripe_error.run({stripe_error_message: result.error.message})");
      // dmx.parse("processing_status.setValue('stripe_error');"); // GOOD
			// dmx.parse('stripe_error_message.setValue("Sorry, there was an error processing your card payment: ' + result.error.message + '");'); // GOOD!
		} else {
            // The payment has been processed!
			console.log('result.paymentIntent.status: ' + result.paymentIntent.status);
            if (result.paymentIntent.status === 'succeeded') {
				console.log("Payment Successful.");
                dmx.parse("flow_payment_success.run();");
                // Show a success message to your customer
                // There's a risk of the customer closing the window before callback
                // execution. Set up a webhook or plugin to listen for the
                // payment_intent.succeeded event that handles any business critical
                // post-payment actions.
            }
        }
    });
});


  </script>
Community Page
Last updated: