Skip to main content
This guide is for developers who want Meld to host the KYC flow. You’ll call Meld’s API to launch the KYC provider UI, KYC the user, then route them to an onramp that accepts the shared KYC token so they don’t need to verify again.

Summary of the steps

  1. Create a Meld customer and store the customerId
  2. Check whether that customer is already KYC-approved
  3. If not, launch Meld’s hosted KYC link and wait for the APPROVED webhook
  4. Start the transaction with bypassKyc: true

Before you begin

  • You have contacted your Meld account manager to enable a KYC provider for you
  • You can store the Meld customerId against each of your users
  • You have a webhook endpoint configured to receive CUSTOMER_KYC_STATUS_CHANGE events (or you plan to poll)
To test this flow in Meld’s sandbox, see KYC testing.
If the user’s KYC status ends in REJECTED, the user has failed KYC. They can retry once, but a user who fails KYC here will very likely also fail directly with any onramp.
To enable this flow, do the following:

Step 1: Create a Meld customer

This step is required for the user to skip logging into the onramp, and is a one-time setup per user. Call POST /accounts/customers and pass in the user’s first name, last name, email address, phone number, and birthday.

Request

Response

The id in the response is now the Meld customerId of that user. The customerId is critical for all of the following steps, make sure you safely store it and tie it to the user in your system.

Step 2: Check if the User is Already KYCed

You can keep track in your own system if a particular user has been KYCed via Meld. If you don’t keep track, you can call GET /accounts/customers, passing the customerId of the user, to check whether the user has already been KYCed with Meld. If the user has been KYCed successfully, then you do not have to KYC the user again. The response will look something like this for a KYCed user, with the key field being serviceProviderCustomers.kyc.status.

Response

If the user has not been successfully KYCed, then either serviceProviderCustomers.kyc.status will show a status other than APPROVED, or the serviceProviderCustomers object will be blank, depending on if the user has attempted KYC previously or not. Either way, the user will have to be KYCed successfully with Meld first.

Step 3: Have Meld KYC the User

This step is only needed if the user isn’t already successfully KYCed. In other words, if the value of serviceProviderCustomers.kyc.status in the previous step is APPROVED then you can skip this step. To KYC the user, call POST /accounts/customers/{customerId}/kyc/initiate. The customerId is in the path. Note that Sumsub is being used as the sample KYC provider in these requests.

Request

The response will include a url that you should then launch from your UI.

Response

As the user goes through the KYC flow, you will receive webhooks informing you that the KYC status of the user has changed. The body of the webhook will look like this:
Each time you receive a webhook, repeat Step 2 until the serviceProviderCustomers.kyc.status shows as APPROVED. If the serviceProviderCustomers.kyc.status is REJECTED, this means the user has failed KYC. They may retry submit with corrected data. If they still fail, then the user will have to try KYCing with the onramp directly, in the onramp’s widget.

Step 4: Initiate a transaction

Pass Meld the customerId of the user when you call POST /crypto/session/widget. Make sure to include the param "bypassKyc": true, which tells Meld to look up that customer’s KYC information and forward it to the onramp.

Request

Response

If you executed every step correctly, then when you open either the widgetUrl or serviceProviderWidgetUrl, then the user go straight to the onramp’s payment screen, as seen in this demo video.
And that’s it! Congrats, you are now using Meld’s Unified KYC product to enhance your users’ experience!