• Resolved pitfallindimate3746

    (@pitfallindimate3746)


    Hello,

    How to pass an amount to a shortcode from my PHP? I just need to provide an user with a payment amount that is computed in my PHP.

    The second question is how to pass an email address to the Stripe payment popup window?

    My user already provided their email, so I would like to just pass it to the plugin preferably in such a way that it is disabled for change in the popup window.

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

    (@alexanderfoxc)

    Hi @pitfallindimate3746.

    It’s not currently possible to achieve that in current plugin version, but could be implemented in the upcoming version if you can describe your usage case a bit more.

    I guess there is no reason to hardcode email value in shortcode parameter (unless your code dynamically generates shortcodes?). If you’re familiar with hooks (e.g. do_action()), I can add email parameter to the data for the hook that is fired before the button is displayed and you can use it to set your user’s email in the runtime.

    Thread Starter pitfallindimate3746

    (@pitfallindimate3746)

    My usage case is such:

    A shop owner has a cockpit page where they use a form to type an email address of a client and a price.

    Then an email is sent to the client with a link to a payment page.

    When the client enters the payment page, there should be a Pay Now button with embedded their email address and the price (all that was previously set up by the shop owner).

    Plugin Contributor Alexander C.

    (@alexanderfoxc)

    Understood. Then, a shortcode parameter for the button (something like customer_email=”[email protected]” should do it.

    This option will be added in the upcoming version 1.7.9 (which is coming shortly, within 1-2 days).

    Thread Starter pitfallindimate3746

    (@pitfallindimate3746)

    Great, can you just suggest to me where to find a manual for dynamic changing of shortcode parameters, in other words to put my own data dynamically to parameters instead of static hard-coded ones.

    Plugin Contributor Alexander C.

    (@alexanderfoxc)

    If you’re familiar with WP hooks and filters, there is a hook fired that contains almost all the data used to display payment button:

    $data = apply_filters( ‘asp-button-output-data-ready’, $data, $atts );

    If you hook to this filter, $data contains almost everything you need. Just var_dump($data) in your filter handler function to see what’s available.

    Currently, it doesn’t have customer_email parameter in it, it will be added in the upcoming version.

    Or, like I said earlier, the upcoming version will have customer_email shortcode parameter and you can dynamically generate your payment button something like that:

    echo do_shortcode('[accept_stripe_payment name="Payment for your order" button_text="Pay Now" amount="'.$amount.'" customer_email="'.$customer_email.'"]');

    Thread Starter pitfallindimate3746

    (@pitfallindimate3746)

    It works (just “price” instead of “amount”).

    Waiting for the upgrade, thanks a lot.

    Plugin Contributor Alexander C.

    (@alexanderfoxc)

    The new version has been released. I’m marking this topic as “resolved”. If you have any issues related to implemented functionality, please do post them here.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to pass an amount and email address’ is closed to new replies.