Olo Pay SDK
Welcome to the Olo Pay SDK
PCI compliance is your responsibility but the Olo Pay SDK simplifies your process of maintaining PCI compliance by doing the heavy lifting of processing sensitive credit card data for you. See below for details on adding the SDK to your project and integrating it into your app to submit payments to Olo's Ordering API.
Useful Links:
Setup
The easiest way to get set up with using the Olo Pay SDK is to add it as a dependency in your build.gradle file, replacing X.Y.Z
with the version of the SDK you want to use.
implementation com.olo.olopay:olo-pay-android-sdk:X.Y.Z
Getting Started
The Olo Pay SDK helps with PCI compliance by creating a token to represent sensitive credit card data. The tokenized data is then used in your app to submit payments via Olo's Ordering API. The Olo Pay SDK supports two different types of tokens: Payment Method and CVV Update tokens. Specific details about each token and how to use the SDK to generate them can be found below.
Payment Methods (new cards & digital wallets)
This approach is used for cards that have not previously been saved on file with Olo. This includes new credit cards and digital wallets. With this tokenization approach, an IPaymentMethod is created that is then used to submit a basket with Olo's Ordering API.
Initialize the SDK. It is recommended to initialize on application startup, but it can be initialized anywhere in your app that is convenient.
See classes in the
com.olo.olopay.bootstrap
package
Important: Make sure the SDK is initialized prior to calling methods that generate payment methods
Choose how to create a payment method
Credit Card Input UI Control
Add a payment input control to your app
PaymentCardDetailsSingleLineView: This will display an input control that contains input fields for all credit card fields in a single one-line control. This control provides full flexibility for styling and customization.
PaymentCardDetailsMultiLineView: This will display an input control that contains input fields for all credit card fields in a multi-line control. This control provides full flexibility for styling and customization.
PaymentCardDetailsForm: This will display an input control that breaks out each field into a larger form as a card. This control has fewer options for styling and customization.
Get an IPaymentMethodParams instance
Generate an IPaymentMethod instance
Digital Wallet (Google Pay)
Enable Google Pay in your app manifest in the application tag
<application>
...
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
</application>Content copied to clipboardCreate a Google Pay button using Google's Brand guidelines
When the user clicks the button, present the Google Pay Sheet using GooglePayLauncher.present()
Important: If Google Pay isn't ready at the time
present()
is called, it will throw an exception. Use GooglePayLauncher.readyCallback to know when Google Pay is fully initialized and ready.Retrieve the IPaymentMethod created by GooglePayLauncher
See com.olo.olopay.googlepay.ResultCallback
Submit the IPaymentMethod data to the Basket Submit endpoint of Olo's Ordering API
CVV Update Tokens (previously saved cards)
This approach is used for cards that have previously been saved on file with Olo, and you want to reverify the CVV of the saved card prior to submitting a basket and processing a payment. With this tokenization approach, an ICvvUpdateToken is created that is then used to submit a basket with Olo's Ordering API.
Important: It is up to you to determine when to verify the CVV on a saved card.
Initialize the SDK. It is recommended to initialize on application startup, but it can be initialized anywhere in your app that is convenient.
See classes in the
com.olo.olopay.bootstrap
package
Important: Make sure the SDK is initialized prior to calling methods that generate payment methods
Add the CVV control to your app
See PaymentCardCvvView: This will display an input field for entering a CVV value and provides full flexibility for styling and customization.
Get an ICvvTokenParams instance
Generate an ICvvUpdateToken instance
Submit the ICvvUpdateToken data to the Basket Submit endpoint of Olo's Ordering API