How to Integrate Apple Pay into Your App and Website

In today’s fast-paced world, people want to reduce time spent on routine tasks as much as possible. We all expect online purchases to be easy and convenient. And this, basically, means that we want to buy things with just one click without wasting our precious minutes on entering billing, shipping and contact information each time at the checkout.

Apple Pay service was introduced in 2014 and it has more than 441 million users worldwide today. Why did it become so popular in such a short time-span? The main reason is that Apple Pay allowed iPhone, Apple Watch, iPad and Mac owners to get rid of their physical wallets and make secure payments in stores, in iOS apps and on the web with the help of their Apple devices.

According to statistics, 35 percent of online merchants globally accepted Apple Pay. Want to join them? In this article, we’ll try to explain how to add Apple Pay to your website or app. Send this guide for your developer or hire software programmers.

Is Apple Pay a good fit for your business?

We already mentioned that users just love Apple Pay because it’s an easy and convenient way to make purchases. So the advantages for buyers are pretty much obvious. But what about the selling side? Let’s look into this.

Apple Pay covers a wide range of transactions and allows online merchants to sell almost anything:

  • physical goods (for example, clothes, groceries, books etc.)
  • services (for example, club membership)
  • bookings (for example, hotel reservations)
  • tickets

However, some reasonable exceptions still exist. For example, it’s not allowed to use Apple Pay for selling such goods as cigarettes, tobacco products, weapons, pornography etc. You may find the full list of prohibited uses here.

If your business activity doesn’t fall within the above exceptions, there should be no doubt:  integration of Apple Pay into your website or app is the right decision.

Note: Apple Pay does not replace In-App Purchase. You still need the later to sell virtual goods, for example, premium content and subscriptions within your iOS application.

Preparation stage

This stage does not require any coding, you just need to create the environment for Apple Pay integration.

First, you need to find a payment provider that supports Apple Pay in your region. To do this, see this list on the Apple Pay page. This is the optional but highly recommended step because if you don’t have the established system in place, handling card payments can be quite challenging.

Also, make sure that Apple Pay is available in your country (see the full list of countries and regions here).

For Apple Pay on the web, web pages that incorporate Apple Pay must be served over HTTPS and support TLS 1.2 protocol.

Now, you have to set up Apple Pay Requirements.

1. Create a Merchant ID

Merchant ID is needed to identify your business as a merchant that can accept Apple Pay payments on your website or mobile app. That’s easy. Just log in to your developer account here and go to Certificates, Identifiers & Profiles.

After that, choose iOS, tvOS, watchOS (from the pop-up menu).

Then, choose App ID in the Identifiers section.

Click add button “+

Enter your name in the Name field.

After that, enter Bundle ID as instructed.

Check Apple Pay Payment Processing box in the Apple Services section and click Continue -> Submit.

Then, find Merchant ID in the left column.

Click add button “+” in the upper right corner.

You’ll see this page:

Add a description (it can be just the name of your app or website) and identifier name in the following format: merchant.com.YourAppName. After that, click Continue.

Review the Settings and click Register -> Done.

Now, navigate to App ID (which we’ve just created). Check Apple Pay Payment Processing box and click Edit.

After that, select your merchant ID and check the box.

Now, your App ID should look like this:

2. Create Payment Processing Certificate

Payment Processing Certificate is needed to encrypt and secure outgoing payment data. How to set up it? Follow the steps below.

Navigate to Certificates, Identifiers & Profiles -> Identifiers -> Merchant IDs.

After that, select your merchant ID on the right and click Edit.

You’ll see Payment Processing Certificate section. Click Create Certificate.

Apple Pay integration can be performed in no time if you hire professional developers. Still looking for a reliable team?

Certificate signing request

 If you don’t have a certificate signing request (CSR), you need to create it to create. To do this, launch Keychain Access that is Mac OS system utility. It’s located in /Applications/Utilities on your Mac.

 Then, choose Certificate Assistant ->Request a Certificate from a Certificate Authority.

 Enter necessary information: your email address in the User Email Address field and a name for the key in the Common Name field. The third field, CA Email Address, should be left empty.

 Click Save to disk ->Continue.

 Check out this Apple help page to make sure that you didn’t miss anything.

 To proceed with Payment Processing Certificate creation, click Choose file. Then select CSR file (it has .cert SigningRequest extension) and click Choose – > Continue -> Download.

The downloaded certificate file will have .cer extension. Click Done.

