Skip to Content
Docs

Present the drop-in

Show Pay.com's ready-made payment sheet over the app's current screen, and get the result when it closes.

checkout.presentDropIn() shows Pay.com's payment sheet over the app's current screen. The sheet lists the session's methods, including the Apple Pay or Google Pay button when you turn it on, the card form with SDK-owned fields, and redirect methods such as PayPal or iDEAL. It also shows the save-card choice, and a Pay button labeled with the amount. The customer selects a method, then pays. 3DS and redirects open over the sheet. A failure the customer can recover from, such as a decline with attempts left, shows in the sheet so they can try again. The promise resolves once the sheet closes.

The sheet is the native SDKs' own drop-in, so it matches each platform's native design (system lists, controls, and buttons on iOS, and Material 3 on Android, in light and dark mode). At checkout, a returning customer sees their saved methods first, in a carousel. In a setup session, it lists them on top, with their default selected. In a payout session, it reads as choosing where payouts go. See Let customers choose a payout method. What the customer sees describes the sheet from top to bottom, on each platform. While it's open, the SDK picks up return URLs from React Native's Linking. See Handle the return URL.

To build your own screen instead, use the card fields and checkout.pay().

const result = await checkout.presentDropIn({ merchantDisplayName: 'My Shop' })

Parameters

presentDropIn() takes one options object. Every option is optional, and the sheet works without any.

ParameterTypeRequiredDescription
merchantDisplayNamestringNoYour business's name, above the total and in the save-card label, as in "Save card for future use at My Shop".
cardholderName'hidden' | 'optional' | 'required'NoControls the cardholder name field ('hidden', 'optional', or 'required'). Default: 'optional'.
saveCard'automatic' | 'hidden'No'automatic' shows the save-card choice, unless the session saves the card anyway or only saves it. That's when its setup_future_usage is on_session, it's a recurring session, or it's a setup session. 'hidden' never shows it. Default: 'automatic'.
paymentMethodsstring[]NoShows only these API types, in the session's order, for example ['card', 'paypal']. It filters the customer's saved methods by type too, and the Apple Pay and Google Pay buttons show only when it lists applepay or googlepay. Default: every method the session accepts.
allowsRemovingSavedPaymentMethodsbooleanNoShows Edit over the saved methods, so the customer can remove them. Default: false.
secureScreenbooleanNoPrevents screenshots and screen recording of the sheet using FLAG_SECURE (Android only). Default: false.
applePayPayApplePayOptionsNoShows the Apple Pay button (iOS only). See Pay with Apple Pay or Google Pay.
googlePayPayGooglePayOptionsNoShows the Google Pay button (Android only). See Pay with Apple Pay or Google Pay.
appearancePayDropInAppearanceNoThe sheet's colors, corners, text size, Pay button, and card inputs. See Style the drop-in.
stringsPartial<PayDropInStrings>NoThe sheet's text, in English by default. See Change the drop-in's text.

Returns

presentDropIn() returns a promise that resolves with a PayResult once the sheet closes:

statusDescription
'succeeded'The customer paid, or the payment was authorized for a session created with capture: false. In a setup session, they saved or kept a method. result.ids holds the IDs.
'processing'The SDK didn't get a final outcome, for example for a method that's still pending. result.ids holds the IDs. Your server confirms the outcome.
'canceled'The customer closed the sheet.
'failed'The session can't be paid anymore, because it expired, was already paid, or ran out of attempts, or the sheet had no method to show. Inspect result.error.code for the failure reason, for example session_expired or unsupported.

Once the promise resolves, checkout.savedPaymentMethods() leaves out any method the customer removed in the sheet.

The result is a hint for your UI. Before you fulfill the order, your server confirms the payment with Retrieve a payment session or the payment_session.completed webhook.

Errors

presentDropIn() rejects with a PayError only when the sheet couldn't open:

Error codeWhen
releasedThe checkout was released.
payment_in_progressThe drop-in is already showing for this checkout.
no_screenThere's no screen to show the sheet on (no foreground activity on Android, or no view controller on iOS).
unexpected_responseThe native SDK returned a response this SDK version can't read, or the sheet hit an unexpected error on Android.

presentDropIn() rejects with a TypeError instead, before the sheet opens, when an option has the wrong type, for example a cardholderName other than the three values, a paymentMethods that isn't an array of strings, or an allowsRemovingSavedPaymentMethods that isn't a boolean. appearance, strings, and the wallet options list their own.

What the customer sees

Each platform shows its own sheet, with the same parts, texts, and behavior.

A new customer at checkout, on iOS and on Android:

Illustration of the iOS drop-in for a new customer: Close, Example shop and €24.90, an Apple Pay button, "or", a Pay with list with Card selected, PayPal, and iDEAL, each with its logo, the card fields, and a Pay €24.90 button with the accepted card brands under it.Illustration of the Android drop-in for a new customer: Example shop and €24.90 with Close, a Google Pay button, "or", a Pay with list with Card selected by radio, PayPal, and iDEAL, each with its logo, outlined card fields, and a Pay €24.90 button with the accepted card brands under it.

From top to bottom

