{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tip4serv-com/json-schema/tip4serv-com-payment-schema.json",
  "title": "Payment",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tip4serv-com-openapi.json#/components/schemas/Payment",
  "type": "object",
  "properties": {
    "id": {
      "type": "number",
      "description": "Unique identifier of the payment."
    },
    "transaction_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Gateway transaction reference: PayPal transaction ID or Stripe PaymentIntent ID."
    },
    "gateway": {
      "type": "string",
      "description": "Gateway used for the payment. Accepted values: `PayPal`, `Stripe\n"
    },
    "status": {
      "type": "string",
      "description": "Status of the payment. Accepted values: `Processed`, `Paid`, `Refunded`, `Pending`, `Refused`"
    },
    "cart": {
      "type": "string",
      "description": "The products name which were bought in the payment."
    },
    "sub_id": {
      "type": "number",
      "description": "Eventual subscription id to which the payment is related to."
    },
    "date": {
      "type": "number",
      "description": "Payment creation timestamp expressed in your store timezone."
    },
    "amount": {
      "type": "number",
      "description": "Amount which was paid by the customer in the payment."
    },
    "currency": {
      "type": "string",
      "description": "Currency which was used for the payment."
    },
    "received_gross_amount": {
      "type": [
        "number",
        "null"
      ],
      "description": "Gross amount received in the settlement account, expressed in received_currency. If is_tip4serv_fee is true, the amount is collected by Tip4Serv in its PayPal account, not the seller's account."
    },
    "received_net_amount": {
      "type": [
        "number",
        "null"
      ],
      "description": "Net amount recorded for the settlement account, expressed in received_currency. If is_tip4serv_fee is true, the payment is collected by Tip4Serv in its PayPal account, not the seller's account."
    },
    "received_currency": {
      "type": [
        "string",
        "null"
      ],
      "description": "Currency used for received_gross_amount, received_net_amount, and settlement fees where applicable."
    },
    "exchange_rate": {
      "type": [
        "number",
        "null"
      ],
      "description": "Exchange rate recorded for the payment conversion, when available."
    },
    "tax": {
      "type": [
        "number",
        "null"
      ],
      "description": "Tax collected for the payment, expressed in currency."
    },
    "gateway_fee": {
      "type": [
        "number",
        "null"
      ],
      "description": "Payment gateway fee recorded for the payment, when available."
    },
    "tip4serv_fee": {
      "type": [
        "number",
        "null"
      ],
      "description": "Tip4Serv fee recorded for the payment, expressed in received_currency when available."
    },
    "is_tip4serv_fee": {
      "type": "boolean",
      "description": "True when the payment is collected entirely by Tip4Serv into its PayPal account, rather than into the seller's account."
    },
    "discount": {
      "type": "object",
      "description": "Discount amounts (expressed in the payment currency) and sources recorded for the payment.",
      "properties": {
        "discount_amount": {
          "type": "number",
          "description": "Amount of the discount source (giftcard, coupon, loyalty_points, or mixed). Excludes cart_discount_amount."
        },
        "cart_discount_amount": {
          "type": "number",
          "description": "Discount amount applied when the cart reaches a configured threshold. It is not included in discount_amount."
        },
        "discount_type": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "giftcard",
            "coupon",
            "loyalty_points",
            "mixed"
          ],
          "description": "Recorded discount source, or null if no discount is applied."
        },
        "coupon_id": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Coupon ID used by the customer. Use this ID with GET /store/discount/coupon/{id} to retrieve the coupon code."
        },
        "giftcard_id": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Gift card ID used by the customer. Use this ID with GET /store/discount/giftcard/{id} to retrieve the gift card code."
        },
        "points_spent": {
          "type": "integer",
          "description": "Loyalty points used for payment."
        },
        "points_earned": {
          "type": "integer",
          "description": "Loyalty points earned through payment."
        }
      }
    },
    "country": {
      "type": [
        "string",
        "null"
      ],
      "description": "Customer country recorded for the payment."
    },
    "state": {
      "type": [
        "string",
        "null"
      ],
      "description": "Customer state, province, or region recorded for the payment."
    },
    "username": {
      "type": "string",
      "description": "Username which was used for the payment."
    },
    "identifier": {
      "type": "string",
      "description": "Identifier used for identifying the user. \n**Accepted identifiers:**  \n`email`, `username`, `eosid`, `ue4_id`, `steam_id`, `player_id`,  \n`minecraft_uuid`, `discord_id`,`fivem_citizen_id`, `minecraft_username`.\n"
    },
    "details_page": {
      "type": "string",
      "description": "View more details about the payment on this page."
    },
    "server_actions": {
      "type": "array",
      "description": "Server actions which were executed or are left to be executed.",
      "items": {
        "$ref": "#/$defs/ServerAction"
      }
    },
    "cart_details": {
      "type": "array",
      "description": "Detailed purchased cart by the user.",
      "items": {
        "$ref": "#/$defs/CartRow"
      }
    }
  },
  "required": [
    "id",
    "status",
    "mode",
    "date",
    "amount",
    "currency",
    "username",
    "identifier",
    "gateway",
    "server_actions",
    "cart_details"
  ],
  "$defs": {
    "CartRow": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "Unique identifier of the product ID."
        },
        "name": {
          "type": "string",
          "description": "Name of the product."
        },
        "price": {
          "type": "integer",
          "description": "Price of the product. (expressed in your store currency)"
        },
        "quantity": {
          "type": "integer",
          "description": "Quantity in which the product have been bought."
        }
      },
      "required": [
        "id",
        "name",
        "price",
        "quantity"
      ]
    },
    "ServerAction": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "Action kind: game server command, Discord message, Discord role addition, or Discord role removal.",
          "enum": [
            "server_command",
            "discord_message",
            "discord_role_add",
            "discord_role_remove"
          ]
        },
        "id": {
          "type": "number",
          "description": "Action ID, unique within this event for this server."
        },
        "event": {
          "type": "string",
          "description": "Business event associated with this server action, distinct from its execution state.",
          "enum": [
            "payment",
            "refund",
            "renewal",
            "expire"
          ]
        },
        "state": {
          "type": "string",
          "description": "Execution condition configured for the command; distinct from the result in `status`.",
          "enum": [
            "Execute",
            "Must be online"
          ]
        },
        "status": {
          "type": "string",
          "description": "Latest execution result reported for the command. Commands without a result are `Pending`.",
          "enum": [
            "Pending",
            "Executed",
            "Error",
            "Waiting for server response or player connection",
            "In progress",
            "Canceled",
            "Duplicated",
            "Player must be linked on Discord",
            "Unknown"
          ]
        },
        "str": {
          "type": "string",
          "description": "The command string to execute on the server. \n⚠ Not preprocessed, do not execute this command on a server. If you want to execute a command\nuse the /commands route.\n"
        },
        "message": {
          "type": "string",
          "description": "Discord message content, present for `discord_message` actions."
        },
        "discord_channel": {
          "type": "string",
          "description": "Discord channel ID, or `private_message` when sent by direct message."
        },
        "role_id": {
          "type": "string",
          "description": "Discord role ID for this role action."
        },
        "role_name": {
          "type": "string",
          "description": "Discord role name, when available."
        },
        "date": {
          "type": "string",
          "description": "Execution date reported by the server, when available."
        },
        "confirmation_date": {
          "type": "string",
          "description": "UTC timestamp when the API received the execution result, when available."
        },
        "response": {
          "type": "string",
          "description": "Response text returned for the command, when available."
        },
        "error": {
          "type": "string",
          "description": "Execution error returned for the command, when available."
        },
        "product_id": {
          "type": "number",
          "description": "Unique Identifier of the product ID."
        },
        "server_id": {
          "type": "number",
          "description": "Unique Identifier of the product ID."
        }
      },
      "required": [
        "id",
        "type",
        "event",
        "server_id"
      ]
    }
  }
}