Note: you need to recreate your Payment Processing Certificate every 25 months.

3. Create Merchant Identity Certificate (for websites only)

This certificate is needed to authenticate communication with the Apple Pay servers. To create it, follow the steps below.

Navigate to Certificates, Identifiers & Profiles -> Identifiers -> Merchant IDs. Select your merchant ID on the right and click Edit.

Under Merchant Identity Certificate Section, click Create Certificate.

After that, click Choose file and choose your CSR to upload.

Click Choose – > Continue -> Download.

The downloaded certificate file will have .cer extension. Click Done.

Note: you need to recreate your Merchant Identity Certificate every 25 months.

4. Register and verify your domain (for websites only)

To register a domain, navigate to Certificates, Identifiers & Profiles -> Identifiers -> Merchant IDs. Select your merchant ID on the right and click Edit.

Under Merchant Domains Section, click Add domain.

After that, enter your domain name and click Continue -> Download.

Place the file in the specified location and click Verify. After the verification is completed, click Done.

Note: you’ll need to verify a domain every time its SSL certificate expires.

Watch this video to make sure that you didn’t miss anything.

5. Enable Apple Pay in Xcode (for apps only)

Go to XCode and click the file icon in the upper left corner.

Select the target project and you’ll see the project editor on the right. Choose Capabilities.

You’ll see Apple Pay section. Turn it ON.

Refresh the page — you’ll see your Merchant ID in the Merchant IDs field.

Finally, make sure that all Steps are checked.

Implementation stage

This is the part where coding starts. If you have some basic programming knowledge, you can do it yourself.  Alternatively, if you don’t feel confident about writing a code and want to do things right, reach out to your developer.

1. Support Apple Pay on your app or website

First of all, you need APIs that will allow you to determine if a user has the Apple Pay capable device and if Apple Pay is set up on it. To check Apple Pay availability:

  • for app, use PassKit framework. You can find detailed instructions on how to do this here.
  • for website (on Safari only), use JavaScript-based APIs. You can find detailed instructions on how to do this here.

2. Create an Apple Pay button and mark

All websites and apps that accept Apple Pay must display Apple Pay mark and Apple Pay button whenever payment options are shown.

  • download Apple Pay mark and see its usage guidelines here.
  • choose your button style here.
  • refer to Apple Pay on Web pages for detailed programming guidelines.

3. Customize a payment sheet

Tapping the Apple Pay button should lead to a payment sheet (see on the right). Such payment sheet must contain information that is required to complete the purchase, for example, payment card details, shipping options, contact information etc. It’s up to you to decide what information to present on a payment sheet, but you cannot request data that is not related to the transaction.

For detailed instruction on customizing Apple Pay payment sheet, see Human Interface Guidelines.

Congratulations!
You’ve just implemented Apple Pay in your app/website!

Why is Apple Pay a must for my business?

Apple Pay provides simpler payment envronment for your clients. Moreover, Apple Pay is much safer than usual payment gateways like PayPal because it does not store personal information like billing address or credit card number. Clients are more likely to buy something if they can do it in a simple and safer way. So with Apple Pay you can increase your customer loyalty and business revenue.

Is Apple Pay free for the merchants?

Yes, Apple does not charge any fees if you use Apple Pay in your store or restaurant. All transactions no matter credit or debit ones, will be handled and processes by your payment networks.

Final thoughts

Integration of Apple Pay into the app or website is one of the easiest and cheapest ways for merchants to improve customer experience. We all want to be cared for and we really appreciate if a company not just tries to sell us stuff, but also makes our life easier. Follow the steps in this article to implement Apple Pay yourself.

How to get PayPal Payment Gateway for my Website?

Whether you are using a website to sell goods or services, the choice of the right payment system may directly affect your conversion rates. Needless to say, that competition in the e-commerce sector is high and it is always a good idea to process customer’s payments through your own web page instead of relying on 3rd-party applications and external services.

Generally, the payment system is used to deliver transaction information: receiver, amount, method of payment, etc. There are plenty of online payment gateways nowadays.

The most popular payment systems that facilitate E-commerce & SaaS are:

PayPal

Google Payments

Stripe

Dwolla

Braintree

Amazon payments (Amazon Pay)

PayPal Gateway stands out as the most notable and widespread online payment system to your Website.

