{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/meld/json-schema/meld-headless-order-onramp-request-schema.json",
  "title": "HeadlessOrderOnrampRequest",
  "description": "Request to create a headless onramp order",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/meld-headless-api-openapi.yml#/components/schemas/HeadlessOrderOnrampRequest",
  "type": "object",
  "properties": {
    "clientIpAddress": {
      "type": "string",
      "description": "The end-user's IP address. Required by some service providers."
    },
    "countryCode": {
      "type": "string",
      "description": "Country code (ISO 3166-1 alpha-2)",
      "minLength": 1
    },
    "customerId": {
      "type": "string",
      "description": "Meld customer id (one of customerId / externalCustomerId is required)"
    },
    "customerPhoneNumber": {
      "type": "string",
      "description": "Customer phone number — required for MOBILE_MONEY"
    },
    "destinationCurrencyCode": {
      "type": "string",
      "description": "Destination cryptocurrency code",
      "minLength": 1
    },
    "destinationWalletAddress": {
      "type": "string",
      "description": "Wallet address to receive the cryptocurrency",
      "minLength": 1
    },
    "externalCustomerId": {
      "type": "string",
      "description": "Caller's external customer id (one of customerId / externalCustomerId is required)"
    },
    "externalOrderId": {
      "type": "string",
      "description": "Caller's reference for the order; unique per account when provided"
    },
    "paymentMethodType": {
      "type": "string",
      "description": "Payment method type",
      "enum": [
        "CREDIT_DEBIT_CARD",
        "APPLE_PAY",
        "ACH",
        "SEPA",
        "PIX",
        "MOBILE_MONEY"
      ]
    },
    "providerData": {
      "description": "Provider-specific extension; subtype keyed by serviceProvider",
      "oneOf": [
        {
          "title": "YellowcardData",
          "allOf": [
            {
              "$ref": "#/$defs/YellowcardData"
            }
          ]
        }
      ]
    },
    "redirectUrl": {
      "type": "string",
      "description": "Redirect URL — required for CARD/REDIRECT flows"
    },
    "serviceProvider": {
      "type": "string",
      "description": "Service provider to use for the order",
      "enum": [
        "NOAH",
        "DUENETWORK",
        "BRALE",
        "YELLOWCARD",
        "MERCURYO"
      ]
    },
    "sourceAmount": {
      "type": "number",
      "description": "Source amount",
      "minimum": 0.0
    },
    "sourceCurrencyCode": {
      "type": "string",
      "description": "Source currency code (ISO 4217)",
      "minLength": 1
    }
  },
  "required": [
    "countryCode",
    "destinationCurrencyCode",
    "destinationWalletAddress",
    "paymentMethodType",
    "serviceProvider",
    "sourceAmount",
    "sourceCurrencyCode"
  ],
  "$defs": {
    "ProviderData": {
      "description": "Provider-specific extension keyed by serviceProvider",
      "properties": {
        "serviceProvider": {
          "type": "string"
        }
      },
      "required": [
        "serviceProvider"
      ]
    },
    "YellowcardData": {
      "allOf": [
        {
          "$ref": "#/$defs/ProviderData"
        },
        {
          "type": "object",
          "properties": {
            "subaccountCustomerId": {
              "type": "string",
              "description": "Optional Meld customer id used to track the business sub-account this transaction belongs to when multiple businesses operate under one Meld account."
            },
            "externalSubaccountCustomerId": {
              "type": "string",
              "description": "Optional external identifier for the sub-account customer this transaction belongs to. Used for tracking when multiple businesses operate under one Meld account. A sub-account customer must be created first before it can be referenced."
            }
          }
        }
      ],
      "description": "Yellowcard-specific provider data"
    }
  }
}