# Moneycorp

Source: https://docs.formance.com/modules/payments/connectors/psp/moneycorp

Stack: v3.2

The Moneycorp connector polls a Moneycorp account and surfaces multi-currency wallets, balances, beneficiaries, and transactions. It also initiates transfers between Moneycorp accounts and payouts to registered beneficiaries.

## Prerequisites

You need a Moneycorp account and a `clientID` + `apiKey` pair. Moneycorp uses OAuth2 client-credentials; the connector exchanges the credentials for a short-lived bearer token and refreshes automatically.

Make sure to create an API key dedicated to Formance. Doing so will improve your auditability and security and will allow you to revoke access to Formance at any time if needed.

## Installation

curl

```bash
curl -X POST $FORMANCE_API_URL/api/payments/v3/connectors/install/moneycorp \
  -H "Content-Type: application/json" \
  -d @'config.json'
```

fctl

```bash
fctl payments connectors install moneycorp config.json
```

### Configuration fields

| Field         | Type    | Required | Default |
| ------------- | ------- | -------- | ------- |
| apiKey        | string  | true     |         |
| clientID      | string  | true     |         |
| endpoint      | string  | true     |         |
| pageSize      | integer | false    | 25      |
| pollingPeriod | string  | false    | 30m     |

`endpoint` defaults to `https://api.moneycorp.com`. Sandbox: `https://sandbox-corpapi.moneycorp.com`.

## Capabilities

- `FETCH_ACCOUNTS` — wallets per ledger.
- `FETCH_BALANCES` — per-account balance.
- `FETCH_EXTERNAL_ACCOUNTS` — beneficiaries.
- `FETCH_PAYMENTS` — transactions and FX conversions.
- `CREATE_TRANSFER` — wallet-to-wallet.
- `CREATE_PAYOUT` — payment to a registered beneficiary.

`CREATE_BANK_ACCOUNT` is not implemented; manage beneficiaries through Moneycorp. Webhooks are not wired.

## Account model

Every Payments internal account is one Moneycorp wallet under the configured client/ledger. The `reference` is the Moneycorp account ID (numeric, used as the cursor since Moneycorp doesn't expose creation dates); `name` is the account name; `defaultAsset` is null — wallets are multi-currency, with one balance row per asset via `FETCH_BALANCES`. EXTERNAL accounts come from Moneycorp's beneficiaries endpoint. See [Accounts](https://docs.formance.com/modules/payments/accounts) for the cross-connector model.

## Asset model

Multi-currency, formatted to UMN at ISO 4217 precision. Amounts arrive as decimal strings; the connector applies major-to-minor scaling.

## Status mapping

| Moneycorp `status`                   | Payment `status` |
| ------------------------------------ | ---------------- |
| `pending`, `processing`              | `PENDING`        |
| `completed`, `released`              | `SUCCEEDED`      |
| `failed`, `cancelled-due-to-failure` | `FAILED`         |
| `cancelled`                          | `CANCELLED`      |

`CREATE_TRANSFER` and `CREATE_PAYOUT` schedule `PollTransferStatus` / `PollPayoutStatus` until terminal.

## Metadata keys

Under `com.moneycorp.spec/`:

- **Account**: `account_id`, `account_name`, `account_type`, `client_reference`.
- **External account**: `beneficiary_id`, `country`, `currency`, `bank_account_number`, `iban`, `bic`, `routing_code_type1`.
- **Payment**: `transaction_id`, `payment_id`, `payment_type`, `currency`, `client_reference`, `reason`.

## Workflow tree

```text
FetchAccounts (periodic)
  ├── FetchBalances (periodic) — per account
  └── FetchPayments (periodic) — per account
FetchExternalAccounts (periodic)
CreateTransfer / CreatePayout (event-driven)
  └── PollTransferStatus / PollPayoutStatus until terminal
```

## Pagination and recovery

1-indexed `pageNumber` + `pageSize`. Watermarks persist in platform-managed `State`; restarts resume from the last committed page boundary.

## Known gaps

- **Webhooks** are not implemented.
- **FX conversions** surface as `PSPPayment`s with `com.moneycorp.spec/payment_type=fx`, not as separate [Conversion](https://docs.formance.com/v3.2/modules/payments/conversions) entries.
- **Beneficiary creation** through the Payments module is not wired.
