Overview
WalletConnect Pay is a payment protocol that enables wallet users to pay merchants with crypto by scanning a QR code. The protocol handles payment discovery, transaction construction, gas sponsorship (via 7702 paymaster), and on-chain broadcast.
This cookbook shows how to integrate Turnkey embedded wallets with WalletConnect Pay using the with-walletconnect-pay example — a React Native mobile wallet that authenticates users via email OTP, signs EIP-712 payment authorizations with Turnkey, and lets WalletConnect Pay handle the rest.
Each end-user’s wallet is fully self-custodial: Turnkey creates a dedicated sub-organization per user with a 1-of-1 root quorum, meaning only the authenticated user can authorize signing.
Getting started
Before you begin, make sure you’ve followed the Turnkey Quickstart guide.
You should have:
- A Turnkey organization and Auth Proxy Config ID
- A wallet funded with USDC on Base
You’ll also need:
- A WalletConnect Dashboard wallet project with a WalletConnect Pay API key
- Xcode with iOS Simulator (macOS) for running the React Native app
- Node.js v16+
Install dependencies
Setting up the Turnkey wallet
We’ll use @turnkey/react-native-wallet-kit to authenticate and manage an embedded wallet. The TurnkeyProvider wraps the app with auth and wallet context:
Authenticating with email OTP
Users authenticate via email OTP. On first login, Turnkey creates a sub-organization with an Ethereum wallet:
Initializing WalletConnect Pay
Configure the WalletConnect Pay client with your API key:
Fetching payment options
When a user scans a merchant QR code or enters a payment link, fetch available payment options:
Signing with Turnkey
WalletConnect Pay returns RPC actions that the wallet must sign. For USDC payments, this is typically an eth_signTypedData_v4 action containing an ERC-3009 ReceiveWithAuthorization.
The key integration point: Turnkey’s signMessage with PAYLOAD_ENCODING_EIP712 handles the EIP-712 hashing server-side — you pass the raw typed data JSON string directly:
The signMessage parameter names must be encoding and hashFunction — not encodingOverride or hashFunctionOverride. Using the wrong names will silently fall back to default encoding, producing a valid but incorrect signature.
Handling identity verification
Some payments require identity verification for Travel Rule compliance. Check for collectData on the selected payment option and show a WebView if present:
Confirming the payment
After signing all actions (and completing identity verification if required), submit the signatures to WalletConnect Pay:
Putting it all together
Here’s the complete payment flow in a single component:
Testing
You can test your integration using WalletConnect Pay’s built-in test flow:
- Go to the WalletConnect Dashboard → your wallet project → WalletConnect Pay tab
- Set a mock merchant receiving address in the Test section
- Generate a test payment link from the Point-of-Sale test app
- Scan or paste the link in your wallet app
Payments will arrive at your configured test address. No real merchant onboarding required.
Summary
You’ve now learned how to:
- Authenticate users with Turnkey via email OTP and create embedded wallets
- Initialize a WalletConnect Pay client and fetch payment options from merchant QR codes
- Sign EIP-712 typed data (
ReceiveWithAuthorization) with Turnkey using PAYLOAD_ENCODING_EIP712
- Handle Travel Rule identity verification via WebView
- Confirm payments through WalletConnect Pay, which handles gas sponsorship and on-chain broadcast
For the full working example, see the with-walletconnect-pay repository.