Community Documentation

Payment execution workflow

Last updated October 9, 2012. Created by Xano on October 9, 2012.
Log in to edit this page.

Summary

  1. A context (a module that requires payments to be processed, such as a webshop) creates a blank payment and configures it.
  2. It displays a payment form (based on the form provided by Payment) that allows the user to select a payment method for the payment.
  3. The context then executes the payment and by doing so, gives Payment full control over the payment and the request.
  4. Payment uses the selected payment method to validate and execute the payment. The payment method receives full control over the request, which means it is allowed to redirect the user off-site, for instance.
  5. Once payment execution is completed, the payment method hands over full control back to the context by calling Payment::finish(). The context can then redirect the user back to where he came from, or show a confirmation.

Detailed workflow

(click to enlarge)

The entire workflow consists of four stages. In each stage a certain module has full control over the request, meaning it is allowed to stop PHP execution by redirecting the user, for instance. This means that if you are creating a context or payment method controller, you should have performed all necessary tasks before initiating the next stage (Contexts initiate stage 2 by calling Payment::execute() and payment method controllers initiate stage 4 by calling Payment::finish()).

AttachmentSize
payment_diagram_payment_execution.png86.39 KB
payment_diagram_payment_execution_thumb.png26.32 KB

About this page

Drupal version
Drupal 7.x
Audience
Programmers, Site administrators, Site builders
Level
Intermediate

Site Building Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here