Render a list of available payment methods anywhere in your app.Supported payment methods:#
Cards, Apple pay, Google pay.
Features#
Low development time to integrate payment methods
UI styling customization for the list of payment methods
Adding payment methods to the list requires no extra development time
3D Secure 2 support built in
Drop-in is our pre-built UI solution for accepting payments in your app. Drop-in shows all payment methods as a list, in the same block.
Requirements#
Get an overview of the steps needed to accept live payments.#
Before you begin to integrate, make sure you have followed the Get started with Plexy guide to:3.
Set up webhooks to know the payment outcome
Required versions#
Add Drop-in to your app#
Add different configurations for iOS and Android, 'Drop-in', and some payment methods.1.
Add the return URL handler to your AppDelegate.swift file:
2.
In your app, add a custom URL scheme that matches the returnUrl you use when creating the payment session.
3.
For voucher payment methods, add photo library usage descriptions to the Info.plist file.
4.
For Apple Pay, do the following:Complete the steps to set up Apple Pay with your own certificate.
In your Runner target, add Apple Pay as a capability.
In your Runner target, enter your merchant ID.
2. Create a configuration object#
Create a configuration object with the following properties:| Parameter name | Required | Description |
|---|
environment | | Use test. When you are ready to accept live payments, change the value to one of our live environments. |
clientKey | | A public key linked to your API credential, used for client-side authentication. |
countryCode | | The shopper's country/region. This is used to filter the list of available payment methods to your shopper. |
shopperLocale | | By default, this is set to kk-KZ. To change the language, set this to the shopper's language and country code. If you included shopperLocale in your /sessions request, Drop-in uses that one. |
amount | | The currency and value of the payment, in minor units. This is used to filter the list of available payment methods to your shopper |
| For example: | | |
To add configuration for specific payment methods, create an additional configuration object. For example, for Apple Pay:3. Initialize Drop-in#
Call the create method, passing the following:| Parameter name | Required | Description |
|---|
sessionId | | sessionResponse.id: the id from the /sessions response. |
sessionData | | sessionData: the sessionData from the /sessions response. |
configuration | | The configuration object you created. |
Call the create method#
4. Show Drop-in in your app#
Call startDropin to show the Drop-in, passing the following:| Parameter name | Required | Description |
|---|
dropInConfiguration | | The configuration object you created. |
checkout | | The sessionCheckout you created. |
Show Drop-in#
Drop-in handles the payment flow.5. Dismiss Drop-in (optional)#
You can optionally implement the method to dismiss Drop-in, if this is required for your app. For example, if you want to stop showing the Drop-in UI when the shopper abandons your payment page for an extended period of time.Use the global PlexyCheckout.sessions.stopDropIn(); method to dismiss Drop-in. If you do not implement this method, Drop-in is automatically dismissed when the payment flow ends.If the shopper has been redirected to a third-party app, for example to authorize the payment on an issuer-hosted website, they can still complete the payment even after you dismiss the Drop-in UI.
6. Handle the result#
When the payment flow is completed, you get one of the following objects:| Object | Description |
|---|
PaymentSessionFinished | The payment was successfully submitted. Contains a resultCode with the status of the payment. |
PaymentCancelledByUser | The payment was canceled by the user. |
PaymentError | The payment encountered an error. |
Handle the object and inform the shopper.
Get the payment outcome#
After Drop-in finishes the payment flow, you can show the shopper the current payment status. Plexy sends a webhook with the outcome of the payment.Use the resultCode to show the shopper the current payment status. This synchronous response doesn't give you the final outcome of the payment. You get the final payment status in a webhook that you use to update your order management system.