The sheet stacks these parts, and shows each one only when it applies.

  1. The top. At checkout, your merchantDisplayName and the total, with Close. In a setup or payout session, "Payment" or "Payout method", with Close, and Edit when the customer can remove saved methods.
  2. Apple Pay on iOS or Google Pay on Android, when you set it up, the session offers it, and the device can pay, with "or" under it when other methods follow.
  3. Saved payment methods, in setup and payout sessions. Each row has the method's logo and name, a card also its "Expires MM/YY", and the customer's default reads "Default". At checkout, a returning customer sees theirs in a carousel instead, and the methods below under Other ways to pay.
  4. Pay with (or Get paid with in a payout session) lists Card followed by the redirect methods in the session's order, each row with its logo. There's no list when Card is the only choice.
  5. Card information appears while Card is selected, showing the card number with its brand icon at the end, the expiration date and CVV side by side, and the name field (optional by default).
  6. The save-card switch, under the card and off by default ("Save card for future use at My Shop"). It isn't shown in a setup or recurring session, or when the session's setup_future_usage is on_session.
  7. The failure message, after a failed attempt.
  8. One button, pinned above the keyboard. There's none when the wallet is the only method. Under it, the card brands the session accepts, when it lists them.

In a payout session, on iOS and on Android:

Illustration of the iOS drop-in titled Payout method, with Close on the left and Edit on the right: saved methods with a default Visa card ending in 4242 selected, a PayPal account, and a bank account, each with its logo, a Get paid with list of Card and PayPal, a Use payment method button, and the accepted card brands under it.Illustration of the Android drop-in titled Payout method, with Edit and Close: saved methods with a default Visa card ending in 4242 selected by radio, a PayPal account, and a bank account, each with its logo, a Get paid with list of Card and PayPal, a Use payment method button, and the accepted card brands under it.

A returning customer

At checkout, a customer with saved payment methods sees them first. iOS is on the left, Android on the right.

Illustration of the iOS drop-in for a returning customer: Close, Example shop and €24.90, an Apple Pay button, "or", a carousel of saved methods with a Visa card in front, the name Visa ending in 4242, a Change payment method button, and a Pay €24.90 button.Illustration of the Android drop-in for a returning customer: Example shop and €24.90 with Close, a Google Pay button, "or", a carousel with a large Visa card and the next methods cropped beside it, Visa ending in 4242 with Default and a Change button, and a Pay €24.90 button.
  1. Your merchantDisplayName and the total, with Close.
  2. Apple Pay on iOS or Google Pay on Android, when you set it up, the session offers it, and the device can pay, with "or" under it.
  3. The carousel of saved methods, with the chosen one in front. A card shows its card art when the card network sends it, and a drawn card otherwise. The carousel holds up to five methods, starting with the default followed by the others in the order Pay.com lists them. A method picked on Payment methods comes to the front on iOS. On Android it becomes the large one, and if it isn't among the five, it's added first.
  4. The chosen method's name, and a button to change it (Change payment method on iOS, Change on Android). On Android, a line under the name reads "Default" for the customer's default, or else a card's expiration date and issuer, "Bank account", or the account's email.
  5. A CVV field, when the session checks CVVs and Pay.com doesn't hold one for the card.
  6. One button labeled Pay €24.90.

The change button opens Payment methods, with every saved method that hasn't expired. When the customer can remove saved methods, Edit is there too. The last entry, Other ways to pay, opens the card form and the session's other payment methods, with their own Pay button.

Illustration of the iOS drop-in's Payment methods page: Back, the title, and Edit, the saved methods as tiles in two columns (a Visa card, chosen, with a checkmark, then a Mastercard, a PayPal account, and a bank account), and an Other ways to pay row.Illustration of the Android drop-in's Payment methods page: Back, the title, and Edit, a grouped list of saved methods with radio buttons (Visa chosen, then Mastercard, PayPal, and Example Bank), and Other ways to pay with Card, PayPal, and iDEAL.

On each platform

The parts are the same, and each platform draws them with its own controls.

iOSAndroid
The sheetA system page sheet, with a grabber and a navigation barA Material 3 bottom sheet
The title barAt checkout, Close on the left, above the merchant and the total. In setup and payout sessions, the title centered, Close on the left, and Edit on the rightAt checkout, the merchant on the left and Close on the right, with the total under them. In setup and payout sessions, the title on the left, Edit and Close on the right
The saved methods at checkoutA wrapping carousel with the chosen method in front and its neighbors behindA non-wrapping Material carousel with the chosen method at full size and its neighbors cropped beside it
Payment methodsTiles in two columns, with a checkmark on the chosen oneA list, with a radio button on each row
The selectionA checkmark on the selected rowA radio button on every row
The cardOne grouped list, with placeholders for labelsOutlined fields, with floating labels
Paying with a walletApple Pay's sheet shows the progressThe Google Pay button shows a spinner
RemovingA red minus on each saved rowA red delete button on each saved row, and Edit reads Done

States

The sheet changes as the customer selects methods and pays.

