You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Difference between revisions of "Fundraising/Data and flow/PSP integrations/Adyen Checkout"

From Wikitech-static
Jump to navigation Jump to search
imported>Ejegg
m (→‎Payment Methods: Fix image wrapping)
imported>Cstone
Line 4: Line 4:
| payment_methods = Credit Card, iDEAL, Apple Pay
| payment_methods = Credit Card, iDEAL, Apple Pay
| countries = FR
| countries = FR
| console =  
| documentation = https://docs.adyen.com/online-payments/web-components/integrated-before-5-0-0
| test_console = https://ca-test.adyen.com/ca/ca/login.shtml
| contact =  
| contact =  
}}
}}
Line 21: Line 22:
=== Credit Cards ===
=== Credit Cards ===
=== iDEAL ===
=== iDEAL ===
User flow
iDEAL is bank transfer payment method only available in the Netherlands (payment_method=rtbt&country=NL).


Available with payment_method=rtbt&country=NL
The supported banking systems can be down so Adyen handles creating the list of available banks (referred to as issuers by Adyen) which we get by calling getPaymentMethods.
The Checkout UI has a dropdown of available banks. This is gotten with an api call to get available payment methods
 
The donor chooses a bank and is then redirected to their bank's website to complete the donation.
 
When that is complete they are redirected to our thank you page.
{| class="wikitable"
{| class="wikitable"
|+
|+
![[File:Idealexample.png|left|frameless]]
![[File:Idealexample.png|left|frameless|List of available banks (issuers)|alt=List of available banks (issuers)]]
![[File:Idealredirectexample.png|frameless|400x400px]]
![[File:Idealredirectexample.png|frameless|400x400px]]
|-
!List of available banks (issuers)
!Example redirect to donors bank
|}
|}
==== iDEAL Recurring ====
iDEAL recurring has a unique flow as Adyen sends the recurring token on an IPN after the donor finishes the transaction.
From the donor's perspective the flow is exactly the same as a one time donation but on our end we don't complete the donation until we get a RECURRING_CONTRACT IPN that has the recurring token on it.
RECURRING_CONTRACT IPNs are set for every new recurring so we filter out just the iDEAL recurrings, find the matching pending database entry, add the recurring token to the message and send it to the donations queue.


=== Apple Pay ===
=== Apple Pay ===
* Implemented using https://docs.adyen.com/payment-methods/apple-pay/web-component
* Implemented using https://docs.adyen.com/payment-methods/apple-pay/web-component
* Using "own certificate" approach
* Using "own certificate" approach
Apple Pay is available on Safari with payment_method=apple
{| class="wikitable"
|+
![[File:Applepayexample.png|left|frameless|Using Apple Pay in Safari)]]
![[File:Idealredirectexample.png|frameless|400x400px]]
|-
!List of available banks (issuers)
!Example redirect to donors bank
|}


