M2Square

Quickstart

Send your first sandbox request and process a settlement webhook.

This guide creates a sandbox quote and settlement, then confirms the result with a webhook event.

1. Create a sandbox key

Create a sandbox API key from the M2Square dashboard. Store it only in server-side infrastructure.

export M2_API_KEY="m2_test_..."
export M2_BASE_URL="https://sandbox-api.m2square.xyz"

2. Reserve a quote

curl "$M2_BASE_URL/v1/quotes" \
  -H "Authorization: Bearer $M2_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_currency": "USDC",
    "destination_currency": "MXN",
    "amount": "1000.00",
    "corridor": "USDC_MXN"
  }'

Save the returned id, expires_at, rate, and destination_amount.

3. Create a settlement

curl "$M2_BASE_URL/v1/settlements" \
  -H "Authorization: Bearer $M2_API_KEY" \
  -H "Idempotency-Key: settlement-order-1001" \
  -H "Content-Type: application/json" \
  -d '{
    "quote_id": "quo_01JEXAMPLE",
    "destination": {
      "type": "bank_account",
      "country": "MX",
      "account_holder_name": "Acme Mexico SA",
      "account_number": "0000000000"
    },
    "metadata": {
      "order_id": "order_1001"
    }
  }'

4. Handle the webhook

{
  "id": "evt_01JEXAMPLE",
  "type": "settlement.completed",
  "created_at": "2026-06-05T10:00:00Z",
  "data": {
    "settlement_id": "set_01JEXAMPLE",
    "status": "completed"
  }
}

Record the event, update your ledger, and make downstream actions idempotent.

5. Verify in Sentra

Open Sentra and confirm the transaction is visible with your metadata.order_id. The activity timeline should include quote creation, settlement creation, webhook delivery, and final status.

On this page