Thanks to its excellent security reputation PayPal has a massive consumer base. As for merchants the system offers easy setup process and requires a little technical knowledge to get started. This article covers key topics of PayPal payment integration and main APIs that are used for development.

Want to know what other APIs can help you scale your business? Find the list of top APIs for business in this article. 

Pros and Cons of Integrate PayPal Payment System

Advantages:

  • High transaction speed.
  • Secure – safe for users and protected by PayPal Purchase Protection.
  • Widespread – 200 countries, 26 currencies, 200 million users.
  • A wide variety of APIs and interaction methods to choose from.
  • Vast knowledge base – thanks to PayPal popularity there are tons of manuals, community threads, educational material, etc.
  • Trusted – loyal audience and excellent reputation. The system is well known for its safety and has already become a standard solution among e-commerce platforms.
  • There is an option to pay not only with a credit card but also using PayPal account.

Disadvantages:

  • No currency conversion option.
  • A wide range of APIs and methods makes it difficult to choose a suitable one.
  • PayPal Sandbox is a separate platform. That imposes some limitations and slightly lowers the interaction speed. Also, this may cause some discrepancies and issues at the stage of moving to production version.
  • There is a problem with IPN notifications reception and webhooks (especially in Sandbox version). However, there is always an option to resend notification from admin panel of PayPal.

Payment methods supported by PayPal Solutions

Express Checkout. Fast, no setup fees. Upon processing the payment from PayPal side, user is redirected back to our web application. This method is available only for users who already have a PayPal account.
Direct Payment. This API is used to accept credit card payments from customers who don’t have PayPal account. The method is a way to integrate a transaction process into your website. Moreover, Direct Payment improves customer experience as it is easy to use and familiar to them.
Recurring payment. The subscription as it is. There are several APIs that can implement this method.
Mass Payment. It is used to split payment between multiple accounts.

Getting started

First, you need to sign up and provide PayPal with information about your product/service/company, in order to verify your “lawful alignment”. You can do this here.

You’ll receive an access key upon completion. Keep that key safe! It’s your id so that the service could recognize your app and its unique settings.

  1. Go to PayPal Payment Buttons.
  2. Select a button type to create. The “Buy Now” button is a great choice if you sell only one or a few items on your site. If you sell multiple items on your site, choose the “Shopping Cart” button to let your customers add an item to their shopping cart.
  3. Enter the item name and price. You can also customize the button with additional features. Click Create Button.
  4. Click Select Code to select the button code.
  5. Copy and paste the button code in to your own web page code.
  6. This new button will appear on the “My Saved Buttons” page if you’d like to edit it at any point.

You can always edit your button. Click here to see how.

Tip:

  • If you’d like to allow your customer to provide feedback, create a ‘Text Entry’ field and name it. This field will appear above your button.
  • The ‘Email URL’ option is only available if you are not using any drop down menus, text boxes or user selections. If these selections have been made you will be required to use the HTML code to create your button. We cannot send a URL with these options.

How to Integrate PayPal payment Gateway to your Website

Get an API

On My Apps & Credentials) click “Create App”. Select REST API. This is the most popular API for development, so we’ll use it as an example.

All necessary settings and authentication for API access are in SANDBOX API CREDENTIALS tab.

Sandbox Account

Configure settings from SANDBOX WEBHOOKS and SANDBOX APP SETTINGS, in case you continue working in a sandbox environment. Next, create a test user (SANDBOX – Accounts tab) in order to proceed with Sandbox.

NOTE: It takes several hours for settings to apply.

Log into sandbox.paypal.com (for SANDBOX) or paypal.com under main (owner) account. Go to profile settings > My selling tools tab and fill in all required fields.

NOTE: Don’t forget to set IPN notifications up and assign URL in Instant payment notifications.

Principles of communication between PayPal and user app

  1. The application makes a request. It is app’s responsibility to create a transaction and send it to PayPal via specific payment method or API.
  2. PayPal works with banks. If your transaction is processed and validated properly (otherwise you’ll get an error), PayPal will send a request to the bank.
  3. PayPal sends notifications (IPN). Whether bank accepts or denies the transaction, PayPal sends a notification to your app.
  4. Instant Payment Notification (IPN) tab.
  5. It’s your responsibility to create proper methods for the app to process IPNs.

APIs overview

PayPal supports two data transfer formats to send requests and respond. Both are made using HTTP protocol:

  • NVP (Name-Value Pair).
  • SOAP (Simple Object Access Protocol).

