SlideShare une entreprise Scribd logo
1  sur  23
Anatomy of payment
systems in Drupal 8
Oleg Natalushko http://drupal.org/u/niko
Plan
• Current status of payments in Drupal 8.
• Common developers mistakes.
• Drupal commerce 2.x payment
• Payment
• Payment offsite API
About me
• More than 100 implemented drupal projects.
• 15 years experience Backend developer
• 5 years experience Drupal developer
• Maintainer of commerce interkassa
• Maintainer of Payment platon
• Maintainer of commerce probokassa
• Maintainer of Payment offsite API
Payment types.
• Payment emulation
• On site
• Off site
Drupal payment contrib.
Drupal 7
• Drupal commerce 1.x
• Payment
• Payment Gateway API
Drupal 8
• Drupal Commerce 2.x
• Payment
• Payment offsite API
W3C PAYMENT REQUEST API
SPECIFICATION
• Payment Request API
• Basic Card Payment
• Payment Method Identifiers
https://www.w3.org/TR/payment-request/
Payment
workflow
Real payment workflow
Real payment workflow
(Drupal developer think)
Checkout Payment system IPN call* Result page
Known contrib issues
• Partitional payment not supported
• Support only one payment instance per payment module
• Not fixed result pages
• Success URL: checkout/ORDER_ID/payment/return/ORDER_PAYMENT_REDIRECT_KEY
• Fail URL: checkout/ORDER_ID/payment/back/ORDER_PAYMENT_REDIRECT_KEY
• Payment transaction created only on success
• Send order ID to payment system
• Custom result urls used
Drupal commerce 2.x plan
- The payment gateway config entity + UI
- The payment gateway plugin type
- The payment type YAML plugin
- The credit_card payment type
- The payment method content entity (for storing tokenized payment
information), which uses the payment types as bundles
- The payment content entity, which uses payment types as bundles
A payment would have a workflow:
New -> Pending -> Complete -> Cancelled | (Partially) Refunded.
https://www.drupal.org/node/2711013
Payment method configuration
Payment method configuration
Payment module
•Config, Schema and Plugin
•Implement PaymentMethodConfigurationBase
• processBuildConfigurationForm() including tabs
magic
• defaultConfiguration()
• buildConfigurationForm()
• validateConfigurationForm()
• submitConfigurationForm()
• Status Selector (5 methods)
Payment Offsite API module
•Config, Schema, Plugin
•Implement PaymentMethodConfigurationBaseOffsite
• processBuildConfigurationForm()
• validateConfigurationForm()
• submitConfigurationForm()
• defaultConfiguration()
Payment form
Payment form
Payment module requirements
•Implement Routing
•Implement Redirect form controller (with
cleanup)
•Implement Access controller
•Implement signature generator
•Implement is configured checker
•Auto submit library
• Implement Operation provider (configuration
loader) getPaymentMethodConfiguration()
• Implement payment method deriver
getDerivativeDefinitions()
Payment Offsite API module
PaymentMethod plugin
•Extend PaymentMethodBaseOffsite or
PaymentMethodOffsiteSimple
•Implement
• paymentForm()
• isConfigured()
• getSignature() (simple)
•Use $this->addPaymentFormData()
•Use $this->generateForm()
•Configure auto submit via UI
Payment result pages
Payment
system
IPN
callback
Call Result
pages callback
Success page
Pending page
Fail page
Hidden fallback call
(optional)
Payment result pages
Payment module requirements
•Implement
• Routing
• Result pages controller
• Access controller
•Fallback support (optional)
Payment Offsite API module
PaymentMethod plugin
•Implement
• getResultPages()
• get<Result>Content()
• getSignature() (simple)
•Fallback call supports per result
page using getResultPages()
Payment IPN callback
Payment
system
IPN callback
Call IPN
Access check
Call IPN
Validate
Call IPN
Execute
Set order
internal status
according to
status mapping
Payment method plugin + configuration
Payment IPN callback
Payment module require
Implement
•Routing
•IPN controller
•IPN validator
•Access controller
Payment Offsite API module
Implement in PaymentMethod plugin
•ipnExecute()
•ipnValidate()
Also you could extend PaymentMethodOffsiteSimple and use
•validateEmpty()
•validateRequiredKeys()
•validateMerchant()
•validateSignature()
•validateTransactionId()
•validateAmount()
You must implement if going to use default validators:
•getMerchantIdName()
•getTransactionIdName()
•getAmountName()
•getSignatureName()
•getRequiredKeys()
Payment offsite API Interface
interface PaymentMethodOffsiteInterface {
public function ipnExecute();
public function ipnValidate();
public function getResultPages();
public function paymentForm();
public function isConfigured();
}
Payment offsite API
Simple Interface
interface PaymentMethodOffsiteSimpleInterface extends PaymentMethodOffsiteInterface {
const SIGN_IN = 'IN';
const SIGN_OUT = 'OUT';
public function getSignature($signature_type = self::SIGN_IN);
public function getMerchantIdName();
public function getTransactionIdName();
public function getAmountName();
public function getSignatureName();
public function getRequiredKeys();
}
Payment offsite API
• Fully compatible with Payment module
• Fallback mode support
• Multiple payment instances support
• Simplify payment method creation
• IPN and result pages callbacks
• Payment form
@Todo provide integration to commerce_payment
@see https://www.drupal.org/sandbox/niko/2685859
Thank you
Oleg Natalushko
Site: http://bighameleon.com
Skype: onatalushko
Phone: +380674176171
Drupal.org: https://www.drupal.org/u/niko

