Checkout Sessions

Preview Refund Allocation

Changed on

Computes how a refund would be allocated across the Checkout Session's payment methods, without executing any refund. Takes the same request body as the refund endpoint and returns the per-payment-method allocations so you can preview a split-cart refund before committing.

post/v1/checkout/sessions/{id}/refund_allocation

Request

  • Base URL
    https://api.withflex.com
  • URL
    https://api.withflex.com/v1/checkout/sessions/{id}/refund_allocation
  • Auth
    HTTP bearer

Path parameters

idstring required
Example:fcs_01J9XR8M3K7VZ8N2YB4WJ6T0RA

Request body

Example request

{
  "checkout_session": {
    "refund_metadata": {
      "order_id": "8842",
      "channel": "shopify"
    },
    "amount_tax": 2500,
    "amount_shipping": 2500,
    "amount_discount": 2500,
    "payment_methods": [
      {
        "payment_method_id": "fpm_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
        "amount": 2500
      }
    ],
    "line_items": [
      {
        "amount_to_refund": 2500,
        "product": "fprod_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
        "price": "fprice_01J9XR8M3K7VZ8N2YB4WJ6T0RA"
      }
    ],
    "amount": 0
  }
}

Response

Preview of how a refund would be distributed across the session's payment methods.

Example response

{
  "allocations": [
    {
      "payment_method_id": "fpm_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
      "last4": "4242",
      "amount": 2500
    }
  ]
}

Changes

    • warning

      the / request property's max was set to 2147483647.00

    • warning

      the / request property's max was set to 2147483647.00

    • warning

      the / request property's max was set to 2147483647.00

    • warning

      the /// request property's max was set to 2147483647.00

    • warning

      the / request property's min was set to -2147483648.00

    • warning

      the / request property's min was set to -2147483648.00

    • warning

      the / request property's min was set to -2147483648.00

    • warning

      the /// request property's min was set to -2147483648.00