1. Authentication
First things first: your users need to authenticate with our API. This is covered in detail in the Authentication Flow section. Once they’re authenticated, you’ll get ajwt, you’ll need it for all the next steps.
2. User Registration
Now that you’ve got yourjwt token, it’s time to register your user in the Gnosis Pay system.
There are 2 ways to know whether they are already registered or not:
- Check the JWT: If the decoded JWT has a
userId, your user is already registered. - Or, call the user endpoint: Try
GET /api/v1/user. If you get a401 Unauthorized Error, the user isn’t registered yet.
2.1 Get a One-Time Password (OTP) for Email
To register, we’ll need to send your user a one-time password (OTP) to verify their email. Here’s the endpoint (spec):team@gnosispay.com and is valid for 5 minutes.
2.2 Verify the OTP
Once your user gets the code, you can finish signing them up. You will need to pass thepartnerId, which is a unique identifier for your app that has been communicated to you. This is the only place where you need to include it in the request.
If you have a referralCouponCode, you can include it here too.
Here’s the endpoint (spec):
2.3 Accept Terms of Service (ToS)
At this point, the user is registered in the Gnosis Pay system and has an associated user id. Users need to accept our terms of service and those from our partners. To streamline the process, you can do this step together with the previous one. We recommend having a mapping in your app, between the ToS id and their title and urls, so you can display the title and link out for users to read the full text. Make sure they check a box to accept before moving on!This endpoint can only be called once the user is registered. Hence the proposed mapping.
3. KYC Process
To order a card, your users will need to go through a KYC process with our partner Sumsub. The whole KYC flow happens in a Sumsub iframe, and in the background, the Gnosis Pay API keeps you updated on your user’skycStatus (check it with GET /api/v1/user).
Here are the different KYC statuses you might see, and what they mean for your user:
| KYC Status | Description | What your user should do |
|---|---|---|
notStarted | No KYC process started | Start KYC |
documentsRequested | Applicant must upload documents. Status moves to pending when done. | Upload documents |
pending | Awaiting verification processing | Nothing—just wait! |
processing | Profile is being processed | Nothing—system is checking |
approved | All verification checks passed | Nothing—KYC is complete |
resubmissionRequested | Some checks failed; user can re-submit required steps | Re-submit documents |
rejected | Final rejection; user cannot try again | Nothing (final rejection) |
requiresAction | Manual check required by our team | Wait or contact support |
You should start the KYC process if your user is registered and their
kycStatus is notStarted or documentsRequested.3.1 Get the Sumsub iframe URL
Each user gets a unique URL for their KYC process. Get it with (spec):3.2 Monitor KYC Status
While the whole KYC flow happens in an iframe, it is advised to constantly monitor thekycStatus from the user endpoint, and act if users are in certain states.
Provide a way to contact your support if the kycStatus is:
requiresActionrejected
pendingprocessingresubmissionRequested
approved, you can move on to the next step.
3.3 Source of funds questionnaire
For regulatory reasons, users need to answer a couple of questions regarding the source of funds for their card.Users should be ready for this step if:
- they are registered (a
userIdis present in the JWT) - their
kycStatusisapproved - the field
isSourceOfFundsAnsweredon the user endpoint response isfalse
3.4 Phone Verification with OTP
Last but not least, your users need to verify their mobile phone. Just like with email, they’ll enter their phone number, get a one-time password (OTP), and we’ll verify it.This step is needed if:
- The user is registered (
userIdin JWT) kycStatusisapprovedisPhoneValidatedisfalsein the user endpoint response
isPhoneValidated will be true.
4. Safe Account Configuration
Gnosis Pay uses Safe accounts for on-chain transactions. Once your user has completed the previous steps, you’re ready to help them set up their Safe account. Here’s the flow:- Creating a Safe account (
POST /api/v1/account) - Setting the Safe currency (
POST /api/v1/safe/set-currency) - Getting signature data for modules setup (
GET /api/v1/account/signature-payload) - Deploying Safe modules with the user’s signature (
PATCH /api/v1/account/deploy-safe-modules)
Your user is ready for Safe configuration if:
- They are registered (
userIdin JWT) kycStatusisapprovedisSourceOfFundsAnsweredistrueisPhoneValidatedistruesafeWalletis an empty array in the user endpoint response
4.1 Create a Safe Account
The first step is to create and deploy a Safe account for the user. (spec)deployed: true if it worked, and a transactionHash you can use to track it.
After this,
safeWallet from the user response from GET /api/v1/user endpoint won’t be empty anymore.4.2 Set the Safe Currency
After deploying the Safe, we will need to have the currency set for the account. This currency determines which token will be used for transactions.Before doing this, note that the fields
tokenSymbol and fiatSymbol are null in the response from GET /api/v1/safe-config.4.3 Getting Signature Data for Modules Setup
Once the Safe is deployed and the currency is set, you need to get the data that will be signed by the user’s wallet to set up the Safe modules.Before this, note that the field
accountStatus is null in the response from GET /api/v1/safe-config.4.4. Signing and Deploying Safe Modules
The final step is to sign the data with the user’s wallet and deploy the Safe modules.Before this, note that the field
accountStatus is a number that is not 0 in the response from GET /api/v1/safe-config. accountStatus: 0 would mean that the Safe modules are already deployed.@gnosispay/account-kit to have a handy AccountIntegrityStatus enum. AccountIntegrityStatus.Ok, which is 0, means that the Safe modules are already deployed. Another status AccountIntegrityStatus.DelayQueueNotEmpty, which is 7, means the module is deployed correctly, but the Safe has a pending transaction, which could happen later on. If your interface is verifying the Safe modules deployment, both these statuses should be considered as valid.
Signing the Data
Use the domain, types, and message from the previous step to generate an EIP-712 signature:Deploying the Modules
Send the signature to deploy the Safe modules (spec):Complete Safe Configuration Example
Here’s how the whole Safe setup might look in code:accountStatus field will be 0 in the safe config response.