{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "PaymentMethodTokenizedPayload",
  "type": "object",
  "required": [
    "event",
    "payload"
  ],
  "properties": {
    "event": {
      "type": "string",
      "const": "tokenization-webhook:payment-method:tokenized"
    },
    "payload": {
      "type": "object",
      "required": [
        "payment_method",
        "merchant_id",
        "created_at"
      ],
      "properties": {
        "payment_method": {
          "type": "object",
          "required": [
            "id",
            "type"
          ],
          "properties": {
            "id": {
              "type": "string"
            },
            "type": {
              "type": "string"
            },
            "card": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "brand": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "last_4": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "exp_month": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "exp_year": {
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "bin": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "masked": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        },
        "transaction_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "customer": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "id": {
              "type": [
                "string",
                "null"
              ]
            },
            "first_name": {
              "type": [
                "string",
                "null"
              ]
            },
            "last_name": {
              "type": [
                "string",
                "null"
              ]
            },
            "email": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "merchant_id": {
          "type": "string"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}
