Advanced Payment API in Prestashop

October 1, 2015 Alex Simonchik Prestashop
Advanced Payment API in Prestashop

I have found an interested comment in Trello about Advanced Payment API in Prestashop and want to share it with our readers.

Standard payment modules in PrestaShop register the displayPayment hook and return HTML from this hook, which makes it very hard to keep only one “Order Confirmation” button on the last page of the checkout.

In order to be compliant with the stricter of EU regulations, a new, parallel payment API was introduced, called Advanced Payment API.

Payment modules complying with the Advanced Payment API register the advancedPaymentOptions hook.

From the advancedPaymentOptions hook, modules MUST RETURN an ARRAY of zero, one, or more instances of Core_Business_Payment_PaymentOption:

When checking out an order, if the PS_ADVANCED_PAYMENT_API configuration value is set, the PrestaShop core MUST only use payment methods from advancedPaymentOptions and not even call displayPayment.

When checking out an order, if the PS_ADVANCED_PAYMENT_API configuration value is set, there must be on the last step of the checkout process:

  • a list of available payment options that can be selected but do NOT trigger an action by the simple fact of being selected
  • only ONE button that confirms the order (disabled unless the T&C checkbox is checked)

When PS_ADVANCED_PAYMENT_API is disabled, the old process is used, and ONLY the displayPayment hook is called.

Please do not implement the $form option, which is a bit flaky and might be removed from the API.



Post a new comment

top
BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *