You are here: Home
Stripe payment plugins for your WordPress site
Hey alexanderfoxc,
I have a question regarding prefilling the user data using the GET method. Before the payment, I make the user fill out a form with email, phone and name info. On the payment screen, I don’t want them to reenter their name and email. So I want to send the name and email info like “site.com/payment-screen?name=John&[email protected]”
I added a few lines of code to the code you shared earlier to prefill the name and email with the GET data.
// Get the URL parameters assign variables
if (isset($_GET['NAME'])) {
$s_name = $_GET['NAME'];
} else {
$s_name = "failed to get post parameter";
}
if (isset($_GET['EMAIL'])) {
$s_email = $_GET['EMAIL'];
} else {
$s_email = "failed to get post parameter";
}
and changed the code you shared to:
public function handle_data_ready( $data ) {
$data['customer_email'] = $s_email;
$data['customer_name'] = $s_name;
return $data;
}
But it’s not working. I didn’t have high hopes anyways with my little knowledge of PHP. But I was wondering if you had a solution for this.
My next solution might be to try to auto-register the user after filling out the form so the name and email get filled from user info.
Thank you!