diff --git a/appkit/javascript/payments/pay-with-self-custodial-wallets.mdx b/appkit/javascript/payments/pay-with-self-custodial-wallets.mdx new file mode 100644 index 000000000..365ce9a9a --- /dev/null +++ b/appkit/javascript/payments/pay-with-self-custodial-wallets.mdx @@ -0,0 +1,140 @@ +--- +title: AppKit Pay with Self-Custodial Wallets - JavaScript +sidebarTitle: Pay with Self-Custodial Wallets +--- + +**AppKit Pay with Self-Custodial Wallets** enables end users to make crypto payments directly from non-custodial wallets. This includes mobile wallets connected via WalletConnect as well as many browser wallets, giving users full control of their assets throughout the payment process. + +## Quick Start +Here you can find a simplify process to integrate AppKit Pay with Javascript SDK: + + + Projects first need to install and set up Reown AppKit before integrating AppKit Pay. If you haven't done so, please refer to the [Reown AppKit docs](/appkit/overview#quickstart). + + +### Install the library + + + Projects currently using Reown AppKit to enable self-custodial wallet payments in their own checkout flows are encouraged to switch to AppKit Pay for a simpler integration and significantly improved user experience. AppKit Pay can be found in `@reown/appkit-pay` npm package. + + + + +```bash npm +npm install @reown/appkit-pay +``` + +```bash Yarn +yarn add @reown/appkit-pay +``` + +```bash Bun +bun a @reown/appkit-pay +``` + +```bash pnpm +pnpm add @reown/appkit-pay +``` + + +### `pay` - Full Payment Flow + +#### Usage +```ts +import { pay, baseSepoliaETH } from '@reown/appkit-pay' +``` + +This function handles the complete payment flow — it opens the payment UI *and* waits for the result (success, failure, cancel, timeout). This function receives three values: `recipient`, `amount`, and `paymentAsset`. + +```ts +// pay function returns a PaymentResult object +const result = await pay({ + recipient: addressRecipient, + amount: amount, + paymentAsset: baseSepoliaETH +}); + +if (result.success) { + console.log("Payment successful: " + result.result); +} else { + console.error("Payment error: " + result.error); +} +``` + +## Prerequisites + +### Enable Payments Feature in Dashboard + +The "Payments" feature **must be enabled** in the [Reown Dashboard](https://dashboard.reown.com) before you can use AppKit Pay, even for local testing. + +1. Go to your project in the Reown Dashboard +2. Navigate to the Payments section +3. Enable the Payments feature for your projectId + + +## Test locally + +In order to test locally use localhost and port 3000. This is the only port available for local testing. + +Add the following to your package.json file in order to run the development server on port 3000: +```json +"scripts": { + "dev": "vite --port 3000", +}, +``` + +## Supported Networks and Assets + +AppKit Pay with Self-Custodial Wallets supports a wide range of networks and assets. For a complete list, please refer to the [Networks and Assets Supported](/appkit/payments/pay-with-exchange#networks-and-assets-supported) section. + +## Assets Configuration + +For the moment, AppKit Pay has pre-configured these assets: +- baseETH, baseSepoliaETH, and baseUSDC +- ethereumUSDC, optimismUSDC, arbitrumUSDC, polygonUSDC and solanaUSDC +- ethereumUSDT, optimismUSDT, arbitrumUSDT, polygonUSDT and solanaUSDT + +```ts +import { baseETH } from '@reown/appkit-pay' +``` + +For custom assets, you can create a paymentAsset object with all the information: + +```ts +// Configure the paymentAsset +const paymentAssetDetails = { + network: 'eip155:8453', // Base Mainnet + asset: 'native', // Or USDC in Base: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913' + metadata: { + name: 'Ethereum', // Or 'USD Coin' + symbol: 'ETH', // Or 'USDC' + decimals: 18 // Or 6 for USDC + } +}; +``` + +## Functions + +### pay +Opens the payment modal. Resolves when the modal is closed by the user or programmatically. + +`pay(amount, addressRecipient, options: PaymentOptions): Promise` + +### getPayResult +Use with caution regarding timing; subscriptions are preferred. + +`getPayResult(): PayResult | null` + +Returns the result of the last successful payment. + +### getPayError +Use with caution regarding timing; subscriptions are preferred. + +`getPayError(): AppKitPayErrorMessage | null` + +Returns the error object if the last payment failed. + +### getIsPaymentInProgress +Checks if a payment is currently processing. + +`getIsPaymentInProgress(): boolean` diff --git a/appkit/next/payments/pay-with-self-custodial-wallets.mdx b/appkit/next/payments/pay-with-self-custodial-wallets.mdx new file mode 100644 index 000000000..8ced89302 --- /dev/null +++ b/appkit/next/payments/pay-with-self-custodial-wallets.mdx @@ -0,0 +1,8 @@ +--- +title: AppKit Pay with Self-Custodial Wallets - Next.js +sidebarTitle: Pay with Self-Custodial Wallets +--- + +import AppKitPayWallet from "/snippets/appkit/shared/appkit-pay-wallet-react.mdx"; + + diff --git a/appkit/payments/overview.mdx b/appkit/payments/overview.mdx index 26a07af76..f12c2c5ff 100644 --- a/appkit/payments/overview.mdx +++ b/appkit/payments/overview.mdx @@ -34,9 +34,9 @@ These solutions provided by Reown give providers access to hundreds of millions Reown powers modern payment experiences like: -1. **Pay with Self Custodial Wallet**: Let users pay with their self custodial wallets like MetaMask, Trust, Ledger, and more. This flow is bundled together with the **Pay with Exchange** flow. +1. **Pay with Exchange**: Let users pay directly from Centralized Exchanges (CEXs) like Binance, Coinbase, and more. -2. **Pay with Exchange**: Let users pay directly from Centralized Exchanges (CEXs) like Binance, Coinbase, and more. +2. **Pay with Self-Custodial Wallets**: Let users pay with their self-custodial wallets like MetaMask, Trust, Ledger, and more. 3. **1-Click Checkout**: Fast, mobile-optimized, self-custodial and crypto native checkout flows (coming soon). @@ -56,8 +56,12 @@ With **multi-platform SDKs**, **battle-tested infrastructure**, and **exclusive ## Get Started - - Get started with AppKit Pay with Exchange and self-custodial wallets. + + Get started with AppKit Pay with Exchange. + + + + Get started with AppKit Pay with Self-Custodial Wallets. Coinbase is currently not available in the AppKit Pay with Exchange flow. Further information will be available soon. @@ -41,7 +41,7 @@ Want to see AppKit Pay with Exchange in action? Try out the live demo to experie ## Networks and Assets Supported -Currently, AppKit Pay with Exchange and Self-Custodial Wallets supports the following assets on the following networks: +Currently, AppKit Pay with Exchange supports the following assets on the following networks: **Asset -> Network** @@ -62,15 +62,11 @@ Currently, AppKit Pay with Exchange and Self-Custodial Wallets supports the foll For access to additional networks or assets, contact us [via our form here](https://share.hsforms.com/1_oWa8QkwRXi6oR0nZ_SIxQnxw6s). -## Interested in getting early access? - -This feature is currently in early access. If you are **interested in getting early access** or learning more, **contact us [via our form here](https://share.hsforms.com/1_oWa8QkwRXi6oR0nZ_SIxQnxw6s).** - ## Get Started - Get started with AppKit Pay with Exchange and self-custodial wallets in React. + Get started with AppKit Pay with Exchange in React. - Get started with AppKit Pay with Exchange and self-custodial wallets in Next.js. + Get started with AppKit Pay with Exchange in Next.js. - Get started with AppKit Pay with Exchange and self-custodial wallets in Vue. + Get started with AppKit Pay with Exchange in Vue. - Get started with AppKit Pay with Exchange and self-custodial wallets in JavaScript. + Get started with AppKit Pay with Exchange in JavaScript. @@ -138,7 +134,7 @@ This feature is currently in early access. If you are **interested in getting ea - If the user doesn’t have an active browser session with the exchange, they will be prompted to log in by the exchange. + If the user doesn't have an active browser session with the exchange, they will be prompted to log in by the exchange. @@ -224,6 +220,7 @@ This feature is currently in early access. If you are **interested in getting ea If the user opts to buy crypto currency on the exchange instead of using available crypto balance, they may be subject to exchange trading fees. These will be shown to the user, broken down by exchange fees and network (withdrawal) fees. + ### Strategic Benefits @@ -244,91 +241,3 @@ This feature is currently in early access. If you are **interested in getting ea -## Pay with Self-Custodial Wallets FAQs - - - - **Pay with Self-Custodial Wallets** is a feature of Reown's AppKit for Payments, enabling end users to make crypto payments directly from **non-custodial wallets.** This includes mobile wallets connected via WalletConnect as well as many browser wallets, giving users full control of their assets throughout the payment process. - - - - Pay with Wallet uses **self-custodial wallets**, while Pay with Exchange initiates payments from **CEX accounts.** They can be used at the same time as both features are available through the same SDK and UI, letting the user choose the best options for them while making the integration fast and simple. - - - - 600+ wallets are supported - all major wallets and any wallet that supports WalletConnect. - - - - ### User Experience - - - - The user first connects their chosen wallet after which they will see a transaction prompt in their wallet interface with recipient address, network, asset and amount pre-filled. To complete the payment, the user must confirm the transaction in their chosen wallet. - - - - If a user abandons the flow before signing the transaction in their wallet, **no transaction occurs**. Apps can implement timeout logic to handle cancellations gracefully. - - - - Yes, a user can simply disconnect a wallet and connected another without losing the payment detail. - - - ### Compliance, Security & Observability - - - - Yes. AppKit provides **blockchain** **transaction IDs**, which can be used for real-time monitoring and reconciliation. - - - ### Integration & Support - - - - Pay with Wallet is part of **AppKit Pay**, which includes components to handle wallet connection, transaction creation, and monitoring. Integration follows the standard AppKit SDK setup and works as a modal. - - - - For developers already using AppKit, integration is estimated to take **less than a day**. New customers must first complete the AppKit SDK integration, which typically takes a few days depending on team setup. - - - - Reown guarantees 99.9% uptime for paid customers, 90-day uptime can be found [here](https://status.reown.com/). - - Availability of a particular wallet will also depend on the wallet uptime. - - - - ### Pricing & Fees - - - - Reown uses a **tiered pricing model**, calculated on the USD value of processed payments. These fees are billed to Reown's customers monthly, and not applied to end users at the time of payment. - - - - Yes, if usage exceeds AppKit tier limits. - - - - The **end user covers network fees**, they will be visible upon signing the transaction in the wallet. - - - - ### Strategic Benefits - - - - - Reach **600+ wallets** and millions of users with one integration - - Seamless UX for Ethereum, and other major networks - - Pre-filled amount, network, asset removes **manual steps for users and** eliminates over/underpayment risk - - - - - **Cross-wallet support** without needing individual wallet SDKs - - Real-time observability - - Option to mix with **Pay with Exchange** in the same checkout flow and one integration - - - diff --git a/appkit/payments/pay-with-self-custodial-wallets.mdx b/appkit/payments/pay-with-self-custodial-wallets.mdx new file mode 100644 index 000000000..ba9d07563 --- /dev/null +++ b/appkit/payments/pay-with-self-custodial-wallets.mdx @@ -0,0 +1,152 @@ +--- +title: Pay with Self-Custodial Wallets +--- + +**AppKit Pay with Self-Custodial Wallets** enables end users to make crypto payments directly from **non-custodial wallets.** This includes mobile wallets connected via WalletConnect as well as many browser wallets, giving users full control of their assets throughout the payment process. + + + + + +This feature leverages Reown's vast wallet ecosystem to offer: + +- **600+ wallets supported**: All major wallets and any wallet that supports WalletConnect. + +- **Pre-filled transaction details**: Recipient address, network, asset, and amount are pre-filled, removing manual steps and eliminating over/underpayment risk. + +- **Seamless UX**: Support for Ethereum and other major networks with a smooth checkout experience. + +- **Full user control**: Users maintain custody of their assets throughout the entire payment process. + +***One integration. 600+ wallets. Seamless crypto payments from self-custodial wallets.*** + +## Demo + +Want to see AppKit Pay with Self-Custodial Wallets in action? Try out the live demo to experience the payment flow firsthand. + + + + + +## Get Started + + + + Get started with AppKit Pay with Self-Custodial Wallets in React. + + + + Get started with AppKit Pay with Self-Custodial Wallets in Next.js. + + + + Get started with AppKit Pay with Self-Custodial Wallets in Vue. + + + + Get started with AppKit Pay with Self-Custodial Wallets in JavaScript. + + + +## Pay with Self-Custodial Wallets FAQs + + + + **Pay with Self-Custodial Wallets** is a feature of Reown's AppKit for Payments, enabling end users to make crypto payments directly from **non-custodial wallets.** This includes mobile wallets connected via WalletConnect as well as many browser wallets, giving users full control of their assets throughout the payment process. + + + + Pay with Wallet uses **self-custodial wallets**, while Pay with Exchange initiates payments from **CEX accounts.** They can be used at the same time as both features are available through the same SDK and UI, letting the user choose the best options for them while making the integration fast and simple. + + + + 600+ wallets are supported - all major wallets and any wallet that supports WalletConnect. + + + + ### User Experience + + + + The user first connects their chosen wallet after which they will see a transaction prompt in their wallet interface with recipient address, network, asset and amount pre-filled. To complete the payment, the user must confirm the transaction in their chosen wallet. + + + + If a user abandons the flow before signing the transaction in their wallet, **no transaction occurs**. Apps can implement timeout logic to handle cancellations gracefully. + + + + Yes, a user can simply disconnect a wallet and connect another without losing the payment detail. + + + + ### Compliance, Security & Observability + + + + Yes. AppKit provides **blockchain** **transaction IDs**, which can be used for real-time monitoring and reconciliation. + + + + ### Integration & Support + + + + Pay with Wallet is part of **AppKit Pay**, which includes components to handle wallet connection, transaction creation, and monitoring. Integration follows the standard AppKit SDK setup and works as a modal. + + + + For developers already using AppKit, integration is estimated to take **less than a day**. New customers must first complete the AppKit SDK integration, which typically takes a few days depending on team setup. + + + + Reown guarantees 99.9% uptime for paid customers, 90-day uptime can be found [here](https://status.reown.com/). + + Availability of a particular wallet will also depend on the wallet uptime. + + + + ### Pricing & Fees + + + + Reown uses a **tiered pricing model**, calculated on the USD value of processed payments. These fees are billed to Reown's customers monthly, and not applied to end users at the time of payment. + + + + Yes, if usage exceeds AppKit tier limits. + + + + The **end user covers network fees**, they will be visible upon signing the transaction in the wallet. + + + + ### Strategic Benefits + + + + - Reach **600+ wallets** and millions of users with one integration + - Seamless UX for Ethereum, and other major networks + - Pre-filled amount, network, asset removes **manual steps for users and** eliminates over/underpayment risk + + + + - **Cross-wallet support** without needing individual wallet SDKs + - Real-time observability + - Option to mix with **Pay with Exchange** in the same checkout flow and one integration + + diff --git a/appkit/react/payments/pay-with-self-custodial-wallets.mdx b/appkit/react/payments/pay-with-self-custodial-wallets.mdx new file mode 100644 index 000000000..787c989ec --- /dev/null +++ b/appkit/react/payments/pay-with-self-custodial-wallets.mdx @@ -0,0 +1,8 @@ +--- +title: AppKit Pay with Self-Custodial Wallets - React +sidebarTitle: Pay with Self-Custodial Wallets +--- + +import AppKitPayWallet from "/snippets/appkit/shared/appkit-pay-wallet-react.mdx"; + + diff --git a/appkit/vue/payments/pay-with-self-custodial-wallets.mdx b/appkit/vue/payments/pay-with-self-custodial-wallets.mdx new file mode 100644 index 000000000..ba97ff0f6 --- /dev/null +++ b/appkit/vue/payments/pay-with-self-custodial-wallets.mdx @@ -0,0 +1,8 @@ +--- +title: AppKit Pay with Self-Custodial Wallets - Vue +sidebarTitle: Pay with Self-Custodial Wallets +--- + +import AppKitPayWallet from "/snippets/appkit/shared/appkit-pay-wallet-react.mdx"; + + diff --git a/docs.json b/docs.json index bfcbdbe79..ebf49a808 100644 --- a/docs.json +++ b/docs.json @@ -105,6 +105,7 @@ "appkit/features/swaps", "appkit/features/onramp", "appkit/payments/pay-with-exchange", + "appkit/payments/pay-with-self-custodial-wallets", "appkit/payments/deposit-with-exchange", "appkit/payments/one-click-checkout" ] @@ -191,6 +192,7 @@ "group": "Payments", "pages": [ "appkit/react/payments/pay-with-exchange", + "appkit/react/payments/pay-with-self-custodial-wallets", "appkit/react/payments/deposit-with-exchange" ] }, @@ -250,6 +252,7 @@ "group": "Payments", "pages": [ "appkit/next/payments/pay-with-exchange", + "appkit/next/payments/pay-with-self-custodial-wallets", "appkit/next/payments/deposit-with-exchange" ] }, @@ -300,6 +303,7 @@ "group": "Payments", "pages": [ "appkit/vue/payments/pay-with-exchange", + "appkit/vue/payments/pay-with-self-custodial-wallets", "appkit/vue/payments/deposit-with-exchange" ] }, @@ -353,6 +357,7 @@ "group": "Payments", "pages": [ "appkit/javascript/payments/pay-with-exchange", + "appkit/javascript/payments/pay-with-self-custodial-wallets", "appkit/javascript/payments/deposit-with-exchange" ] }, diff --git a/snippets/appkit/shared/appkit-pay-wallet-react.mdx b/snippets/appkit/shared/appkit-pay-wallet-react.mdx new file mode 100644 index 000000000..d00f733d2 --- /dev/null +++ b/snippets/appkit/shared/appkit-pay-wallet-react.mdx @@ -0,0 +1,193 @@ +**AppKit Pay with Self-Custodial Wallets** enables end users to make crypto payments directly from non-custodial wallets. This includes mobile wallets connected via WalletConnect as well as many browser wallets, giving users full control of their assets throughout the payment process. + +## Quickstart + +Here you can find a simplified process to integrate AppKit Pay: + + + Projects first need to install and set up Reown AppKit before integrating AppKit Pay. If you haven't done so, please refer to the [Reown AppKit docs](/appkit/overview#quickstart). + + +## Code Example + + + +Check the React example + + + +### Install the library + + +Projects currently using Reown AppKit, or planning to use it to build custom payment flows with self-custodial wallets, should use AppKit Pay for a streamlined integration and significantly improved user experience out of the box. AppKit Pay can be found in `@reown/appkit-pay` npm package. + + + + +```bash npm +npm install @reown/appkit-pay +``` + +```bash Yarn +yarn add @reown/appkit-pay +``` + +```bash Bun +bun a @reown/appkit-pay +``` + +```bash pnpm +pnpm add @reown/appkit-pay +``` + + + +There are two main ways to handle payments: + +### `pay` - Full Payment Flow + +This function handles the complete payment flow — it opens the payment UI *and* waits for the result (success, failure, cancel, timeout). + +```ts +import { baseSepoliaETH, pay} from '@reown/appkit-pay' +``` + +In order to run the payment, use the function `pay`. This function receives three values: `recipient`, `amount`, and `paymentAsset`. + +```ts +// pay function returns a PaymentResult object +const result = await pay({ + recipient: addressRecipient, + amount: 0.0001, + paymentAsset: baseSepoliaETH +}); + +if (result.success) { + console.log("Payment successful: "+ result.result); +} else { + console.error("Payment error: "+ result.error); +} +``` + + +### `openPay` - Open Payment UI Only + +This function opens or triggers the payment UI modal but doesn't return the result of the payment. Use the hook to handle the payment result. + +```ts +import { baseSepoliaETH, openPay} from '@reown/appkit-pay' +``` + +Call the hook to open the payment modal. +```tsx + const { open: openPay, isPending, isSuccess, data, error } = usePay({ + onSuccess: handleSuccess, + onError: handleError, + }); +``` + +Open the payment modal, but onSuccess/onError handles the actual payment result: +```tsx + await openPay({ + paymentAsset: baseSepoliaETH, + recipient: address, + amount: 1000000000000000000 // 1 ETH + }); +``` + +Handle the payment result in the onSuccess/onError callbacks: +```tsx + const handleSuccess = (data: PaymentResult) => { + console.log("Payment successful:", data); + }; + + const handleError = (error: AppKitPayErrorMessage) => { + console.error("Payment error:", error); + }; +``` + +Or handle the payment result in the UI by displaying the payment status: + +```tsx + {isSuccess || isPending || error && ( +
+

