{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ucp.vippsmobilepay.com/ucp/2026-01-23/schemas/wallet_payment_credential.json",
  "title": "Vipps MobilePay Wallet Payment Credential",
  "description": "Credential schema for the com.vippsmobilepay.pay.payment_handler payment handler. Supports MSISDN and TOKEN credential types.",
  "type": "object",
  "required": ["type", "value"],
  "properties": {
    "type": {
      "enum": ["MSISDN", "TOKEN"],
      "description": "The credential type used for wallet payments. MSISDN uses phone number identification. TOKEN uses an encoded customer token."
    },
    "value": {
      "type": "string",
      "description": "The credential value. For MSISDN: phone number in MSISDN format (digits only with country code, no leading zeros or plus sign, e.g., 4712345678). For TOKEN: an encoded customer token string obtained from authenticated sessions."
    }
  },
  "allOf": [
    {
      "if": { "properties": { "type": { "const": "MSISDN" } } },
      "then": {
        "properties": {
          "value": {
            "pattern": "^[1-9]\\d{6,14}$",
            "description": "The phone number in MSISDN format: digits only with country code and subscriber number, no leading zeros or plus sign. Example: 4712345678 for Norwegian number +47 12 34 56 78."
          }
        }
      }
    },
    {
      "if": { "properties": { "type": { "const": "TOKEN" } } },
      "then": {
        "properties": {
          "value": {
            "minLength": 1,
            "description": "An encoded customer token string. This token is obtained from authenticated user sessions and maps to the customerToken field in the Vipps ePayment API."
          }
        }
      }
    }
  ]
}
