Skip to main content

Apple Pay

Introduction

Paylands offers the possibility for your merchant to offer Apple Pay as a way to obtain a customer's card details. Regardless of how you are going to offer it, you need to first register as a merchant with Apple Pay to get your own merchant ID which will later be associated with your Paylands account.

The easiest way to integrate it is through the payment card, where in addition to the ability for the user to enter their card details manually, the Apple Pay button is included so the user can choose how to enter their card. Alternatively, it can also be integrated into your web or mobile app. More information is provided in the direct integration section.

Although Apple Pay offers test cards, these cannot be used for testing in the Sandbox environment. We only support the Production environment.

Below is an example of how Apple Pay integrates into the payment card when displayed exclusively as a payment method, or along with the rest of the form:

Apple Pay exclusive Apple Pay optional

Register your merchant with Apple Pay

If you have already done this step, you can skip to the Setting up Apple Pay in Paylands section. If you have questions you can also refer to the Official Apple Pay registration setup guide. You need to have an Apple ID and have an Apple developer account. If you don't have one yet, you can sign up here. You also need to have a Mac to be able to generate a CSR certificate.

1. Create the merchant identity certificate

First, create a new certificate of type Merchant ID certificates.

Certificates

Enter a name for this identifier and description.

Register Merchant ID

With this, you will access the configuration panel of your Merchant ID, you will have to create the merchant identity certificate following the guided process and add a domain where the Apple Pay button will be displayed.

Merchant ID configuration panel

In order to create your certificates, Apple will ask you for a CSR file that must be created from a Mac, by clicking on learn more, Apple will tell you how to create it.

CSR certificate

You must keep this certificate in order to render the Apple Pay button in your mobile app.

2. Create the payment processing certificate

Following a similar process as above, create the payment processing certificate. You should get the apple_pay.cer at the end of the process.

Set up Apple Pay in Paylands

To set up Apple Pay you must follow the steps below:

  1. Register your merchant with Apple Pay and save your merchant id.

  2. Go to your customer profile in the Paylands dashboard and access the Alternative Payment Methods tab.

  3. Enter your merchant id, a name to identify your merchant in Paylands, the website host from which the payment process is initiated and the country code.

Alternative payment methods settings

  1. Contact Paylands support to use Apple Pay in any of its modalities.

  2. These are the supported SANDBOX test cards.

Direct integration

Integration with Apple devices

If you have an Apple compatible app, you must load the Apple Pay button on the payment page. The Apple Pay documentation has all the information you need to integrate it. Once the user confirms the card to pay with, an event will be triggered whose payload must be provided to our API in the payment via wallet endpoint to proceed with the payment.

To do this, it will be necessary for you to share with Paylands the necessary certificates for decryption:

Run the following commands:

openssl ecparam -out private.key -name prime256v1 -genkey
openssl req -new -sha256 -key private.key -nodes -out request.csr

Make sure you have a Merchant Id. Navigate to Identifiers => Merchant IDs to make sure you have one, if not, create one.

Go to Certificates => All, then + in the top right. Select Apple Pay Payment Processing Certificate, go through to Generate and upload the .csr file you created (request.csr).

Download the file, which will download as apple_pay.cer. You need that file to create the key.

openssl x509 -inform DER -outform PEM -in apple_pay.cer -out temp.pem
openssl pkcs12 -export -out key.p12 -inkey private.key -in temp.pem

You will need to password protect your .p12 file. Keep that password somewhere secure.

You now have the two files you need to decrypt Apple Pay tokens, but before you can do that, you need to convert them into .pem files.

openssl x509 -inform DER -outform PEM -in apple_pay.cer -out certPem.pem
openssl pkcs12 -in key.p12 -out privatePem.pem -nocerts -nodes

After all that, you should have a certificate (certPem.pem) file that looks something like this:

