---
title: "Test Data"
description: "Sandbox test scenarios for Equity Crowdfunding: campaign creation, investment, closing and cashout, with the headers shared by every call."
url: "https://docs.fabrick.com/en/payment-institution/banking-as-a-service/equity-crowdfunding/test-data/"
language: "en"
---

# Test Data

> **Prerequisites**
>
> - Onboarded portal with `portalId` active.
> - Test company provided by Fabrick (in SANDBOX) with cash account "shortcut" to the portal account, to allow end-to-end verification (investment → campaign closure → cashout).
>
> **Common headers**
>
> Authorization: Bearer *ACCESSTOKENSANDBOX*
>
> X-Portal-Id: *PORTAL_ID*
>
> Content-Type: application/json

---

## 1) Create Campaign

```http
curl -X POST https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/campaigns \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTAL_ID>" \
  -H "Content-Type: application/json" \
  -d '{
        "companyId": "USR03VRXZ1726000668",
        "name": "Test Campaign E2E",
        "description": "Integration test campaign",
        "targetAmountMin": 100000,
        "targetAmountMax": 120000,
        "currency": "EUR",
        "expectedClosingDate": "2026-02-28",
        "portalSuccessFee": {
          "fixedAmount": 1200,
          "variableAmountPercentage": 0.15
        }
      }'
```

Notes:

- `companyId` is issued by Fabrick after the test company has been onboarded.
- `portalSuccessFee` (v4.0) optional: used to deduct fees at the time of cashout.

---

## 2) Open Campaign (OPEN status)

```text
curl -X PUT https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/campaigns/<CAMPAIGNID>/open \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTALID>"
```

An open campaign allows the creation of investment orders.

---

## 3) Create Investor

```text
curl -X POST https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/investors \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTALID>" \
  -H "Content-Type: application/json" \
  -d '{
        "name": "Mario",
        "surname": "Rossi",
        "businessName": null,
        "fiscalCode": "RSSMRA81L04A859O",
        "type": "NATURALPERSON",
        "address": "Via dei Fori Imperiali, 34",
        "postalCode": "00100",
        "city": "Roma",
        "country": "Italia",
        "email": "mario.rossi@example.it",
        "phone": "+393471234567"
      }'
```

- Both natural person investors (`NATURAL_PERSON`) and legal entities (`LEGAL_PERSON`) are supported.

---

## 4) Create Order

```text
curl -X POST https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/orders \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTALID>" \
  -H "Content-Type: application/json" \
  -d '{
        "investorId": "<INVESTORID>",
        "companyId": "USR03VRXZ1726000668",
        "campaignId": "<CAMPAIGNID>",
        "investorAccount": {
          "iban": "IT08I0129518672180944821099",
          "holderName": "Mario",
          "holderSurname": "Rossi",
          "holderBusinessName": null
        },
        "totalAmount": 1100,
        "orderAmount": 1000,
        "feeAmount": 100,
        "currency": "EUR",
        "channel": "MONEYTRANSFER",
        "description": "Order TEST-E2E",
        "portalOrderCode": "TEST-E2E-001",
        "portalOrderDatetime": "2026-02-03T14:15:12.234Z",
        "portalInvestorCode": "RSSMRA81L04A859O",
        "portalCompanyCode": "CMP-TST",
        "portalCampaignCode": "CMP-TST-2026"
      }'
```

- `totalAmount = orderAmount + feeAmount` (required).
- `channel` can be `MONEY_TRANSFER` or card; the example uses bank transfer.
- The response contains `orderId`, which you will use in the next steps.

---

## 5) Set Order to WAITING (awaiting payment)

```text
curl -X PUT https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/orders/<ORDERID>/waiting \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTALID>"
```

This step prepares the system to receive the money-in; it is typical for payments via bank transfer or authorized cards.

---

## 6) (SANDBOX) Simulate Money-In and Verify Payment Status

> In SANDBOX, the test setup connects the test company's cash account to the portal account. After generating a consistent money-in (amount and reference `orderId`), verify the results with the order's payment endpoints.

Retrieve order money-outs:

```text
curl -X GET "https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/orders/<ORDERID>/payment/moneyouts" \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTALID>"
```

Example payload:

