/api

DFX API

Primary LanguageTypeScriptMIT LicenseMIT

DFX API

DFX is a crypto on- and off-ramp with an open API that can be integrated by anyone. This page explains the basic concepts of the API. If you don't want to bother with API calls, you can integrate our ready-to-use web widget with a few lines of code (see the services repository) or use our React API npm package.

API Documentation

Swagger

Registration

Each user who wants to use the service must be registered separately with their blockchain address and a signature to prove ownership.

Initial Wallet Setup (optional)

Contact support to register your wallet name. This is used to identify all users that signed up with your wallet. This step is optional.

Sign Up

  1. Get the sign message from sign-message endpoint (with the user's address) and sign it with the corresponding private key
  2. Register the user with the sign-up endpoint. wallet and usedRef are optional:
    • Use the wallet name (wallet) from step initial setup
    • See below for more information on the referral program (usedRef)
  3. Now you can get your JWT access token (with address & signature) with the sign-in endpoint

Notifications

If a user wants to get notified about ongoing transactions, he can register his email address with the user endpoint

Referral Program

  • Basic information about the referral program can be found in our FAQ
  • A referral code can only be set once during user registration (usedRef parameter)
  • Every user will receive his own referral code after the first successful transaction. It can be get from the user detail endpoint.

KYC (optional)

KYC is not required for a daily transaction volume up to 1000 CHF. To increase the transaction volume, the user needs to be verified with a KYC process, which can be done on the DFX KYC page.

  1. Get the user's KYC hash from user endpoint
  2. Open then link to the KYC page: https://payment.dfx.swiss/kyc?code=<kyc-hash>

Transactions

Buy Crypto

Get a quote

  1. Get all available assets with the asset endpoint
    • This endpoint will return all assets compatible with the user's address, which might be assets on multiple blockchains. The query parameter (optional) can be used to filter for specific blockchains.
    • Only assets with the buyable field set to true can be bought
  2. Get all available currencies with the fiat endpoint
    • Only fiats with the sellable field set to true can be used to buy crypto
  3. Get a quote with the buy quote endpoint

Get payment infos

  1. Get all available assets with the asset endpoint
    • This endpoint will return all assets compatible with the user's address, which might be assets on multiple blockchains. The query parameter (optional) can be used to filter for specific blockchains.
    • Only assets with the buyable field set to true can be bought
  2. Get all available currencies with the fiat endpoint
    • Only fiats with the sellable field set to true can be used to buy crypto
  3. Get the payment information with the buy payment endpoint
  4. Do a bank transfer with the provided payment infos
    • Ensure compliance with minimum deposit and KYC limits
  5. The crypto asset will be sent to the user's blockchain address as soon as the bank transfer is completed

Sell Crypto

Get a quote

  1. Get all available assets with the asset endpoint
    • Only assets with the sellable field set to true can be sold
  2. Get all available currencies with the fiat endpoint
    • Only fiats with the buyable field set to true can be used to sell crypto
  3. Get a quote with the sell quote endpoint

Get payment infos

In order to perform bank transactions, DFX needs to know the name and address of the recipient. Therefore, user data must be collected once before a sale can be made. The user data can be updated with the kyc data endpoint. Required fields are mail, phone, firstname, surname, street, houseNumber, location, zip, country. For non personal accounts, organizationName, organizationStreet, organizationHouseNumber, organizationLocation, organizationZip, organizationCountry are also required.

  1. Update user data, if required (check with kycDataComplete field from user endpoint)
  2. Get all available assets with the asset endpoint
    • Only assets with the sellable field set to true can be sold
  3. Get all available currencies with the fiat endpoint
    • Only fiats with the buyable field set to true can be used to sell crypto
  4. Get the payment information with the sell payment endpoint
  5. Do a blockchain transaction to the provided deposit address
    • Ensure compliance with minimum deposit and KYC limits
  6. The fiat will be sent to the specified bank account as soon as the blockchain transaction is completed

Bank Accounts (optional)

  • All bank accounts of a user can be fetched with the bank account endpoint
  • A call to the buy or sell payment info endpoints will automatically create a bank account for the provided IBAN
  • This can be used to improve UX and show the previously used IBANs to the user
  • Bank accounts (label, preferred currency) can be updated with the update endpoint
  • Bank accounts can be created directly with the create endpoint

Integration Example