Shortcode Attributes / Examples

Shortcode

The Clearent Payments plugin uses WordPress shortcode to allow you to easily add payment forms to any WordPress page. The shortcode for Clearent Payments plugin is clearent_pay_form and the only required attribute is the sale amount.

The shortcode to add the payments form to your page is clearent_pay_form.

This basic shortcode . . .

[clearent_pay_form amount=”22.50″]
Produces this form . . .

Shortcode Attributes

The tables below list the attributes supported by the Clearent Payments plugin.

Amount Attributes

Shortcode attribute Default value Example Notes
amount amount=”88.50″ If amount is not provided an amount input field is shown to the user. This is ideal for amount that the user provides such as donation. When provided, the amount value must include two decimal places.
sales_tax_amount sales_tax_amount=”3.22″ Providing sales tax amount may help with qualification rates (contact Clearnent support for more information). If providing sales_tax_amount, this sales_tax_amount should not be included in the amount attribute. If NOT providing sales_tax_amount, the amount attribute should be the total to charge to card. When provided, the sales_tax_amount value must include two decimal places.

Optional Input Fields

Shortcode attribute Default value Example Notes
invoice false invoice=”true”
  • If “false”, field is not shown
  • If “true”, field is shown for user input
  • If any other value is supplied, no field is displayed but the information is sent with the transaction request and saved in the transaction log.
purchase_order false purchase_order=”12345″
email_address false email_address=”bob@email.com”
customer_id false customer_id=”7890123″
order_id false order_id=”45645656″
description false description=”true”
comments false comments=”true”

Billing Address and Shipping Address Fields

Shortcode attribute Default value Notes
billing_address false “true” to show all billing address fields (not needed if require_billing_address=true)

  • First Name
  • Last Name
  • Company
  • Address
  • Address Line 2
  • City
  • State
  • Zip
  • Country
  • Phone
require_billing_address false “true” to show and require billing address fields (Company and Address Line 2 will be optional)
shipping_address false “true” to show all shipping address fields (not needed if require_shipping_address=true)

  • First Name
  • Last Name
  • Company
  • Address
  • Address Line 2
  • City
  • State
  • Zip
  • Country
  • Phone
require_shipping_address false “true” to show and require shipping address fields (Company and Address Line 2 will be optional)

Configuring Field Labels
The text of all field labels can be changed as needed using shortcode attributes.

Shortcode attribute Default value Example
title Complete Transaction Details Below title=”Payment Details”
button_text Pay Now button_text=”Submit Payment”
amount_label Amount amount_label=”Enter donation amount”
card_label Card Number card_label=”Full Card Number”
exp_date_label Card Expiration Date exp_date_label=”Expiration Date”
csc_label Card Security Code csc_label=”Security Code on Card”
invoice_label Invoice Number invoice_label=”Invoice $”
purchase_order_label Purchase Order purchase_order_label=”Purchase Order #”
email_address_label Email Address email_address_label=”Email”
customer_id_label Customer ID customer_id_label=”Customer Number”
order_id_label Order ID order_id_label=”Order Number”
description_label Description description_label=”Transaciton Description”
comments_label Comments comments_label=”Delivery Notes”
billing_address_label Billing Address billing_address_label=”Billing Information”
billing_first_name_label First Name billing_first_name_label=”Given Name”
billing_last_name_label Last Name billing_last_name_label=”Surname”
billing_company_label Company billing_company_label=”Company Name”
billing_street_label Address billing_street_label=”Street Address”
billing_street2_label Address Line 2 billing_street2_label=”Street Address Line 2″
billing_city_label City billing_city_label=”City/Town”
billing_state_label State billing_state_label=”State/Province”
billing_zip_label Zip billing_zip_label=”Zip/Postal”
billing_country_label Country billing_country_label=”Country/Territory”
billing_phone_label Phone billing_phone_label=”Contact Phone”
shipping_address_label Shipping shipping_address_label=”Shipping Information”
billing_is_shipping_label Same as billing address billing_is_shipping_label=”Use billing address”
shipping_first_name_label First Name shipping_first_name_label=”Given Name”
shipping_last_name_label Last Name shipping_last_name_label=”Surname”
shipping_company_label Company shipping_company_label=”Company Name”
shipping_street_label Address shipping_street_label=”Street Address”
shipping_street2_label Address Line 2 shipping_street2_label=”Street Address Line 2″
shipping_city_label City shipping_city_label=”City/Town”
shipping_state_label State shipping_state_label=”State/Province”
shipping_zip_label Zip shipping_zip_label=”Zip/Postal”
shipping_country_label Country shipping_country_label=”Country/Territory”
shipping_phone_label Phone shipping_phone_label=”Contact Phone”

Miscellaneous Attributes

Shortcode Attribute Default value Notes
require_csc true Card Security Code is required by default. Setting to false makes this field input optional. The field is always displayed on screen.

Examples

Basic Fields

At a bare minimum, you must:

  • Include the clearent_pay_form shortcode.

[clearent_pay_form]

Additional Fields

It is easy to show additional fields by simply setting the desired fields attributes to true.

This code . . .

[clearent_pay_form amount=”15.25″ invoice=”true” purchase_order=”true” email_address=”true” customer_id=”true” order_id=”true” description=”true” comments=”true”]

Produces this form with the additional fields . . .


Configuring Billing Address and Shipping Address

You can set billing_address=”true” to show billing address fields or require_billing_address=”true” to show and require billing address fields (company and address line fields are optional if billing address is required).

You can set shipping_address=”true” to show shipping address fields or require_shipping_address=”true” to show and require shipping address fields (company and address line fields are optional if shipping address is required).

If both the billing and shipping address are shown, the user is given the option to use the billing address as the shipping address.

This code . . .

[clearent_pay_form amount=”15.25″ billing_address=”true” shipping_address=”true”]

Produces this form . . .


Configuring Field Labels

You can easily change the field labels to match the verbiage and requirements of your site.

This code . . .

[clearent_pay_form amount=”15.25″ exp_date_label=”Expiration Date” csc_label=”Security Code on Card” button_text=”Complete Transaction”]

Produces this form . . .

Invalid Shortcode Attributes

Setting invalid shortcode attribute can have undesirable affects. To prevent this, if you set invalid shortcode attibutes, your page will display a warning message with any invalide shortcode attributes provided.

This code . . . (with incorrectly spelled sales_tax_amount and card_label attributes)

[clearent_pay_form salse_tax_amount=”2.11″ cerd_label=”Enter full card number”]

Produces this error message . . .

So be sure to test your code!

Ready to add payment to your WordPress site? We’re here to help!