> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simplepay.mx/llms.txt
> Use this file to discover all available pages before exploring further.

# Evaluate a proposed payment against the tenant's effective SimplePay payment policy

> Referencia detallada para POST /v1/payment-policy/evaluate.

## Uso

Usalo para inspeccionar o evaluar reglas efectivas antes de crear cobros, reservas o flujos con monto variable.

## Antes de llamar

| Tema             | Detalle                                                                                |
| ---------------- | -------------------------------------------------------------------------------------- |
| Metodo           | `POST`                                                                                 |
| Ruta             | `/v1/payment-policy/evaluate`                                                          |
| Auth             | Bearer API key del ambiente correcto.                                                  |
| Scope            | `policies:read`                                                                        |
| Idempotencia     | Recomendada para cualquier retry. Usa una key deterministica por operacion de negocio. |
| Guia relacionada | [API Reference overview](/api-reference/overview)                                      |

## Patron recomendado

* Ejecuta este endpoint desde backend o job seguro, nunca desde frontend con API keys.
* Manda `Idempotency-Key` cuando el endpoint cree, convierta, reprograme, cancele, capture o reembolse estado.
* Persiste IDs SimplePay (`spcs_...`, `sppi_...`, `splink_...`, refund IDs o booking IDs) para reconciliacion.
* Consulta el bloque OpenAPI de esta pagina para el shape exacto de parametros, body y respuestas.

## Ejemplo minimo

```bash terminal theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -sS -X POST "https://api.simplepay.mx/v1/payment-policy/evaluate" \
  -H "Authorization: Bearer $SIMPLEPAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: evaluate-payment-policy_v1" \
  -d '{ ... }'
```

## Errores a manejar

* `400` indica payload, parametros o estado invalido.
* `401` o `403` indican API key, ambiente o scopes incorrectos.
* `409` suele indicar conflicto de estado, duplicado o idempotencia incompatible.
* `429` y `5xx` se pueden reintentar con backoff; en writes conserva la misma idempotency key.

## Contrato OpenAPI

El playground, parametros, body y respuestas de abajo salen de `/openapi.json`. Si el contrato cambia, actualiza la spec y regenera esta pagina.


## OpenAPI

````yaml openapi.json POST /v1/payment-policy/evaluate
openapi: 3.1.0
info:
  title: SimplePay API
  version: '2026-06-13'
servers:
  - url: https://api.simplepay.mx
security:
  - SimplePayApiKey: []
paths:
  /v1/payment-policy/evaluate:
    post:
      summary: >-
        Evaluate a proposed payment against the tenant's effective SimplePay
        payment policy
      operationId: evaluatePaymentPolicy
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: true
              required:
                - amount_minor
                - currency
                - payment_method_types
                - payment_surface
                - product_key
              properties:
                amount_minor:
                  type: integer
                  minimum: 1
                currency:
                  type: string
                  enum:
                    - mxn
                installments:
                  type: object
                  additionalProperties: false
                  description: >-
                    Optional card installments capability request. This is a
                    payment capability, not a SimplePay product.
                  properties:
                    enabled:
                      type: boolean
                    months:
                      type: integer
                      enum:
                        - 3
                        - 6
                        - 9
                        - 12
                        - 18
                    desired_months:
                      type: array
                      items:
                        type: integer
                        enum:
                          - 3
                          - 6
                          - 9
                          - 12
                          - 18
                    pricing_strategy:
                      type: string
                      enum:
                        - merchant_absorbed
                        - payer_transparent
                        - blended_price
                        - pass_through_plus_margin
                    merchant_financing_markup_bps:
                      type: integer
                      minimum: 0
                      maximum: 10000
                    quote_hash:
                      type: string
                      pattern: ^[a-f0-9]{64}$
                payment_method_types:
                  type: array
                  minItems: 1
                  items:
                    type: string
                payment_surface:
                  type: string
                  enum:
                    - hosted_checkout
                    - payment_link
                product_key:
                  type: string
                  enum:
                    - hosted_checkout
                    - payment_link
                    - bookable_payments
      responses:
        '200':
          description: Sanitized policy preflight result
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                required:
                  - version
                  - allowed
                  - code
                  - pricing
                  - evaluated_methods
                properties:
                  version:
                    type: string
                    enum:
                      - simplepay_payment_policy_preflight.v1
                  allowed:
                    type: boolean
                  code:
                    type: string
                  pricing:
                    type: object
                    additionalProperties: true
                    properties:
                      base_amount_minor:
                        type: integer
                      gross_amount_minor:
                        type: integer
                      payer_financing_fee_minor:
                        type: integer
                      merchant_financing_markup_minor:
                        type: integer
                      monthly_payment_minor:
                        type: integer
                      pricing_strategy:
                        type: string
                        enum:
                          - merchant_absorbed
                          - payer_transparent
                          - blended_price
                          - pass_through_plus_margin
                      selected_months:
                        type: integer
                      quote_id:
                        type: string
                        pattern: ^spq_[a-f0-9]{32}$
                      quote_hash:
                        type: string
                        pattern: ^[a-f0-9]{64}$
                      quote_expires_at:
                        type: string
                        format: date-time
                      disclosure_snapshot:
                        type: object
                        additionalProperties: true
                  installment_quote:
                    type: object
                    additionalProperties: false
                    description: >-
                      Policy-controlled card installments quote matrix. Use
                      quote_hash on payment creation to detect stale pricing or
                      policy changes.
                    properties:
                      quote_id:
                        type: string
                        pattern: ^spq_[a-f0-9]{32}$
                      hash:
                        type: string
                        pattern: ^[a-f0-9]{64}$
                      expires_at:
                        type: string
                        format: date-time
                      snapshot:
                        type: object
                        additionalProperties: true
                      options:
                        type: array
                        items:
                          type: object
                          additionalProperties: false
                          required:
                            - months
                            - customer_total_minor
                            - monthly_payment_minor
                            - payer_financing_fee_minor
                            - merchant_net_minor
                            - simplepay_fee_minor
                            - merchant_markup_minor
                            - platform_margin_minor
                          properties:
                            months:
                              type: integer
                            customer_total_minor:
                              type: integer
                            monthly_payment_minor:
                              type: integer
                            payer_financing_fee_minor:
                              type: integer
                            merchant_net_minor:
                              type: integer
                            simplepay_fee_minor:
                              type: integer
                            merchant_markup_minor:
                              type: integer
                            platform_margin_minor:
                              type: integer
                            display_label:
                              type: string
                            disclosure_text:
                              type: string
                  evaluated_methods:
                    type: array
                    items:
                      type: object
                      additionalProperties: true
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 8
        maxLength: 255
  securitySchemes:
    SimplePayApiKey:
      type: http
      scheme: bearer

````