Contenu connexe

En vedette

Formularios en Drupal 8
Formularios en Drupal 8Formularios en Drupal 8
Formularios en Drupal 8
Atenea tech
 
Cisco connect jabber client update
Cisco connect   jabber client updateCisco connect   jabber client update
Cisco connect jabber client update
Vitor Costa
 
Virtual Meeting Options - Adobe Connect Vs. Cisco WebEx - Final 1
Virtual Meeting Options - Adobe Connect Vs. Cisco WebEx - Final 1Virtual Meeting Options - Adobe Connect Vs. Cisco WebEx - Final 1
Virtual Meeting Options - Adobe Connect Vs. Cisco WebEx - Final 1
Clayton Boessen
 
Lesson 3 Sentence Expansion
Lesson 3   Sentence ExpansionLesson 3   Sentence Expansion
Lesson 3 Sentence Expansion
bsimoneaux
 

En vedette (20)

Julgamento de eichmann autoria mediata e tribunal de exceção uma análise jurí...
Julgamento de eichmann autoria mediata e tribunal de exceção uma análise jurí...Julgamento de eichmann autoria mediata e tribunal de exceção uma análise jurí...
Julgamento de eichmann autoria mediata e tribunal de exceção uma análise jurí...
 
Custom entities in d8
Custom entities in d8Custom entities in d8
Custom entities in d8
 
Formularios en Drupal 8
Formularios en Drupal 8Formularios en Drupal 8
Formularios en Drupal 8
 
Entidades en drupal 8
Entidades en drupal 8Entidades en drupal 8
Entidades en drupal 8
 
Open Source CMS TYPO3 at Cisco WebEx
Open Source CMS TYPO3 at Cisco WebExOpen Source CMS TYPO3 at Cisco WebEx
Open Source CMS TYPO3 at Cisco WebEx
 
9 - GMRC-DREWBERRY - WB_WR_Management_meeting-Sep-16
9 - GMRC-DREWBERRY - WB_WR_Management_meeting-Sep-169 - GMRC-DREWBERRY - WB_WR_Management_meeting-Sep-16
9 - GMRC-DREWBERRY - WB_WR_Management_meeting-Sep-16
 
Open Source CMS TYPO3 at Cisco WebEx
Open Source CMS TYPO3 at Cisco WebExOpen Source CMS TYPO3 at Cisco WebEx
Open Source CMS TYPO3 at Cisco WebEx
 
