Accept payments in your React Native app
Take a first payment in a React Native app, with Pay.com's drop-in or your own screen.
To take a payment in the sandbox, your server creates a payment session, the app takes the payment, and your server confirms the result. Show the drop-in, which takes the least code, or build your own screen. The React Native SDK reference describes the methods used here.
Choose a checkout UI
Pick the drop-in for the fastest integration, or build a custom form with native card inputs.
| Capability | Drop-in (recommended) | Your own UI |
|---|---|---|
| What you build | A button that presents Pay.com's sheet | A screen using payment methods and card fields |
| Payment methods | Cards, redirect methods, Apple Pay on iOS, and Google Pay on Android | Cards and the redirect methods you render |
| Errors and retries | Handled by the sheet | Handled in your UI |
| Customization | Native platform styling, or custom colors and shapes | Full custom UI |
Both approaches display the customer's saved methods at checkout. The drop-in displays them in a carousel, and a custom screen handles them as shown in Pay with a saved payment method.
Integrate Pay.com
Create a payment session on your server, collect the payment in your app, and verify the final status on your server.
- 1
Create a payment session on your server
Call Create a payment session with your sandbox key.
amount,currency, andcustomer_reference_id(your own identifier for the customer) are required. Amounts are in minor units. For example,1000is $10.00.curl -X POST https://api.sandbox.pay.com/v1/sessions/payment \ -u ':sk-pay-com-sandbox-…' \ -H "Content-Type: application/json" \ -d '{ "amount": 1000, "currency": "usd", "customer_reference_id": "cust-001" }'Send only the
client_secretfrom the response to the app. Never put your API key in the app. - 2
Add the SDK
Install the package, then run
pod installfor iOS:npm install @pay-com/react-native cd ios && pod installBoth platforms' native SDKs come with it. See Install.
- 3
Register the return URL
Redirect payment methods return the customer to your app at its return URL, for example
myshop://pay. Set up deep links for it on each platform. While a payment runs, the SDK picks the URL up from React Native'sLinking. - 4
Start a checkout
PayCheckout.create()checks theclient_secretand loads the session. It rejects with aPayErrorwhen it can't.import { PayCheckout } from '@pay-com/react-native' const checkout = await PayCheckout.create(clientSecretFromYourServer, { returnUrl: 'myshop://pay' })Live and sandbox sessions use the same configuration.
- 5
Take the payment
Present the drop-in, or build your own card form and call
pay.Present the sheet when the customer taps your checkout button. It shows the session's methods, the card form, and any failure. It also runs 3DS and closes when the payment is done.
try { const result = await checkout.presentDropIn({ merchantDisplayName: 'My Shop' }) switch (result.status) { case 'succeeded': case 'processing': showConfirmation(result.ids) // Client-side hint; verify on your server before fulfilling break case 'canceled': break // The customer closed the sheet case 'failed': showError(result.error) // The session can no longer be paid break } } finally { checkout.release() }To show the wallets in the sheet, set
applePayandgooglePay. Present the drop-in has the options and what the customer sees, and you can change its look and text. - 6
Confirm the payment on your server
The result reflects only client-side state. Before you fulfill the order, retrieve the session with Retrieve a payment session or wait for the signed
payment_session.completedwebhook. Use the session ID your server got when it created the session.
Next steps
- React Native SDK reference: Explore drop-in options, custom card fields, wallets, and error types.
- Apple Pay and Google Pay in your app: Configure native wallet buttons for iOS and Android.
- Webhooks: Verify
payment_session.completedevents on your server before fulfilling orders.