πŸ”—iFrame initialization

Need help with your integration? Click here to chat with our custom GPT for instant answers.arrow-up-right

Required Parameters

  • apiKey: Your publishable API key, also known as the public key.

  • signature: Your HMAC-SHA256 signature of the full query string, base64-encoded.

Optional Parameters

  • email: Pre-fills the customer's email address on the login page.

  • customerKYC: The level of Know Your Customer (KYC) verification.

    • 0 = the customer has not completed KYC.

    • 1 = the customer has completed Proof of ID + Liveness Check.

    • 2 = the customer has completed Proof of ID + Liveness Check + Proof of Address.

  • style: The Styling ID and widget customization options can be configured on the β€œWidget Customizations” page within the Swapped.com Dashboardarrow-up-right.

  • externalCustomerId: Your unique identifier for the customer.

  • baseCountry: User's ISO country code. Used to determine available payout methods. See supported countries for the full list.

  • method: The method the user will receive their payout in. (e.g. bank transfer, Skrill) A full list of supported methods can be found here.

  • minAmount: Sets the minimum order amount in EUR. This cannot be lower than 7 EUR.

  • userSendsFunds=false: This parameter enables merchants to send crypto on behalf of their users. Must be set to false, will default to True.

  • fiatCurrencyCode: Fiat payout currency (e.g. EUR, USD). Required for userSendsFunds=false flow.

  • cryptoCurrencyCode: The crypto the user is selling (e.g. BTC, ETH). Required for userSendsFunds=false flow.

  • cryptoCurrencyAmount : Locks the cryptocurrency amount to be sent. Required for userSendsFunds=false flow.

  • fiatCurrencyAmount: Locks the fiat amount the user will receive. Required for userSendsFunds=false flow.

Note: Only one of the following must be passed. If cryptoCurrencyAmount and fiatCurrencyAmount both are passed, cryptoCurrencyAmount will take precedence.


Example with PHP

Example with NodeJS


iFrame Embed Example


Order Status Flow

payment_pending β†’ order_processing β†’ payout_pending β†’ order_completed                β†˜ order_cancelled

Status Definitions:

payment_pending: Awaiting the user’s crypto deposit.

order_processing: Crypto detected, awaiting blockchain confirmation.

payout_pending: Crypto has been confirmed on the blockchain, and the payout to the user is pending.

order_completed: Crypto received and fiat sent to the user.

order_cancelled: Order cancelled (may include a refund if crypto was sent).

Iframe Order Data Event

The order data will be posted from the iframe when the user presses continue from the payout summary.

If you'd like to allow your frontend access to the order data, you can check for order data events like so:

All messages are wrapped like this:

Data:

Sending payments on behalf of users

This flow enables merchants to initiate and send crypto on behalf of their users, streamlining the off-ramp experience.

Flow:

  1. The user enters payout details in the Swapped widget.

  2. The user sees an order summary showing the expected fiat amount.

  3. The user confirms, creating the order.

  4. Swapped sends a callback to the merchant with order details.

  5. The merchant sends the specified crypto amount to Swapped.

  6. Swapped waits for the required blockchain confirmations (varies by crypto and network, see here for the full list).

  7. Once confirmed, Swapped sends the fiat to the user.

  8. The widget displays a final confirmation based on the actual crypto received.

Last updated