Virgin Media Case Study - WebEx
Virgin Media Case Study - WebEx Virgin Media Case Study - WebEx
Virgin Media Case Study - WebEx
 
Cisco connect jabber client update
Cisco connect   jabber client updateCisco connect   jabber client update
Cisco connect jabber client update
 
Cisco WebEx vulnerability: it’s a kind of magic
Cisco WebEx vulnerability: it’s a kind of magicCisco WebEx vulnerability: it’s a kind of magic
Cisco WebEx vulnerability: it’s a kind of magic
 
Tesco Case Study - WebEx
Tesco Case Study - WebEx Tesco Case Study - WebEx
Tesco Case Study - WebEx
 
Virtual Meeting Options - Adobe Connect Vs. Cisco WebEx - Final 1
Virtual Meeting Options - Adobe Connect Vs. Cisco WebEx - Final 1Virtual Meeting Options - Adobe Connect Vs. Cisco WebEx - Final 1
Virtual Meeting Options - Adobe Connect Vs. Cisco WebEx - Final 1
 
Gotomeeting vs Webex: Comprehensive Analysis
Gotomeeting vs Webex: Comprehensive AnalysisGotomeeting vs Webex: Comprehensive Analysis
Gotomeeting vs Webex: Comprehensive Analysis
 
Social Media Assessment Case Study Citrix Webex
Social Media Assessment Case Study Citrix WebexSocial Media Assessment Case Study Citrix Webex
Social Media Assessment Case Study Citrix Webex
 
Zoom.us Vs WebEx Vs GotoMeeting
Zoom.us Vs WebEx Vs GotoMeetingZoom.us Vs WebEx Vs GotoMeeting
Zoom.us Vs WebEx Vs GotoMeeting
 
Lesson 3 Sentence Expansion
Lesson 3   Sentence ExpansionLesson 3   Sentence Expansion
Lesson 3 Sentence Expansion
 
Drupal 8 & Commerce 2.x insights
Drupal 8 & Commerce 2.x insightsDrupal 8 & Commerce 2.x insights
Drupal 8 & Commerce 2.x insights
 
Troubleshooting Urouter Problems: WebEx Presentation
Troubleshooting Urouter Problems: WebEx PresentationTroubleshooting Urouter Problems: WebEx Presentation
Troubleshooting Urouter Problems: WebEx Presentation
 
Cisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store DesignCisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store Design
 
Expansion strategies
Expansion strategiesExpansion strategies
Expansion strategies
 

Similaire à Anatomy of payment systems in Drupal 8

Redesigning PayPal APIs for Scale and Simplicity - QCon San Francisco 2013
Redesigning PayPal APIs for Scale and Simplicity - QCon San Francisco 2013Redesigning PayPal APIs for Scale and Simplicity - QCon San Francisco 2013
Redesigning PayPal APIs for Scale and Simplicity - QCon San Francisco 2013
Deepak Nadig
 

Similaire à Anatomy of payment systems in Drupal 8 (20)

Show me the money
Show me the moneyShow me the money
Show me the money
 
How to implement payment gateway integration for non-credit card on Magento2
How to implement payment gateway integration for non-credit card on Magento2How to implement payment gateway integration for non-credit card on Magento2
How to implement payment gateway integration for non-credit card on Magento2
 
Introduction to Angular JS
Introduction to Angular JSIntroduction to Angular JS
Introduction to Angular JS
 
March 2015: Plugins Worth Paying For
March 2015: Plugins Worth Paying ForMarch 2015: Plugins Worth Paying For
March 2015: Plugins Worth Paying For
 
Magento Payment & Vault framework
Magento Payment & Vault frameworkMagento Payment & Vault framework
Magento Payment & Vault framework
 
Spring batch
Spring batchSpring batch
Spring batch
 
Dancing with websocket
Dancing with websocketDancing with websocket
Dancing with websocket
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)
 
