Plugin - Stripe (Create custom order forms)

RSForm!Pro Stripe Payment Plugin
 

The RSForm!Pro Stripe Payment Integration Plugin allows you to add a new payment method to the existing Payment Package of RSForm!Pro.

This RSForm!Pro Stripe Payment Integration Plugin is commercial and needs to be purchased separately. The price of the plugin is: 15 EUR.
You can buy it by accessing Customer Area > My memberships > Active Memberships > clicking the 'Buy Extra Plugins' button of your RSForm!Pro license. Also you will have to make sure that you install the Payment Package plugin first.
 
Downloading and Installing the plugin
Download

You can download the plugin by logging with your purchase user, then head to Downloads > My Downloads > RSForm!Pro - view all plugins and modules > RSForm!Pro Files > Plugins > "Stripe Plugin for Joomla! 3.x".

Install

In the backend area go to the Extensions > Manager > Install page, and install the plugin. Next thing is to publish the plugin from Extensions > Plug-in Manager, search for the "RSForm! Pro - Stripe" plugin and publish it.

Configuring the plugin

Configuring the Stripe payment gateway can be done from Components > RSForm!Pro > Configuration > Stripe tab:

  • Secret API Key (sk_): this should be located in your Stripe account settings (more details).
  • Public Key (pk_): this should be located in your Stripe account settings (more details).
  • Tax Type: Percent (%) / Fixed Rate
  • Tax Value: Amount of tax. Total amount of the transaction must include this amount.
  • Payment Mode: Don't use tokens / Use Tokens with Stripe Elements / Use tokens with Stripe Checkout (Legacy) / Use tokens with Stripe Checkout (New)
 
Payment modes explained
Use tokens with Stripe elements

When enabled, this will include the Stripe js library which replaces your credit card fields with Stripe fields, sending all credit card data directly to Stripe instead of passing it through your server.

 
Use tokens with Stripe Checkout

If chosen, this option will redirect to a new page where users will need to fill in their credit cards details. All the data is sent to Stripe and tokenized, instead of passing through your server. There are two versions: Legacy and New

Legacy version

The legacy version will prompt new fields that needs to be filled in, such as:

  • Locale: Auto (Detected by Stripe) / Site (Joomla! language). The payment window will be displayed in the user's preferred language, if there is any available. By default, English will be used.
  • Title: Type here the title that will be displayed in the payment window.
  • Description: Add the description that will be displayed along with the title, in the payment window.
  • Image URL: A square image will be displayed representing your product/brand. You can use a relative or absolute URL and the recommended minimum size is 128x128px. The supported image types are: .gif / .jpeg / .png
  • Validate Billing ZIP Code:Yes / No. If enabled, the billing ZIP code will be validated.
  • Collect Billing Address:Yes / No. Specify whether the billing address should be collected in the payment window.
  • Collect Billing Address:Yes / No. By enabling this option, the billing address will be collected in the payment window.
  • Allow 'Remember Me':Yes / No. Include the option to remember you for future purchases by setting this option to Yes.
 
New version

The new version will prompt a set of different fields, such as:

  • Locale: Auto (Detected by Stripe) / Site (Joomla! language). The payment window will be displayed in the user's preferred language, if there is any available. By default, English will be used.
  • Collect Billing Address:Yes / No. Specify whether the billing address should be collected in the payment window.
  • Cancel URL:Type here the URL where the customer will be directed to if they decide to go back to your website. Leave this blank to default to the form page.
 

In order to update the payment status, please setup a webhook in your Stripe account for the 'checkout.session.completed' event at this URL: http://your_website/index.php?option=com_rsform&task=plugin&plugin_task=stripe.webhook


How to use the Stripe plugin

After configuring the Stripe parameters from Components > RSForm!Pro > Configuration > Stripe tab, there are some additional steps that needs to be taken in order the payment process to work properly:

Making sure the form is sent to the payment processor

The payment details will only be sent to the Stripe payment processor if the user selects Stripe from the "Choose Payment" field before submitting the form.

The "Choose Payment" field is used in order to allow the users to choose their payment method. It displays the payment methods added to the form in either a Dropdown or Radio Group. It can be shown on the form (allowing the user to select his preferred payment method) or not (forcing the user to pay using the default payment method).