```json
{
  "moneyoutId": "MO181951400555230W9V5001485",
  "companyId": "USR02KZLN1827000201",
  "status": "AVAILABLE",
  "amount": 810.68,
  "cashoutAvailableAmount": 810.68,
  "currency": "EUR",
  "createdDatetime": "2019-05-30T18:51:40.000Z",
  "executedDatetime": null
}
```

This information confirms the routing of the `orderAmount` to the campaign account and (if applicable) of the fee to the portal fee account.

Retrieve any order refund:

```text
curl -X GET "https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/orders/<ORDERID>/payment/refund" \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTALID>"
```

Example payload:

```json
{
  "refundId": "MB0287617555553OEKR12000041",
  "status": "EXECUTED",
  "createdDatetime": "2018-06-28T02:26:28.000Z",
  "executedDatetime": "2018-06-28T06:00:25.000Z",
  "amount": 40,
  "currency": "EUR"
}
```

Refunds are generated automatically in the expected cases (order cancelled after accounting, FAIL campaign finalization).

---

## 7) Close Campaign (CLOSED status)

```text
curl -X PUT https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/campaigns/<CAMPAIGNID>/closed \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTALID>"
```

Closing does not move funds per se, but prevents new orders. WAITING orders can still receive money-in.

---

## 8) SUCCESS Finalization (cashout + refunds)

When the campaign has reached at least `targetAmountMin`, invoke the SUCCESS finalization specifying:

- `ordersToExecute`: orders to be aggregated in the cashout (required, ≥1)
- `ordersToUndo`: orders to be refunded (optional)
- `orderToSplit`: any orders to be split in order to comply exactly with the minimum threshold

```text
curl -X PUT https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/campaigns/<CAMPAIGNID>/finalize/success \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTALID>" \
  -H "Content-Type: application/json" \
  -d '{
        "ordersToExecute": [
          "TRX4387623841827947",
          "TRX4387623841827124"
        ],
        "ordersToUndo": [
          "TRX2309823841827364"
        ],
        "orderToSplit": {
          "orderId": "TRX2309823842182736",
          "companyAmountToExecute": 600,
          "companyAmountToUndo": 400,
          "feeAmountToExecute": 60,
          "feeAmountToUndo": 40
        }
      }'
```

- If a portal success fee is defined, it will be deducted from the total before cashout to the company.
- The call returns a `cashoutId` to view the cashout details.

Retrieve cashout details:

```text
curl -X GET https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/campaigns/cashouts/<CASHOUTID> \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTALID>"
```

---

## 9) FAIL Finalization (full refund)

If the campaign has not reached `targetAmountMin`, invoke the FAIL finalization:

```text
curl -X PUT https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/campaigns/<CAMPAIGNID>/finalize/failure \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTALID>"
```

The effect is the refund of all subscribed orders; refunds are sent via the same channel as the money-in (card → card reversal, bank transfer → return transfer).

---

## 10) Special Cases: Unidentified Transfers

Recovery of "unidentified transfers" list (e.g., transfers without `orderId`, incorrect `orderId`, or inconsistent `totalAmount`). These are automatically rejected and returned to the sender.

```text
curl -X GET https://api.sandbox.fabrick.com/equity-crowdfunding/v4.0/unidentified-transfers \
  -H "Authorization: Bearer <ACCESSTOKENSANDBOX>" \
  -H "X-Portal-Id: <PORTAL_ID>"
```

Example payload:

```json
{
  "unidentifiedTransferId": "UTR170309AHMC07172815000001",
  "amount": 120,
  "currency": "EUR",
  "description": "TRXWRONGID",
  "payerName": "John Doe",
  "status": "RECEIVED",
  "type": "UNIDENTIFIED",
  "receivedDatetime": "2019-06-24T09:39:19Z",
  "refundedDatetime": null
}
```

---

## Tips for Performing Tests

- **Plan tests**: test company availability is limited (one per week). Coordinate the team to meet the useful window.
- **Data consistency**: make sure that `totalAmount`, `orderAmount`, `feeAmount`, and `channel` are consistent between order and payment; avoid generating "unidentified transfers."
- **Post-payment checks**: consult `moneyouts`, `refund`, and cashout details to validate the entire flow.
