Passing the payment amount to one-time payment forms

Would you like to pass the payment amount to forms in a URL parameter?

What is the use case?

Imagine a one-time payment form where the payment amount can be entered by the client.

If you’d like to set the initial payment amount by passing an URL parameter, like on the screenshot below, then this article is for you: WP Full Stripe - Payment amount passed as URL parameter

How to implement it

If you’d like to set the initial payment amount of your one-time payment form via an URL parameter, then you have to do the following:

  1. Set the “Payment Type” option to “Custom Amount” on the “Payment” tab of the form.
  2. Pass the payment amount in the wpfsAmount URL parameter.
  3. Implement a Wordpress filter that processes the URL parameter.
    (Default implementation provided below)

The following subsections explain these steps in detail.

1) Set the “Payment Type” option to “Custom Amount”

You can set the “Payment Type” option to “Custom Amount” on the “Payment” tab of the form: WP Full Stripe - Payment Type set to Custom Amount

2) Pass amount in the wpfsAmount URL parameter

You have to pass the payment amount in the wpfsAmount parameter, like this (you can try it): https://demo.paymentsplugin.com/settle-invoices-inline/?wpfsAmount=4999

The payment amount must be specified the smallest unit for the currency.
For $10.00 enter 1000, for ¥10 enter 10.

3) Implement a Wordpress filter to process the URL parameter

For the sake of security, the plugin doesn’t let anyone set the payment amount without your consent.

You can give consent by implementing a short piece of code to approve the amount in the form of a Wordpress filter. The code needs to be added to the functions.php file of your active Wordpress theme.

This is the default implementation:

You can customize the code depending on your needs. For example, you can limit the payment amount based on form name and amount range:

Still not finding the solution?

Our support team is happy to help you.

Contact support

Feature requests are always welcome!
We consider each feature request carefully, and examine how it fits the roadmap for the plugin.