Redesigning PayPal APIs for Scale and Simplicity - QCon San Francisco 2013
Redesigning PayPal APIs for Scale and Simplicity - QCon San Francisco 2013Redesigning PayPal APIs for Scale and Simplicity - QCon San Francisco 2013
Redesigning PayPal APIs for Scale and Simplicity - QCon San Francisco 2013
 
Payments using Stripe.com
Payments using Stripe.comPayments using Stripe.com
Payments using Stripe.com
 
Client-side Auth with Ember.js
Client-side Auth with Ember.jsClient-side Auth with Ember.js
Client-side Auth with Ember.js
 
Single Page Apps with Drupal 8
Single Page Apps with Drupal 8Single Page Apps with Drupal 8
Single Page Apps with Drupal 8
 
SPUnite17 Timer Jobs Event Handlers
SPUnite17 Timer Jobs Event HandlersSPUnite17 Timer Jobs Event Handlers
SPUnite17 Timer Jobs Event Handlers
 
ASP.NET MVC 2.0
ASP.NET MVC 2.0ASP.NET MVC 2.0
ASP.NET MVC 2.0
 
Harness SharePoint and jQuery to Make Dynamic Displays and Applications
 Harness SharePoint and jQuery to Make Dynamic Displays and Applications Harness SharePoint and jQuery to Make Dynamic Displays and Applications
Harness SharePoint and jQuery to Make Dynamic Displays and Applications
 
Asp.net mvc 6 with sql server 2014
Asp.net mvc 6 with sql server 2014Asp.net mvc 6 with sql server 2014
Asp.net mvc 6 with sql server 2014
 
Play Framework workshop: full stack java web app
Play Framework workshop: full stack java web appPlay Framework workshop: full stack java web app
Play Framework workshop: full stack java web app
 
Process Orchestration with Flowable and Spring Boot
Process Orchestration with Flowable and Spring BootProcess Orchestration with Flowable and Spring Boot
Process Orchestration with Flowable and Spring Boot
 
IBM Licensing: Technical fundamentals for discovery
IBM Licensing: Technical fundamentals for discoveryIBM Licensing: Technical fundamentals for discovery
IBM Licensing: Technical fundamentals for discovery
 
Automating your php infrastructure with the zend server api
Automating your php infrastructure with the zend server apiAutomating your php infrastructure with the zend server api
Automating your php infrastructure with the zend server api
 

Dernier

➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
nirzagarg
 
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
JOHNBEBONYAP1
 

Dernier (20)

20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 