Payment Status

+ {isSuccess && ( +

Payment successful: {data}

+ )} + {isPending && ( +

Payment pending: {data}

+ )} + {error && ( +

Payment error: {error}

+ )} +
+ )} +``` + +## Supported Networks and Assets + +AppKit Pay with Self-Custodial Wallets supports a wide range of networks and assets. For a complete list, please refer to the [Networks and Assets Supported](/appkit/payments/pay-with-exchange#networks-and-assets-supported) section. + +## Assets Configuration + +For the moment, AppKit Pay has pre-configured these assets: +- baseETH, baseSepoliaETH, and baseUSDC +- ethereumUSDC, optimismUSDC, arbitrumUSDC, polygonUSDC and solanaUSDC +- ethereumUSDT, optimismUSDT, arbitrumUSDT, polygonUSDT and solanaUSDT + +```ts +import { baseETH } from '@reown/appkit-pay' +``` + +For custom assets, you can create a paymentAsset object with all the information: + +```ts +// Configure the paymentAsset +const paymentAssetDetails = { + network: 'eip155:8453', // Base Mainnet + asset: 'native', // Or USDC in Base: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913' + metadata: { + name: 'Ethereum', // Or 'USD Coin' + symbol: 'ETH', // Or 'USDC' + decimals: 18 // Or 6 for USDC + } +}; +``` + +## Prerequisites + +### Enable Payments Feature in Dashboard + +The "Payments" feature **must be enabled** in the [Reown Dashboard](https://dashboard.reown.com) before you can use AppKit Pay, even for local testing. + +1. Go to your project in the Reown Dashboard +2. Navigate to the Payments section +3. Enable the Payments feature for your projectId + + +## Test locally + +In order to test locally use localhost and port 3000. This is the only port available for local testing. + +Add the following to your package.json file in order to run the development server on port 3000: +```json +"scripts": { + "dev": "vite --port 3000", +}, +``` + +## Hooks + + +All the payment hooks must be imported from `@reown/appkit-pay/react`. For example: +```tsx +import { usePay } from '@reown/appkit-pay/react'; +``` + +### usePay +Handles the payment flow including opening the modal and tracking payment status. + +`usePay(options?: { onSuccess?: (data: PaymentResult) => void, onError?: (error: AppKitPayErrorMessage) => void }): UsePayReturn` + - `options`: Callbacks for success and error handling. + - `returns`: `{ open, isPending, isSuccess, data, error }`