• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Payments Plugin for Stripe

Stripe payment plugins for your WordPress site

  • Home
  • Documentation
  • Addons
  • Login
    • Sign In
    • Edit Profile
    • Terms & Conditions
    • My Downloads
    • License Key
  • Support
    • Support Forum
    • Forum Search
    • Forum Login
    • Forum Registration
    • Email Support for Customers
  • Contact Us
  • Show Search
Hide Search
You are here: Home / Topics / Form defaults / parameters

[Resolved] Form defaults / parameters

· ·

Home › Forums › Stripe Payments Plugin › Form defaults / parameters

  • This topic has 5 replies, 5 voices, and was last updated 2 weeks, 1 day ago by mariuselz.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • December 8, 2020 at 2:17 pm #3451
    [email protected]
    Participant

    Hi guys,

    I have already read that it is currently not possible to pre-populate fields with custom or default values in the payment form … which is what is most needed on our end to have a more seamless business logic though. Especially predefine name & email, but also eg. a suggested donation value.

    It seems though like there are plans for that? Do you guys have any roadmap? I guess all that could even be a form-defaults action hook for setting default values (which could be safer than just via get params).

    Thanks!

    December 9, 2020 at 12:22 am #3453
    Admin
    Keymaster

    We should be able to add filter hooks for this. I will look into this.

    December 10, 2020 at 6:06 pm #3455
    alexanderfoxc
    Participant

    Hi.

    You can change customer name and donation amount by hooking to asp-button-output-data-ready filter.

    Here’s quick example how to change customer name: https://github.com/Arsenal21/stripe-payments-enhancements/blob/master/asp-prefill-customer-name-and-email/asp-prefill-customer-name-and-email.php

    You can change donation amount like this:

    $data['item_price'] = 10000; //amount should be in cents

    December 11, 2020 at 1:35 pm #3462
    [email protected]
    Participant

    Excellent, Alexander – this is basically exactly what I was looking for. Cheers guys!

    February 11, 2021 at 10:09 pm #3619
    canerk
    Participant

    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!

    May 3, 2025 at 7:12 pm #5488
    mariuselz
    Participant

    Hello Alexander,

    How can this asp-prefill-customer-name-and-email be used exactly? I’m not sure I understand sorry.

    Best,
    Marius

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Log In

Primary Sidebar

Featured Addons and Extensions

  • Subscription Payments Addon
  • Additional Custom Fields
  • Secure Downloads Addon
  • Apple Pay, Google Pay, Afterpay

Addon Bundle

Stripe Payments Addon Bundle

A Simple & Lightweight Plugin

Our Philosophy with the Plugin

Support Links

  • Support Forum
  • Support Contact

Search

Copyright © 2025 | Stripe Plugins | A member of the Tips and Tricks HQ family.