• Resolved gerem

    (@gerem)


    Hello,

    I see that we can prefill email and name of the user on the stripe popup.
    How can we do that ? with asp_additional_stripe_checkout_data_parameters ?

    I a using the shortcode : [asp_product id=”479″]

    thanks a lot for your help ??

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Contributor Alexander C.

    (@alexanderfoxc)

    Hi.

    You can use asp-button-output-data-ready filter for that. Here’s code example how you can do it:

    add_filter('asp-button-output-data-ready', 'my_very_special_data_ready_handler', 10, 2);
    
    function my_very_special_data_ready_handler($data, $not_used) {
        // do your thing here. You can set customer email and name like this:
    $data['customer_email'] = '[email protected]';
    $data['customer_name'] = 'John Doe';
    return $data;
    }

    You can var_dump($data) from inside the hook handler function to see what data is available. For example, you can get product id via $data[‘product_id’] and so on.

    Keep in mind customer name and email prefilling are currently only available in testing version. This version should be released as stable shortly (within 12 hours from now or so). So either get a testing version or wait until stable is released.

    Thread Starter gerem

    (@gerem)

    Thank you so much !
    I am not using testing version that why I guess.
    I will wait for the stable one.
    Thank you for the piece of code !

    Plugin Contributor Alexander C.

    (@alexanderfoxc)

    New version has been released (2.0.3).

    Let me know if this works how you want it.

    Thread Starter gerem

    (@gerem)

    Hello Alexander,

    It’s still not working.

    I have a page which show the shortcode : [asp_product id=”479″]
    I have this code in my function.php :

    
    add_filter('asp-button-output-data-ready', 'add_data_ready_handler', 10, 2);
    
    function add_data_ready_handler($data, $not_used) {
        // do your thing here. You can set customer email and name like this:
    $data['customer_email'] = '[email protected]';
    $data['customer_name'] = 'John Doe';
    return $data;
    }
    

    And the fill is empty…

    What i am doing wrong ?

    Plugin version 2.0.3

    Thread Starter gerem

    (@gerem)

    I think that the hook doesn’t work…

    Before i am using hook : asp_stripe_payment_completed

    with the new version 2.0.3, it is not trigger…

    maybe that’s why the hook : asp-button-output-data-ready not working too.

    Plugin Contributor Alexander C.

    (@alexanderfoxc)

    functions.php is not a good place to put this code since new API popup isn’t triggering most of theme-related stuff.

    Check this code https://github.com/erommel/stripe-payments-enhancements/blob/0.0.1/asp-prefill-customer-name-and-email/asp-prefill-customer-name-and-email.php

    You can also install this small example plugin and modify it per your needs

    https://github.com/erommel/stripe-payments-enhancements/releases/download/0.0.1/asp-prefill-customer-name-and-email.zip

    Thread Starter gerem

    (@gerem)

    Ok thanks for your plugin it is working great with taht.

    But another question about your last answer : “functions.php is not a good place to put this code since new API popup isn’t triggering most of theme-related stuff.”

    asp_stripe_payment_completed is not trigger too, so where can i put this code to execute stuff when the payment was success ?

    Thanks a lot ??

    Plugin Contributor Alexander C.

    (@alexanderfoxc)

    Put it in the same plugin. In __construct() function add another add_action for the hook you want. E.g:

    add_action( 'asp_stripe_payment_completed', array( $this, 'handle_payment_completed' ), 10, 2 );

    Then add function that processes it to the same class, just after handle_data_ready() function. E.g:

    function handle_payment_completed($data, $charge) {
    //do your thing
    }
    • This reply was modified 5 years, 6 months ago by Alexander C.. Reason: typos fixed
    Thread Starter gerem

    (@gerem)

    Ok now it is working great ! thank you so much !

    Plugin Contributor Alexander C.

    (@alexanderfoxc)

    Glad it’s working for you ??

    Hi,

    I’m using this plugin. It’s going well when user checkout. But I can’t get “customer email” in Stripe dashboard. It put in Card Name.

    If Card address is active, I can’t find “customer email” any where. So if you know how it put in customer email, please advise me.

    Plugin Contributor Alexander C.

    (@alexanderfoxc)

    Hi.

    Please create a new topic and make sure to fill in “Link to the page you need help with” so we can assist you.

    Thanks Alexander C.

    I’ll make new topic.

    What do I fill in “Link to the page you need help with”? I didn’t know about this forum.

    • This reply was modified 5 years, 5 months ago by mitsunobuk.
    Plugin Contributor Alexander C.

    (@alexanderfoxc)

    You should enter webpage URL where your payment button is.

    To Alexander C,

    OK, thank you. I’ll make new topic.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Prefill customer email and name in stripe popup’ is closed to new replies.