stripe / openapi

An OpenAPI specification for the Stripe API.
MIT License
390 stars 122 forks source link

`refunds` on `charge` is marked as required, but is not included in all requests #152

Closed samuela closed 5 months ago

samuela commented 5 months ago

See for context https://github.com/arlyon/async-stripe/issues/482.

The spec defines the refunds field on Charge objects as being required. However, this is not the case as evidenced by the following payload from Stripe:

{
  "object": {
    "id": "ch_3P8pPEKtAAETU0KR25fseNJx",
    "object": "charge",
    "amount": 1900,
    "amount_captured": 1900,
    "amount_refunded": 0,
    "application": null,
    "application_fee": null,
    "application_fee_amount": null,
    "balance_transaction": "txn_3P8pPEKtAAETU0KR2CMyz6wD",
    "billing_details": {
      "address": {
        ...
      },
      "email": "...",
      "name": "...",
      "phone": null
    },
    "calculated_statement_descriptor": "BITBOP.IO",
    "captured": true,
    "created": 1713902013,
    "currency": "usd",
    "customer": "cus_PyPsAtY7Ny9CDT",
    "description": "Subscription creation",
    "destination": null,
    "dispute": null,
    "disputed": false,
    "failure_balance_transaction": null,
    "failure_code": null,
    "failure_message": null,
    "fraud_details": {
    },
    "invoice": "in_1P8pPEKtAAETU0KRTl17zbME",
    "livemode": false,
    "metadata": {
    },
    "on_behalf_of": null,
    "order": null,
    "outcome": {
      "network_status": "approved_by_network",
      "reason": null,
      "risk_level": "normal",
      "risk_score": 37,
      "seller_message": "Payment complete.",
      "type": "authorized"
    },
    "paid": true,
    "payment_intent": "pi_3P8pPEKtAAETU0KR2GpMPmLO",
    "payment_method": "pm_1P8pPDKtAAETU0KRRcQ52Fce",
    "payment_method_details": {
      "card": {
        "amount_authorized": 1900,
        "brand": "visa",
        "checks": {
          "address_line1_check": "pass",
          "address_postal_code_check": "pass",
          "cvc_check": null
        },
        "country": "US",
        "exp_month": 6,
        "exp_year": 2028,
        "extended_authorization": {
          "status": "disabled"
        },
        "fingerprint": "CqLnpp7F9U0J4JXo",
        "funding": "credit",
        "incremental_authorization": {
          "status": "unavailable"
        },
        "installments": null,
        "last4": "...",
        "mandate": null,
        "multicapture": {
          "status": "unavailable"
        },
        "network": "visa",
        "network_token": {
          "used": false
        },
        "overcapture": {
          "maximum_amount_capturable": 1900,
          "status": "unavailable"
        },
        "three_d_secure": null,
        "wallet": {
          "dynamic_last4": "1111",
          "google_pay": {
          },
          "type": "google_pay"
        }
      },
      "type": "card"
    },
    "radar_options": {
    },
    "receipt_email": null,
    "receipt_number": null,
    "receipt_url": "...",
    "refunded": false,
    "review": null,
    "shipping": null,
    "source": null,
    "source_transfer": null,
    "statement_descriptor": null,
    "statement_descriptor_suffix": null,
    "status": "succeeded",
    "transfer_data": null,
    "transfer_group": null
  }
}
remi-stripe commented 5 months ago

@samuela Thanks for flagging. The refunds property has been made optional since the API version 2022-11-15 as it's not returned by default anymore. The spec should definitely not mark this one as required. We'll investigate and push a fix to make sure it's marked as optional.

anniel-stripe commented 5 months ago

The refunds property, along a few other properties that had been incorrectly marked as required, have been made optional starting in v998. Thanks again for flagging!

samuela commented 5 months ago

Thanks @anniel-stripe !