Mobile wallets
Magento 2 for Access Worldpay supports two mobile wallets:
Apple Pay
The Apple Pay mobile payment and digital wallet service enables shoppers to make payments in person, in iOS apps, and on the web. It is supported on the iPhone, Apple Watch, iPad and Mac.
Prerequisites
To enable Apple Pay for your shoppers, you’ll need an Apple Developer account that is associated either with the Apple Developer Program or the Apple Developer Enterprise Program.
Your shoppers can only see Apple Pay as a payment option if they:
Use an Apple Pay-compatible device
Use Safari if they are paying on the web
Live in a country or region where Apple Pay is available
How it works
The diagram shows the transactional flow:
The shopper places the order.
Magento requests the encrypted payload from Apple Pay.
Apple Pay returns the encrypted payload after authentication.
Magento sends a JSON request for authorization to Worldpay, containing the encrypted Apple Pay data.
Worldpay sends the payment response to Magento.
The Magento plugin informs the shopper of the outcome.
Implementation steps
Create your
Apple merchant ID (eg, merchant.com.worldpay.merchantAccount) then log in to your Worldpay merchant account.Switch to the mode you’ll be using (test or production), select Integration from the left-hand menu and Apple Pay in the top menu. You can see these details in the screenshot below:
Enter your Apple merchant ID and click the Generate button (if not generated already). Now you can see the certificate signing request (CSR) that you generated. Download that file so you can create your payment-processing certificate.
Enable
Apple Pay on the Apple developer website.Create a
payment processing certificate on the Apple developer website, but note the following:
* Make sure you enter the Apple merchant ID you created in step 1
* Skip the step in which you create an Apple-generated CSR
* Instead, select the Worldpay CSR you generated step 1
* Download and save the payment processing certificate you generated (.cer file)When you have completed the steps on the Apple developer website, send the payment processing certificate you downloaded to Worldpay. Then wait until Worldpay confirms that the certificate is activated.
Now
Register and validate your merchant domain with Apple, making sure to use the Apple merchant ID you created in step 1.Create a
Merchant identity certificate .
For each transaction you must request a session from Apple using your merchant identity certificate. Remember the following when you create your Apple merchant identity certificate:
When asked for your merchant ID, make sure you enter the Apple merchant ID you created in step 1
Follow the instructions from Apple to create a CSR yourself
You cannot use the CSR you generated from Worldpay to create a merchant ID certificate. Instead, generate a CSR of your own and use that to generate the merchant ID certificate. To do this:
Download and save the generated merchant ID certificate (.cer file).
When you have completed the instructions from Apple, add the merchant ID certificate to your keychain.
When you create your own CSR, you might also get a private key. Add that file too in your keychain app.
Export the merchant ID certificate from your keychain as a p12 file (see screenshot below).
Make a note of the password you entered in the field shown below:
Convert your p12 file to a PEM file - use the following command:
openssl pkcs12 -in ApplePayMerchantIdentity_and_privatekey.p12 -out ApplePay.crt.pem -clcerts -nokeys
openssl pkcs12 -in ApplePayMerchantIdentity_and_privatekey.p12 -out ApplePay.key.pem -nocerts
When you generate these files you may be asked for your password. If so, use the password you used in step 5. Upload both files to your server: e.g, /var/www/html/apple-certs
Use the following commands to verify the files:
openssl x509 -noout -modulus -in ApplePay.crt.pem | openssl md5
openssl rsa -noout -modulus -in ApplePay.key.pem | openssl md5
The output of both commands should be the same. You can check this in the section below.
If the output of both commands is not the same, please double-check that you have followed all the previous steps accurately. If both outputs are the same, then you have enabled Apple Pay successfully.
Note: PEM files store SSL certificates and their associated private keys.
How to configure Apple Pay
To configure Apple Pay, do the following:
Go to Magento Admin/Stores/Configurations/Sales/Access Worldpay.
The Apple Pay configuration is in the Wallets section. Complete and save these configurations, as shown below, and shoppers can then use Apple Pay at checkout.
The table below describes the fields, and the information you must input to complete the Apple Pay configuration.
Configuration | Description |
---|---|
Wallet enabled and title | If set to Yes, the wallet section is available at checkout to enable payment by Apple Pay, Google Pay, etc. The shopper sees the title you enter as the heading for the Mobile Wallet section. |
Enabled | When set to Yes, Apple Pay is available at checkout. |
Certification Key | The path of the certification key (PEM) file in the server. |
Certification Path | The path of the certification CRT (PEM) file in the server. |
Certification Password | Your certification password. |
Merchant Name | Your Apple merchant ID. |
Domain Name | The domian name you registered with Apple. |
Note: CSR keys are unique for test and production environments and for each Merchant ID.
Shopper journey
This is a typical successful shopper journey:
At checkout, shoppers see the Apple Pay option in the format in the screenshot below:
The shopper clicks the Place Order button and an Apple Pay popup appears.
Once payment is authorized by Apple, shoppers see a payment verified message.
Finally shoppers see the order success page.
Google Pay
Google Pay lets your shoppers pay with a single click, using payment methods saved in their Google account.
How it works
You can see the transactional flow in the diagram below:
The shopper places the order.
Magento requests the payment token from Google Pay.
Google Pay returns the payment token.
Magento sends an XML Direct request for authorization to Worldpay, this request contains the payment token.
Worldpay sends the payment response to Magento.
The Magento plugin informs the shopper of the outcome.
You can enable Google Pay payments, as seen in the Main configuration section below, at Admin > Stores > Configuration > Sales > Access Worldpay > Mobile Wallets.
Main configuration
Do the following:
Go to Stores > Configuration > Sales > Access Worldpay > Mobile Wallets: Google Pay. The Google Pay configuration screen appears.
The highlighted fields show that you can select multiple items.
Note: To use production mode, you must first submit a request to Google to have your account activated.
You must also set the configurations shown in the screenshot above. These configurations are in the table.
Credit card configuration | Description |
---|---|
Enabled | If set to Yes, Google Pay is available at checkout. |
Payment methods | Supported credit cards. |
Authentication methods | PAN_ONLY: Personal account number. CYRPTOGRAM_3DS:3D Secure authentication. |
Gateway name | Set this to Worldpay. |
Gateway MerchantID | Your Worldpay merchant ID. |
Google MerchantID | Your Google merchant ID. |
Google MerchantName | Configure this in your Google merchant account. |
General configuration
To change between test and production environments:
Go to the General Configuration section, and change the Environment Mode.
Shopper journey
This is a typical successful shopper journey:
When Google Pay is enabled, shoppers see it as an option in the checkout screen.
The shopper clicks the Place Order button. If they have already signed into their Google account, the shopper sees their saved card details in their Google account. If they haven’t signed in, Google asks them to sign in.
If the shopper doesn’t have a saved card in their Google account, they are asked to enter their card details.
If the payment is approved by Google and Worldpay, the shopper sees a success page.
Note: If 3Ds Flex is enabled, when the shopper clicks the Place Order button, they are redirected to a challenge page. If the transaction is successful they are redirected to success page.