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

# Cancel top-up invoice

> Cancel/void an unpaid top-up invoice.
Only invoices in open state can be cancelled.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/checkout-intents/openapi.documented.yml delete /api/v1/billing/drawdown/topup/{invoiceId}
openapi: 3.0.0
info:
  title: Universal Checkout API
  version: 1.0.5
  description: >-
    Turn any product URL into a completed checkout. Instantly retrieve price,
    tax, and shipping for any product, and let users buy without ever leaving
    your native AI experience.


    View the [Rye API docs](https://docs.rye.com).
  termsOfService: https://rye.com/terms-of-service
  license:
    name: UNLICENSED
  contact:
    name: Rye
    email: dev@rye.com
    url: https://docs.rye.com
servers:
  - url: https://staging.api.rye.com
security: []
paths:
  /api/v1/billing/drawdown/topup/{invoiceId}:
    delete:
      tags:
        - Billing
      summary: Cancel top-up invoice
      description: |-
        Cancel/void an unpaid top-up invoice.
        Only invoices in open state can be cancelled.
      operationId: CancelTopUpInvoice
      parameters:
        - description: The Stripe invoice ID to cancel
          in: path
          name: invoiceId
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No Content
        '400':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  message:
                    type: string
                required:
                  - message
                type: object
        '401':
          description: Authentication Failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationError'
        '404':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  message:
                    type: string
                required:
                  - message
                type: object
        '409':
          description: ''
          content:
            application/json:
              schema:
                properties:
                  status:
                    type: string
                  invoiceId:
                    type: string
                  message:
                    type: string
                required:
                  - status
                  - invoiceId
                  - message
                type: object
      security:
        - bearerAuth:
            - billing:write
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import CheckoutIntents from 'checkout-intents';

            const client = new CheckoutIntents({
              apiKey: process.env['CHECKOUT_INTENTS_API_KEY'], // This is the default and can be omitted
            });

            await client.billing.cancelTopupInvoice('invoiceId');
        - lang: Python
          source: |-
            import os
            from checkout_intents import CheckoutIntents

            client = CheckoutIntents(
                api_key=os.environ.get("CHECKOUT_INTENTS_API_KEY"),  # This is the default and can be omitted
            )
            client.billing.cancel_topup_invoice(
                "invoiceId",
            )
        - lang: Java
          source: |-
            package com.rye.example;

            import com.rye.client.CheckoutIntentsClient;
            import com.rye.client.okhttp.CheckoutIntentsOkHttpClient;
            import com.rye.models.billing.BillingCancelTopupInvoiceParams;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    CheckoutIntentsClient client = CheckoutIntentsOkHttpClient.fromEnv();

                    client.billing().cancelTopupInvoice("invoiceId");
                }
            }
        - lang: cURL
          source: >-
            curl
            https://staging.api.rye.com/api/v1/billing/drawdown/topup/$INVOICE_ID
            \
                -X DELETE \
                -H "Authorization: Bearer $CHECKOUT_INTENTS_API_KEY"
components:
  schemas:
    AuthenticationError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
      required:
        - name
        - message
      type: object
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Rye API key

````