Online Payment Module Architecture

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search


This page describe how the modules for online payments works.

Step 1 - The choice of the payment mode

First step to make an online payment is done by calling the page /public/payment/newpayment.php

This page is common to all payment mode. It page accepts some parameters to know how to find the amount. This is a list of all possible url:

URL to offer a Stripe online payment page of any amount with no existing object:

Following URLs are available to offer a page to a customer to make a payment on Dolibarr objects:

  • URL to offer a Stripe online payment page of any amount with no existing object:


  • URL to offer a Stripe online payment page for a sales order:


  • URL to offer a Stripe online payment page for a customer invoice:


  • URL to offer a Stripe online payment page for a contract line:


  • URL to offer a Stripe online payment page for a member subscription:


  • URL to offer a Stripe online payment page for payment of a donation:


The parameter are used by the page to find the amount to ask for the payment. Then the page makes a list of all available payment mode and suggest them as a different button "Pay using XXX".

Step 2 - User choose the payment mode

When the use choose a payment mode, the same page is called but with a parameter action=dopayment. If the payment mode needs to, some information about the payment are stored into session so it will be possible to retrieve them later when falling back on the result of payment page. Among information, the variable FULLTAG contains information on the source of payment (the mode but also the object of Dolibarr the payment may be related to). It must provided to the payment system because it is required to have it in the fallback URL used once a payment has been done (see STEP 4)

Depending on the payment mode, the page may prepare the payment on the remote system. If may be API call or a redirect to another page. Then the page show the form to enter the payment information (credit card number). The page may also choose to make a redirect to another page (on remote system) that ask this information.

Step 3 - Entering payment information

When the form to enter payment information are submitted (whatever is the page that handle it), the payment system should send a redirect to the page /public/payment/paymentok.php or public/payment/paymentko.php depending on status of payment.

Step 4 - Fallback on result page

When calling the page when payment is OK, the following parameters must also be provided:

  • FULLTAG (this parameter was defined into the public/payment/newpayment.php page). With this parameter, the page paymentok.php will be able to make all complementary action like closing invoice or order or recording a subscription for a membership subscription, and more...
  • Some payment mode include also more parameters like PAYERID for Paypal. Only FULLTAG should be mandatory.

Some other parameters may be retreived in the session like:

  • $_SESSION['ipaddress']
  • $_SESSION['errormessage'] An error message to show