Difference between revisions of "Online payment system"

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
m
Tag: 2017 source edit
m
Tag: 2017 source edit
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
<!-- BEGIN origin interlang links -->
 +
<!-- You can edit this section but do NOT remove these comments
 +
    Links below will be automatically replicated on translated pages by PolyglotBot -->
 +
[[zh:在线支付系统]]
 +
<!-- END interlang links -->
 +
 
Dolibarr provide native modules to make online payments of your invoices, orders, membership, registration to events...
 
Dolibarr provide native modules to make online payments of your invoices, orders, membership, registration to events...
The native payment modules are Paypal and Stripe. But you can add you own modules to support other payment services.
+
The native payment modules are Paypal and Stripe.
 +
 
 +
From v20+, you can develop your own modules to support other payment services.
 +
 
  
For this, you must create a module ([[Module_development]]) that implement the following hooks for the context "newpayment" :
+
= Main process =
 +
For this, you must create a module ([[Module_development]]) that implement the following hooks for the context "newpayment" that will manage the following hook methods:
  
 
*doValidatePayment
 
*doValidatePayment
Line 9: Line 19:
 
*doPayment
 
*doPayment
 
*isPaymentOK
 
*isPaymentOK
 
  
 
== Hook doValidatePayment ==
 
== Hook doValidatePayment ==

Latest revision as of 15:47, 11 November 2024


Dolibarr provide native modules to make online payments of your invoices, orders, membership, registration to events... The native payment modules are Paypal and Stripe.

From v20+, you can develop your own modules to support other payment services.


Main process

For this, you must create a module (Module_development) that implement the following hooks for the context "newpayment" that will manage the following hook methods:

  • doValidatePayment
  • doCheckStatus
  • doAddButton
  • doPayment
  • isPaymentOK

Hook doValidatePayment

To return a code for your payment mode (used at different place of Application)

Hook doCheckStatus

Not usefull

Hook doAddButton

To define the button to add on the payment page /public/payments/newpayment.php

Hook doPayment

To show a form to show to make the payment. The form will be show after selecting your payment service on the page /public/payments/newpayment.php. This page must set the session variable $_SESSION['TRANSACTIONID'] (For example "YYYYMMDDHHMMSS-abc") and $_SESSION["FinalPaymentAmt"] (For example "123") and $_SESSION['currencyCodeType'] (for example "USD"). They will be used by the page called after payment /public/payment/paymentok.php

Hook isPaymentOK

to say if a payment is ok or not when entering the fallbackpage /public/payment/paymentok.php. If ok, the rest of common actions are done (payment registered, status of object modified), if not nothing is done except showing an error message.