==== Apple Pay Testing Links (TBC) ====
==== Apple Pay Testing Links (TBC) ====
Line 40: Line 64:
* Fundraising-tech Apple Pay Sandbox tester accounts [https://docs.google.com/spreadsheets/d/1F-g3j5qdpDTkjigM2Q4CAiODI6YaBF0027PjkgI8ymc/edit#gid=0 here]  
* Fundraising-tech Apple Pay Sandbox tester accounts [https://docs.google.com/spreadsheets/d/1F-g3j5qdpDTkjigM2Q4CAiODI6YaBF0027PjkgI8ymc/edit#gid=0 here]  
* Fundraising-tech Apple Pay Test Server List [https://docs.google.com/spreadsheets/d/1Ng-L0qBWma1U_SHW_u-brtZQSv_PLntyPP9SuknW7Y0/edit#gid=0 here]
* Fundraising-tech Apple Pay Test Server List [https://docs.google.com/spreadsheets/d/1Ng-L0qBWma1U_SHW_u-brtZQSv_PLntyPP9SuknW7Y0/edit#gid=0 here]
== Recurring ==  
== Recurring ==  
Recurring Adyen donations are tokenized and are charged on our schedule by the SmashPig Civi extension's recurring payment charge job. Adyen recurring donations require two identifiers:
Recurring Adyen donations are tokenized and are charged on our schedule by the SmashPig Civi extension's recurring payment charge job. Adyen recurring donations require two identifiers:


* Standard payment token, stored in the civicrm_payment_token table and called recurring_payment_token in queue messages and SmashPig parameters, referred to as 'storedPaymentMethodId' in the Adyen API
* Standard payment token, stored in the civicrm_payment_token table and called recurring_payment_token in queue messages and SmashPig parameters, referred to as 'storedPaymentMethodId' in the Adyen API
* Shopper identifier, stored in civicrm_contribution_recur. and called processor_contact_id in queue messages and SmashPig parameters, referred to as shopperReference in the Adyen API
* Shopper identifier, stored in civicrm_contribution_recur as invoice_id and called processor_contact_id in queue messages and SmashPig parameters, referred to as shopperReference in the Adyen API


== IPN messages ==
== IPN messages ==

Revision as of 00:57, 23 November 2021

Fundraising/Data and flow/PSP integrations
Original Name Adyen Checkout
Our Name ?
Current Name Adyen Checkout
Payment Methods Credit Card, iDEAL, Apple Pay
Countries FR
Documentation https://docs.adyen.com/online-payments/web-components/integrated-before-5-0-0
Test Console https://ca-test.adyen.com/ca/ca/login.shtml
Contact ?

Overview

Adyen is our backup credit card processor.

In 2021, we updated our Adyen code to use their 'Checkout' integration, version 4. Checkout integration sources Adyen-hosted JS on our payments page and renders payment fields in the same form as the donor data, encrypting the data before submitting it to our server. We are using the 'components' style Checkout integration rather than the 'drop-in' style. Both styles use the same Adyen JS objects, but with components we instantiate a slightly lower-level JS object that is specific to the payment method.

A month after we deployed our new integration, Adyen released Checkout version 5 with some breaking changes and a simplified control flow. We have not made plans to update to version 5.

All calls to the Adyen API are routed through the SmashPig library. There are PaymentProcessor subclasses for each payment method.

Documentation for the former (Hosted Payment Pages) integration is at https://www.mediawiki.org/wiki/Fundraising_tech/Adyen

Payment Methods

Credit Cards

iDEAL

iDEAL is bank transfer payment method only available in the Netherlands (payment_method=rtbt&country=NL).

The supported banking systems can be down so Adyen handles creating the list of available banks (referred to as issuers by Adyen) which we get by calling getPaymentMethods.

The donor chooses a bank and is then redirected to their bank's website to complete the donation.

When that is complete they are redirected to our thank you page.

File:Idealredirectexample.png
List of available banks (issuers) Example redirect to donors bank

iDEAL Recurring

iDEAL recurring has a unique flow as Adyen sends the recurring token on an IPN after the donor finishes the transaction.

From the donor's perspective the flow is exactly the same as a one time donation but on our end we don't complete the donation until we get a RECURRING_CONTRACT IPN that has the recurring token on it.

RECURRING_CONTRACT IPNs are set for every new recurring so we filter out just the iDEAL recurrings, find the matching pending database entry, add the recurring token to the message and send it to the donations queue.

Apple Pay

Apple Pay is available on Safari with payment_method=apple

File:Idealredirectexample.png
List of available banks (issuers) Example redirect to donors bank

Apple Pay Testing Links (TBC)

  • Apple Pay Developer Account login here
  • Apple Pay test cards here
  • Fundraising-tech Apple Pay Sandbox tester accounts here
  • Fundraising-tech Apple Pay Test Server List here

Recurring

Recurring Adyen donations are tokenized and are charged on our schedule by the SmashPig Civi extension's recurring payment charge job. Adyen recurring donations require two identifiers:

  • Standard payment token, stored in the civicrm_payment_token table and called recurring_payment_token in queue messages and SmashPig parameters, referred to as 'storedPaymentMethodId' in the Adyen API
  • Shopper identifier, stored in civicrm_contribution_recur as invoice_id and called processor_contact_id in queue messages and SmashPig parameters, referred to as shopperReference in the Adyen API

IPN messages

We continue to receive Adyen IPN messages in SOAP format, as with the HPP integration. Because with Checkout we are able to capture card payments directly from payments-wiki, we have disabled the asynchronous capture flow that we were using with the HPP integration. Code for async capture is still present in SmashPig but is disabled in config/adyen/main.yaml by setting capture-from-ipn-listener: false. We should probably remove that code and config variable as part of T291448.

Audits

Adyen generates csv files on an irregular schedule 'whenever a payable batch closes' https://docs.adyen.com/reporting/settlement-detail-report . We process them with the wmf_audits drupal module that calls functions from SmashPig to parse the CSVs.

Pending Table

The DonationInterface Adyen Checkout adapter as of November 2021 sends duplicated messages to the Pending queue. It might not need to send any messages for card payments, as that queue is mostly used for pending transaction resolution, and that scenario is much less likely under Adyen Checkout due to us making the payment authorization and capture in the same HTTP request where we get the donor data.

Jobs Queue

The IPN listener sends 'RecordCaptureJob' messages to the Jobs-Adyen queue. These jobs combine information from the IPN message with information from the pending queue and send information to the donations queue.

Testing

https://www.mediawiki.org/wiki/Fundraising_tech/Testing#Adyen