Paper Checkout
Search…
CreateWallet

Summary

<CreateWallet> is a React component that renders a button which initiates a flow to create a wallet tied to a user's email address. Paper does not have the ability to read the private keys of this wallet, and the user can choose to export the private keys of this wallet at any time by accessing a link that we can provide (please contact us for details of the export flow). The flow works as follows: 1. Paper sends the user a verification email (to the address provided to the emailAddressprop) to ensure that they own the email that is being passed in. This is the email address that the wallet will be tied to. Optional event callback function onEmailVerificationInitiated is called when the user clicks on the button. If nothing is passed in, we show default messages to prompt the user to check their email for verification. 2. Paper calls onSuccess when email verification succeeds and passes through an object that contains the user's email address and wallet address. If verification failed, onError is called with an error message.

Props

emailAddress: string

Required
This is the email address that the user owns and can access. We will send them a verification email and create a wallet tied to this email.

onSuccess: (user: PaperUser) => void

Required
This callback is invoked upon a successful email verification and wallet generation. If a wallet has already previously been generated by this email address, we will pass back the previously-generated wallet address. Paper passes through a PaperUser object that contains the user's wallet public address and email address.
1
type PaperUser {
2
emailAddress: string;
3
walletAddress: string;
4
}
Copied!

onEmailVerificationInitiated: () => void

Optional
This function is called when email verification has been initiated and we are currently waiting for the user to verify their email by checking their email inbox and clicking on a verify button. This would be a place to evoke UX on your end that tells the user to check their email for a verification link. If this prop is not set, we show a default modal that tells the user to do so.

onError: (error: PaperSDKError) => void

Optional
This function is called when email verification fails. A wallet is not generated in this case.
​
Copy link
Contents
Summary
Props