It is preferable to use NVP because of its flexibility. This article covers APIs and SDKs that goes with NVP format.

NOTE: It is not recommended to use SDK for PayPal development. Some methods may change over time, this could lead to potential failures.

Website Payments Standard API. This is the simplest way to make a payment. It allows paying by card or via PayPal account. The payment is processed from PayPal side after that customer is redirected back to your site’s confirmation page. In the best case scenario, you just need to send payment data using POST request.

NOTE: Although it is the easiest way to process PayPal payments, you can check the transaction status only by IPN.

Express checkout. This is the SDK used to process Express checkout payment method. It is used to pay via PayPal account.

NOTE: Express checkout available for Premier and Business members only.

Checkout flow:

  1. SDK makes an API call to get a token from PayPal and sends transaction details.
  2. If the token is granted, a customer will be directed to PayPal to select payment method and shipping address.
  3. The customer makes or denies the payment.
  4. PayPal returns customer to your site.
  5. API makes a call to retrieve transaction details.
  6. Customer completes an order.
  7. API makes a call to request payment status.
  8. PayPal makes the transaction and sends IPN, or you can check status manually through transaction history in your account.

ADVICE: Don’t rely on PayPal’s IPN. There is always a chance that your server won’t be available during notification session. Use your own cron to check payment status.

Transaction status can be obtained in PayPal API by requesting “search for transactions for the period”. Exact methods of making such call you can find here.

Adaptive Payments. With the help of Adaptive Payments API you can select the most suitable payment scenario. For example: to split payment between multiple peers. Learn more here.

Payflow. Payflow API SDK is used for direct payments. Direct payment refers to a payment made by credit card.

Variants of use:

  • Payflow Pro – is used with iframe. Form used to enter card data is generated from PayPal’s side. Your site is not involved during the input process. Therefore, Payflow Pro grants better security but makes it difficult to customize the application form.
  • Payflow Link – Similar to Payflow Pro.
  • Payflow – Opposite to Payflow Pro. The application form is displayed on merchant’s website. This method may concern your customers, as they need to input credit card information on your site, which may seem less secure than PayPal web page. The credit card data is transferred via HTTPS.
NOTE: Use HTTPS to secure data transfer.

IMPORTANT: Your website needs to be PCI-DSS certified (PCI PA-DSS certification for script libraries) in order to process users’ credit card information. Otherwise, it is recommended not to involve in customers data processing.

Payflow is almost similar to Express Checkout. The differences are in SDK and communication flow. Again, it is not recommended to rely on PayPal’s IPN.

Unlike Express Checkout, Payflow uses three Inquiry Actions:

  • to View the Status of Payments.
  • to View Recurring Transaction Details.
  • to View Optional Transaction Details.

Learn more here.

Mass Pay can be applied to consolidate multiple payments in a single transaction. This API is used for mass payments. It’s available only for users with PayPal account as it requires PayPal email address.

Checkout flow:

  1. PayPal API forms a transaction list and sends it to PayPal.
  2. The payment is pending until IPN notifications about all sub-transactions are received.
  3. If for any reason, your server couldn’t receive IPN, you should manually enter PayPal account and resend it.

Difficulties in PayPal payment gateway integration

PayPal offers two IDEs:

  1. Production version – paypal.com.
  2. Test version –  sandbox.paypal.com.

The second one is used to test system operation without losing money on real transactions. Those two IDEs are different, this can cause errors during transition to production version.

Pieces of Advice for PayPal website integration

  • Make sure IPN is turned on.
  • Stick to one type of methods.
  • Pay attention while setting up paypal.com or sandbox.paypal.com accounts.
  • Do not count on quick transaction processing, but make sure that you have permitted to accept payments inside your app settings. (You can find this option in Sandbox app settings/App feature options/Accept payments/on).
  • Do not rely heavily on PayPal documentation. Whilst it is mainly accurate, there might be outdated methods.
  • Recurring made via Express Checkout can’t be canceled while in “pending” status. It is better to inform users about this issue in advance.
  • There might be an issue when PayPal makes an error output to the customer. It’s better to hide those notifications, because they may contain private information.

Conclusion

Although PayPal is a powerful and multifunctional payment system, it is a vast and complex platform. This may cause difficulties during the development process and may require additional time for testing and waiting for transactions to pass. Finally, it is important to read the documentation before starting the development. Good luck with the development and you are welcome to contact us if you need any help.