1. Home
  2. WP Simple Pay Pro 2.5 & Lite 1.6
  3. Custom Amount Shortcode (Pro 2.5)

Custom Amount Shortcode (Pro 2.5)

In order to allow a user to enter any amount instead of charging a pre-determined amount you will need to use the [stripe_amount] shortcode. Examples of using a custom amount (or user entered amount) with our Subscriptions add-on found here.

Note: You will need to include the shortcode inside of the [stripe][/stripe] shortcode block. This will attach the custom amount entry to that specific form.

Shortcode Options

Available options/shortcode attributes:

  • label – The label before the input box.
  • placeholder – Text appearing inside the field before a user enters anything to give the visitor an idea of what type of data to enter..
  • default -Default value to assign to the field. This value should include a decimal if your currency supports it, which is different than the amount attribute. Default values will be submitted unless the user changes it.

Note: Charge amounts must meet a minimum requirement (such as 50 cents USD) to be allowed by Stripe. See the minimum charge for various currencies.

Shortcode Examples

Basic amount input with a label:

[stripe name="My Store" description="My Product"]
[stripe_amount label="Donation Amount:"]
[/stripe]

Amount input with a label and a default of 500 currency units (i.e. $5.00 USD):

[stripe name="My Store" description="My Product"]
[stripe_amount label="Donation Amount:" default="500"]
[/stripe]

Basic amount input using Japanese Yen:

[stripe name="My Store" description="My Product" currency="JPY"]
[stripe_amount label="Donation Amount:"]
[/stripe]

User Entered Amount with Subscription Toggle

Note: Subscription capabilities are included with Business and Elite licenses only.

You can now add a toggle for the User Entered Amount shortcode to work with the Subscriptions Add-on. This will give the option to the user to pay a one time fee for the amount they choose or make it a recurring fee. Let’s look at an example.

[stripe name="My Store" description="My Product"]
[stripe_checkbox sub_toggle="true" label="Make this a recurring amount"]
[stripe_amount]
[stripe_subscription][/stripe_subscription]
[/stripe]

This will create a form that looks like this:

This is the simplest example just to show off just this feature alone but you can do more with it as long as these criteria are met:

1. Use a [stripe_checkbox] shortcode with an attribute of sub_toggle.
2. Have [stripe_amount] present.
3. Have [stripe_subscription] present.

The subscription will take on any properties of the subscription shortcode. For example if want to change the length of the subscription you could add this in:

[stripe name="My Store" description="My Product"]
[stripe_checkbox sub_toggle="true" label="Make this a recurring amount"]
[stripe_amount]
[stripe_subscription interval="day"][/stripe_subscription]
[/stripe]

Note the use of the interval attribute. This will make the optional subscription take this on and make the payment a daily recurrence if the user selects to
make it a subscription.

Updated on November 19, 2018

Was this article helpful?

Related Articles