> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gnosispay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IBAN Integration

> IBAN cash-in to the Gnosis Pay Account via Monerium

We offer IBAN cash-in to the Gnosis Pay Account via Monerium for users in Europe (EU) and Switzerland.

Monerium's IBAN integration enables direct connection between the owner of the GP Safe (which is the authenticated account address for SIWE) and Monerium.

* By calling the integrations endpoint (see below), it shares the user's KYC with Monerium.

* You can use [Monerium API](https://monerium.dev/api-docs/v2) to authenticate with SIWE and perform actions enabled by the Monerium API

* This API operates independently of the GP Safe and does not involve signatures on the delay module.

## Check Availability

[First you need to check if the user is eligible to have an IBAN](/api-reference/iban/check-iban-availability):

```bash cURL theme={null}
curl -X GET /api/v1/ibans/available
```

If you receive a `"available": false`, the flow ends here.

<Warning>
  Requirements that the Gnosis Pay user must have:

  * Valid date of birth
  * An active EURe Safe Account
  * KYC verified and approved
  * Residency in a supported country
  * First and last name defined (or name)
  * Valid location fields filled in (address1, postalCode, city and country, none of these fields can be missing)
  * Nationality from a supported country ([see allowed and restricted nationalities](https://help.gnosispay.com/hc/en-us/articles/39558629298708-Eligible-Nationalities-for-the-Gnosis-Pay-IBAN-Feature))
</Warning>

## Enabling the IBAN Integration

<Steps titleSize="h3">
  <Step title="Signing the Monerium message">
    Monerium requires a specific message to be signed by the user's wallet to prove the ownership of the wallet.
    [Use this endpoint to get the exact message that needs to be signed](/api-reference/iban/get-the-message-that-needs-to-be-signed-for-iban-activation):

    ```bash cURL theme={null}
    curl -X GET /api/v1/ibans/signing-message
    ```

    <Warning>
      We cannot request new IBANs nor transfer existing IBANs until the message signature is completed. This signature is a mandatory requirement from Monerium to verify ownership of the address.
    </Warning>
  </Step>

  <Step title="Sign the Message with the User's Wallet">
    Use the message string returned from [step 1](#signing-the-monerium-message) to generate a signature with the user's wallet.

    To request signature from the user's wallet, you can follow this [demo signature implementation](#message-signing-example-with-viem).
  </Step>

  <Step title="Request the IBAN from Monerium">
    [Make a POST request to this endpoint to request IBAN integration for Gnosis Pay user](https://docs.gnosispay.com/api-reference/iban/create-a-new-monerium-integration):

    ```bash cURL theme={null}
    curl --request POST \
      --url https://api.gnosispay.com/api/v1/integrations/monerium \
      --header 'Authorization: Bearer <token>' \
      --header 'Content-Type: application/json' \
      --data '{
      "signature": "<string>"
    }'
    ```

    If the request is successful, you will receive a response with the IBAN details.
    This endpoint effectively:

    * shares the user's KYC info with Monerium
    * creates an IBAN linked to the user's account

    <Warning>
      Monerium only allows the user to have one single account with them. If a Monerium account **already exists**, then there is **no need** to call this endpoint. In such cases, users can grant access to their existing Monerium account using the Monerium API directly.
    </Warning>
  </Step>

  <Step title="Get the IBAN number, BIC, Status and Connected Blockchain Address where funds are sent">
    To retrieve IBAN details including the IBAN number, BIC code, status, and connected account address, you can get them with the `bankingDetails` field from:

    ```bash cURL theme={null}
    curl -X GET /api/v1/user
    ```
  </Step>

  <Step title="Using the Monerium API">
    Follow the guide available at [https://monerium.dev/docs/welcome](https://monerium.dev/docs/welcome)
    To authenticate with their API, you can then use the method described in [https://monerium.dev/api-docs/v2#tag/auth](https://monerium.dev/api-docs/v2#tag/auth) *using the SIWE* flow.

    Once authenticated, you can manage IBANs, create instructions to transfer funds from one account to another, etc.
  </Step>
</Steps>

<Warning>
  For detailed error status codes and examples, please refer to the API Reference documentation [here for IBAN integration](https://docs.gnosispay.com/api-reference/iban/create-a-new-monerium-integration).

  The Gnosis Pay API serves as a wrapper for Monerium IBAN integration. Therefore, any issues related to Monerium integration should be addressed directly between your products and Monerium.
</Warning>

## Message Signing Example with Viem

This is an example script to generate a signature from an EOA wallet address that is an owner of GP Safe and will be linked to Monerium profile.

### Example Usage

```typescript theme={null}
import { createWalletClient, http } from 'viem';
import { gnosis } from 'viem/chains';
import { privateKeyToAccount } from 'viem/accounts';

// Initialize wallet client with private key
const account = privateKeyToAccount('0x...' as `0x${string}`);
const walletClient = createWalletClient({
  account,
  chain: gnosis,
  transport: http()
});

// Get the message to sign from the API
const message = "I hereby declare that I am the address owner.";

// Sign the message directly with EOA
const signature = await walletClient.signMessage({
  message
});

console.log('Signature:', signature);
console.log('Signer address:', account.address);
```

<Info>
  Note:

  * The message can be fetched from the API using `GET /api/v1/ibans/signing-message`
  * The signature can be submitted to prove ownership
  * Make sure to use the correct chainId (100 for Gnosis Chain)
</Info>