Anatomy of payment systems in Drupal 8

  • 1. Anatomy of payment systems in Drupal 8 Oleg Natalushko http://drupal.org/u/niko
  • 2. Plan • Current status of payments in Drupal 8. • Common developers mistakes. • Drupal commerce 2.x payment • Payment • Payment offsite API
  • 3. About me • More than 100 implemented drupal projects. • 15 years experience Backend developer • 5 years experience Drupal developer • Maintainer of commerce interkassa • Maintainer of Payment platon • Maintainer of commerce probokassa • Maintainer of Payment offsite API
  • 4. Payment types. • Payment emulation • On site • Off site
  • 5. Drupal payment contrib. Drupal 7 • Drupal commerce 1.x • Payment • Payment Gateway API Drupal 8 • Drupal Commerce 2.x • Payment • Payment offsite API
  • 6. W3C PAYMENT REQUEST API SPECIFICATION • Payment Request API • Basic Card Payment • Payment Method Identifiers https://www.w3.org/TR/payment-request/
  • 9. Real payment workflow (Drupal developer think) Checkout Payment system IPN call* Result page
  • 10. Known contrib issues • Partitional payment not supported • Support only one payment instance per payment module • Not fixed result pages • Success URL: checkout/ORDER_ID/payment/return/ORDER_PAYMENT_REDIRECT_KEY • Fail URL: checkout/ORDER_ID/payment/back/ORDER_PAYMENT_REDIRECT_KEY • Payment transaction created only on success • Send order ID to payment system • Custom result urls used
  • 11. Drupal commerce 2.x plan - The payment gateway config entity + UI - The payment gateway plugin type - The payment type YAML plugin - The credit_card payment type - The payment method content entity (for storing tokenized payment information), which uses the payment types as bundles - The payment content entity, which uses payment types as bundles A payment would have a workflow: New -> Pending -> Complete -> Cancelled | (Partially) Refunded. https://www.drupal.org/node/2711013
  • 13. Payment method configuration Payment module •Config, Schema and Plugin •Implement PaymentMethodConfigurationBase • processBuildConfigurationForm() including tabs magic • defaultConfiguration() • buildConfigurationForm() • validateConfigurationForm() • submitConfigurationForm() • Status Selector (5 methods) Payment Offsite API module •Config, Schema, Plugin •Implement PaymentMethodConfigurationBaseOffsite • processBuildConfigurationForm() • validateConfigurationForm() • submitConfigurationForm() • defaultConfiguration()
  • 15. Payment form Payment module requirements •Implement Routing •Implement Redirect form controller (with cleanup) •Implement Access controller •Implement signature generator •Implement is configured checker •Auto submit library • Implement Operation provider (configuration loader) getPaymentMethodConfiguration() • Implement payment method deriver getDerivativeDefinitions() Payment Offsite API module PaymentMethod plugin •Extend PaymentMethodBaseOffsite or PaymentMethodOffsiteSimple •Implement • paymentForm() • isConfigured() • getSignature() (simple) •Use $this->addPaymentFormData() •Use $this->generateForm() •Configure auto submit via UI
  • 16. Payment result pages Payment system IPN callback Call Result pages callback Success page Pending page Fail page Hidden fallback call (optional)
  • 17. Payment result pages Payment module requirements •Implement • Routing • Result pages controller • Access controller •Fallback support (optional) Payment Offsite API module PaymentMethod plugin •Implement • getResultPages() • get<Result>Content() • getSignature() (simple) •Fallback call supports per result page using getResultPages()
  • 18. Payment IPN callback Payment system IPN callback Call IPN Access check Call IPN Validate Call IPN Execute Set order internal status according to status mapping Payment method plugin + configuration
  • 19. Payment IPN callback Payment module require Implement •Routing •IPN controller •IPN validator •Access controller Payment Offsite API module Implement in PaymentMethod plugin •ipnExecute() •ipnValidate() Also you could extend PaymentMethodOffsiteSimple and use •validateEmpty() •validateRequiredKeys() •validateMerchant() •validateSignature() •validateTransactionId() •validateAmount() You must implement if going to use default validators: •getMerchantIdName() •getTransactionIdName() •getAmountName() •getSignatureName() •getRequiredKeys()
  • 20. Payment offsite API Interface interface PaymentMethodOffsiteInterface { public function ipnExecute(); public function ipnValidate(); public function getResultPages(); public function paymentForm(); public function isConfigured(); }
  • 21. Payment offsite API Simple Interface interface PaymentMethodOffsiteSimpleInterface extends PaymentMethodOffsiteInterface { const SIGN_IN = 'IN'; const SIGN_OUT = 'OUT'; public function getSignature($signature_type = self::SIGN_IN); public function getMerchantIdName(); public function getTransactionIdName(); public function getAmountName(); public function getSignatureName(); public function getRequiredKeys(); }
  • 22. Payment offsite API • Fully compatible with Payment module • Fallback mode support • Multiple payment instances support • Simplify payment method creation • IPN and result pages callbacks • Payment form @Todo provide integration to commerce_payment @see https://www.drupal.org/sandbox/niko/2685859
  • 23. Thank you Oleg Natalushko Site: http://bighameleon.com Skype: onatalushko Phone: +380674176171 Drupal.org: https://www.drupal.org/u/niko

Notes de l'éditeur

  1. Checkout/payment screenshot to explain what is payment type plugin
  2. All 3 routines are processed with method plugin configured with config from configuration plugin