---
title: "AP2 Cancel credit purchase"
method: POST
path: "/api/v1/commerce/ap2/carts/{id}/cancel"
tags: ["commerce"]
---

# AP2 Cancel credit purchase

`POST /api/v1/commerce/ap2/carts/{id}/cancel`

## Request

- Base URL: `https://singlefax.com`
- URL: `https://singlefax.com/api/v1/commerce/ap2/carts/{id}/cancel`
- Auth: API key in header `Authorization`

Human-present AP2 v0.1.0 merchant flow. Requires credits:checkout, a signed cart, a Stripe SPT and separate owner passkey approval before charging. The cart is the payment idempotency boundary. See /ap2.md.

## Path parameters

- `id` string, required

## Headers

- `Idempotency-Key` string, required

## Request body

- object

## Response `200`

Cart state; completed only after credit ledger fulfillment

- object
  - `id` string, required
  - `status` 'awaiting_mandate' | 'awaiting_approval' | 'approved' | 'processing' | 'requires_action' | 'completed' | 'failed' | 'canceled', required
  - `ap2.mandates.CartMandate` object, required
    - `contents` object, required
      - `id` string, required
      - `user_cart_confirmation_required` true, required
      - `merchant_name` 'SingleFax', required
      - `cart_expiry` string, date-time, required
      - `payment_request` object, required
        - `method_data` object[], required
          - `supported_methods` 'https://stripe.com/shared-payment-token', required
          - `data` object
            - `stripe_profile_id` string, required
        - `details` object, required
          - `id` string, required
          - `display_items` object[], required
            - `label` string, required
            - `amount` object, required
              - …
            - `refund_period` 0, required
          - `total` object, required
            - `label` string, required
            - `amount` object, required
              - …
            - `refund_period` 0, required
        - `options` object, required
          - `request_shipping` false, required
    - `merchant_authorization` string, required: EdDSA compact JWS over the RFC 8785 contents hash
  - `user_authorization` string
  - `approval_url` string, uri
  - `receipt` string
  - `documentation_url` string, uri, required

## Other responses

- `4XX`: Invalid mandate, scope, environment, approval or state
- `5XX`: Payment outcome uncertain or service unavailable; retry the same cart/mandate

---

[API](https://skmtc.dev/singlefax/apis/singlefax-api.md) · [All operations](https://skmtc.dev/singlefax/apis/singlefax-api/llms.txt) · [OpenAPI document](https://skmtc.dev/singlefax/apis/singlefax-api/revisions/f6fdbfac1e25?raw)