If you are using a single payment method and you need to hide the Choose payment field, this can be achieved by editing the field and setting to "No" the "Show in front-end?" option within the "Attributes" tab.

In order the Stripe payment method to be available within the Choose payment field, the following payment related element has to be part of your form.

  • (Payment) Stripe - actual payment related element that will be included within the Choose Payment selection on your form.
 

Mapping form information to Stripe for card processing

There are two cases when form information needs to be mapped:

  1. When using Don't use tokens / Use Tokens with Stripe Elements options, Card details as well as Customer Email fields needs to be mapped
  2. When using Use tokens with Stripe Checkout (Legacy) / Use tokens with Stripe Checkout (New), only the Customer Email field needs to be mapped.

 

If No Tokens or Tokens with Stripe Elements options are used, in order to collect the user's card information, the following fields needs to be added in the form:

  • Card Number - a textbox field used in order the user to fill in the credit card number
  • Card Security Code (CSC) - a textbox field used in order the user to fill in the credit card security code
  • Card Expiry Month - a dropdown containing month numbers(Ex: 01 for January, 02 for February and so on).
If you want to display the month names instead of numbers you can use the pipeline structure: value|label and set up your dropdown items as in the following example: 01|January
  • Card Expiry Year - a dropdown containing years(Format: yyyy, Ex: 2016, 2017)
  • Customer Email - a textbox field where the user needs to enter his email address
 

Note: After adding the above-mentioned fields to the form, you need to go to Form Properties > Stripe Configuration tab and map the Stripe fields with the RSForm!Pro fields, in order to be populated automatically with user-supplied data.

These fields requires mapping when No Tokens are used or when using Tokens with Stripe Elements.

If one of the following options is used:

  • Use tokens with Stripe Checkout (Legacy)
  • Use tokens with Stripe Checkout (New)
... form information mapping for Card elements will no longer be required, except for the 'Customer Email' field.

 

Note: when testing Stripe, besides the fact that you'll need a testing Stripe API Key, you'll have to use a testing credit card.

 
Adding costs

In order to receive funds using RSForm!Pro and Stripe payment plugin, your form needs to include a cost. In order to add costs to your form you can use any of the following fields:

  • Single Product - Adds a single product to the form. For this type of field you can set up a caption, description and a price.
  • Multiple Products - Adds the ability to display multiple products to be purchased either in a Dropdown or a Checkbox. Its items need to be specified in the following manner: price | label (ex: 15 | T-shirt)
  • Donation - Allows the user to type in the amount to be paid inside a standard Textbox.
  • Total - This field is used alongside the Donation, Single and Multiple Products fields. It calculates the total price to be paid.
 
Modifying Stripe vars through Scripts called after form has been processed

This process is similar to the already existing example regarding the PayPal parameters control. First you will need to get a new instance of the Stripe object, which is done with:

 
    $stripe = RSFormProStripe::getInstance();
 

Then you can override parameters as follows, depending on your Stripe payment mode.

 
    //For Stripe Elements or Stripe Checkout Legacy:
    //note that this won't change the legacy popup information, instead this will be applied directly on your order
    $stripe = RSFormProStripe::getInstance();
    $stripe->args['description'] = 'This is a new description.';
 
 
    //For Stripe Checkout New:
    $stripe = RSFormProStripe::getInstance();
    $stripe->args['payment_intent_data'] = array('description' => 'my payment description here');
 
 
    //For Stripe Checkout New:
    //another example using the metadata parameter where you can add custom [token => value] to your payment.
    //in this example, "first name" or "last name" can be anything you want. 
    $stripe = RSFormProStripe::getInstance();
    $metadataArray = ["first name" => "My First Name", "last name" => "My Last Name"];
    $stripe->args['payment_intent_data'] = array('description' => 'my payment description here', 'metadata' => $metadataArray);
 

The above examples will change the description sent to the payment processor, or add some extra information. For a more detailed list of parameters available in the API you can check the developer documentation: Stripe Elements / Checkout Legacy or Stripe Checkout New.


10 persons found this article helpful.


Was this article helpful?

Yes No
Sorry about that