StateWhat the customer sees
The sheet opensAt checkout, a returning customer's default saved method, in front of the carousel. Otherwise their default saved method selected, or else the first row.
Another method is selectedThe card form and its switch collapse, and come back with Card.
Card is the only methodThe form, without a list.
The wallet is the only methodIts button alone.
The card details are wrong"Card number is invalid", "Expiry date is invalid", or "CVV must be 3 or 4 digits" under the input immediately. After a tap on Pay, incomplete fields also display their validation messages, empty ones read "Required", and the first gets focus.
PayingA spinner in the Pay button. Everything is disabled, and the sheet can't be closed.
3DS, a redirect, or the walletIts screen opens over the sheet. A cancel returns to the sheet, with no message.
Declined"Your payment method has been declined." The customer can try again.
The total changed"The total has changed. Check the new total, then pay again." The button shows the new total, and nothing was charged.
Another failure"Check your connection and try again." or "Something went wrong. Please try again."
The session can't be paid anymore"You have reached the maximum number of payment attempts.", "The session has expired and payment can no longer be made.", or "This payment can no longer be completed." Everything but Close is disabled.
A setup or payout sessionSaved methods first. Using one makes it the customer's default.
Removing a saved methodThe customer taps Edit, then confirms "Remove Visa •••• 4242?" with Remove, or taps Cancel. Once nothing is left to select, the sheet closes as 'canceled'.
Removing a saved method at checkoutThe customer taps Edit on Payment methods, then confirms "Remove Visa •••• 4242?" with Remove, or taps Cancel. If the chosen method is removed, the default, or else the first, takes its place. When the customer removes their last saved method, the sheet switches to the new-customer view.
Large textA list replaces the carousel, with the change button under it. On iOS, from an accessibility text size, it lists every saved method under "Saved" with a checkmark on the chosen one, and Payment methods uses one column. On Android, from a 150% font size, it lists the carousel's methods with radio buttons.
SuccessThe sheet closes automatically and returns the PayResult so your app can display confirmation.

The button

The button's label depends on the session and the selected method.

Session and selectionThe button reads
A paymentPay €10.00, or Pay when the session has no amount or currency
A setup session, with a new methodAdd your payment method
A setup session, with a saved methodUse payment method
A payout session, with any methodUse payment method

Logos

The sheet shows the same logos as Pay.com.js, bundled in the native SDKs, on both platforms.

WhereWhat it shows
A method's rowThe method's logo, as Pay.com.js shows it. A method without a logo of its own shows its monogram, as Pay.com.js does (up to two initials of its name on a white card, for example BD for Bacs Direct Debit).
The Card rowA card.
A saved method's rowThe card's brand, or the method's logo. Without either, a monogram.
A saved method at checkoutA card's art, when the card network sends it, or else a drawn card in the brand's color, with the issuer or brand, the last 4 digits, the expiration date, and the brand's mark. PayPal and bank accounts show their logo on a white card in light mode, and a dark gray one in dark mode.
The card number inputThe detected card brand at the end of the field (Visa, Mastercard, American Express, or Discover), or a generic card icon. Screen readers read the brand's name.
Under the buttonWhen the session takes cards and lists accepted brands, the logos for Visa, Mastercard, Discover, and American Express appear under the button. Other brands aren't shown there. Screen readers read them as "Accepted cards: Visa, Mastercard".

A redirect method's row reads the method's name, as Pay.com.js shows it, unless you set one in strings.methodNames. Its monogram takes its initials from the name the row shows.

When the amount changes

The drop-in checks the session's total when the sheet opens and again before it charges.

  • When the sheet opens, it reads the session's total again, for up to 5 seconds. If it can't, it opens with the total it has, and still checks before it charges.
  • When your server changes the total, nothing is charged at the old one. The Pay button shows the new total, under "The total has changed. Check the new total, then pay again.", and the customer taps again.
  • Apple Pay and Google Pay open with the new total. If the total changes while the wallet's sheet is open, nothing is charged and the drop-in shows the same message.

presentDropIn() doesn't resolve with amount_changed. The customer pays again or closes the sheet. After that, checkout.session has the total the sheet last read. See When the amount changes for the check itself.

Example

import { Alert } from 'react-native'
import { PayCheckout, PayError } from '@pay-com/react-native'

export async function payWithDropIn(orderId: string) {
  // Your own server creates the session and returns only its client_secret.
  const clientSecret = await fetchClientSecret(orderId)
  const checkout = await PayCheckout.create(clientSecret, { returnUrl: 'myshop://pay' })
  try {
    const result = await checkout.presentDropIn({
      merchantDisplayName: 'My Shop',
      cardholderName: 'required',
    })
    switch (result.status) {
      case 'succeeded':
      case 'processing':
        // A hint for your UI. Your server confirms the payment before you fulfill the order.
        showOrderPlaced(orderId)
        break
      case 'canceled':
        break // the customer closed the sheet: keep their cart
      case 'failed':
        // The session can't be paid anymore: your server creates a new one to try again.
        Alert.alert('This payment can no longer be completed.')
        break
    }
  } catch (error) {
    // The sheet didn't open, for example error.code is 'no_screen'.
    if (error instanceof PayError) console.warn(error.code, error.message)
  } finally {
    checkout.release()
  }
}

Next steps

Was this page helpful?