-----BEGIN CERTIFICATE-----
MIIEfzCCBCagAwIBAgIIcDQ4Fbx2jWYwCgYIKoZIzj0EAwIwgYAxNDAyBgNVBAMM
K0FwcGxlIFdvcmxkd2lkZSBEZXZlbG9wZXIgUmVsYXRpb25zIENBIC0gRzIxJjAk
BgNVBAsMHUFwcGxlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRMwEQYDVQQKDApB
cHBsZSBJbmMuMQswCQYDVQQGEwJVUzAeFw0xOTAyMjMxNDU2NDFaFw0yMTAzMjQx
NDU2NDFaMIGxMTAwLgYKCZImiZPyLGQBAQwgbWVyY2hhbnQuY29tLmdyYXRpdHVk
ZS5ncmF0aXR1ZGUxRjBEBgNVBAMMPUFwcGxlIFBheSBQYXltZW50IFByb2Nlc3Np
iWlORp7+MRSeIt3sEdnWIhY29xvHSdXgMT6kpaUupattcKtlHnLiYlTJHRRCO20x
2thoxaQriM+gFSnAyzrdaOnVTJHRRCO20xxcarcjHFr9GHRVsoysRC/ThwAqMaTs
XEV5VwHqpLuvzOca/+A5Q1MEkhH4lgNrqs5AhKkI1WZv2AWErjxkXBehvZy5C51n
RNcJ4KOAHTePfdrkQ3YVcyMnTlz2QBT8K/uLkoG/H1U8nNfaxwA5m6FDLoVXatC2
oGI+ctCv5Ge2SsEPaUqJ7zE3BU4UsbRvwiXwbWW42YZ2V2wvASdTiXw3/nv7apD4
H+PXFQuC86CSKNKV58jFZZNQoTlU0K+0rBR63ps4bBonVg4Bp2EBntFu5Du/rXMo
U5qxOgbh3/ZNtUT52AQicdJ0c+IgVYP6sGhVGorxMS0lFQ67qaj6luRaqzVovcGl
wa7DzQxcl0HZh2M/Wj9v2d+oGjlINlD9SAlWA/dWXrQF6kzEMoOJKBakO1SRVwD2
9UMDoM5JUK+iBteSFp6iHB7wyfb8VMwzzU3aSWDC+zrsbGXgQsFJ9ZClMyu/aiWs
rbugF9EtKocCWbODlxbRBp310XkPVcOKamZ0UI8P3+AvuMeXdnrFzUUBZnXU8bWM
RuIiK0QZobngHsRO3J/oT1h9URFflg7MrvbAyHTBPv5bSztOPcxOEIfwd+opq6Bc
MXZ+0fErpK5YW7jcahrPRp63e3FZjiKrHWZPFXXOH3N30VKRMDsKbZepNWu4glVb
YwKcj8BAm4LvxkCLODZVIsqYZbNTzyTWbKiz7G53Rt6XqFaQVlqlSxvA97SUfq62
RNcJ4KOAHTePfdrkQ3YVcyMnTlz2QBT8K/uLkoG/H1U8nNfaxwA5m6FDLoVXatC2
8nG5lEs5hYJ2WG9Yo39m1gyCHeNse5sOrph9Dq7tro5mO+nX3XaVaIi3MHFl9Hq6
uMetisso8rg633J/YpJipiz6MOdpf7Q7LqX6M0i3x4BJZfIa3xZPsUoEYObyGTJI
OtAJHpvnTIoDhBApBiH/sDq97pzcsl4VkngxxEiTEjXYQEIhcVQpG6lU6rX9+ekQ
qDRXQRMETBev1j7Y1w/v2K0CIAlnnXPVX52g5FTadoFyVq2a91sA4ao44VabMaz8
W5k1
-----END CERTIFICATE-----

And a key (privatePem.pem) that looks something like this:

Bag Attributes
localKeyID: 90 C8 20 E7 8A 2A E5 7E 33 06 FD C5 43 47 9F 15 2F DE 73 90
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
8nG5lEs5hYJ2WG9Yo39m1gyCHeNse5sOrph9Dq7tro5mO+nX3XaVaIi3MHFl9Hq6
YwKcj8BAm4LvxkCLODZVIsqYZbNTzyTWbKiz7G53Rt6XqFaQVlqlSxvA97SUfq62
qDRXQRMETBev1j7Y1w/v2K0CIAlnnXPVX52g5FTadoFyVq2a91sA4ao4
-----END PRIVATE KEY-----

Share these certificates along with your merchant ID with Paylands so you can use Apple Pay.