PersonalBusinessEnterprise
    In a rush? Schedule an Appointment
    Fetching local time...
    Anytime CapitalforBusiness
    Pricing

    Get started

    • Overview
    • Quickstart
    • Test mode
    • Guides & recipes
    • Switch from Stripe
    • Import from Shopify
    • Import from WooCommerce
    • Import from Square
    • Import a CSV file
    • Stripe API mapping
    • Pricing
    • Support
    • FAQ

    Payments

    • Checkout & website
    • Guide: Next.js checkout
    • In person (QR)
    • Payment methods
    • Stablecoin checkout
    • Guide: take stablecoins
    • Fraud rules & 3D Secure
    • Dispute evidence
    • International customers
    • Guide: safe refunds
    • Bank transfers on invoices

    Billing

    • Subscription discounts
    • Guide: sell subscriptions
    • Usage billing
    • Guide: report usage

    Money movement

    • Payout options
    • Guide: reconcile payouts
    • Accounting sync
    • Revenue analytics

    Developers

    • Authentication
    • Errors & retries
    • Pagination
    • Idempotency
    • Rate limits
    • Webhooks
    • Verify webhooks
    • Node SDK (preview)
    • CLI (preview)
    • Postman collection

    AI

    • AI agents hub
    • Safe AI agents
    • Custom agents
    • Prompt library

    Integrations

    • Website builders
    • Shopify
    • Shopify orders by invoice
    • WooCommerce
    • Zapier
    • Slack, Discord and Teams

    Reference

    • Payments
    • Refunds
    • Disputes
    • Payment links
    • Invoices
    • Customers
    • Products
    • Subscriptions & plans
    • Discount codes
    • Meters & usage events
    • Payouts & balance
    • Webhook endpoints
    • Events
    • Test helpers
    • OpenAPI spec
    • Error codes
    • Changelog
    • Glossary

    For AI tools

    • llms-full.txt
    • MCP server
    • openapi.json
    Docs menu · Discount codes

    Get started

    • Overview
    • Quickstart
    • Test mode
    • Guides & recipes
    • Switch from Stripe
    • Import from Shopify
    • Import from WooCommerce
    • Import from Square
    • Import a CSV file
    • Stripe API mapping
    • Pricing
    • Support
    • FAQ

    Payments

    • Checkout & website
    • Guide: Next.js checkout
    • In person (QR)
    • Payment methods
    • Stablecoin checkout
    • Guide: take stablecoins
    • Fraud rules & 3D Secure
    • Dispute evidence
    • International customers
    • Guide: safe refunds
    • Bank transfers on invoices

    Billing

    • Subscription discounts
    • Guide: sell subscriptions
    • Usage billing
    • Guide: report usage

    Money movement

    • Payout options
    • Guide: reconcile payouts
    • Accounting sync
    • Revenue analytics

    Developers

    • Authentication
    • Errors & retries
    • Pagination
    • Idempotency
    • Rate limits
    • Webhooks
    • Verify webhooks
    • Node SDK (preview)
    • CLI (preview)
    • Postman collection

    AI

    • AI agents hub
    • Safe AI agents
    • Custom agents
    • Prompt library

    Integrations

    • Website builders
    • Shopify
    • Shopify orders by invoice
    • WooCommerce
    • Zapier
    • Slack, Discord and Teams

    Reference

    • Payments
    • Refunds
    • Disputes
    • Payment links
    • Invoices
    • Customers
    • Products
    • Subscriptions & plans
    • Discount codes
    • Meters & usage events
    • Payouts & balance
    • Webhook endpoints
    • Events
    • Test helpers
    • OpenAPI spec
    • Error codes
    • Changelog
    • Glossary

    For AI tools

    • llms-full.txt
    • MCP server
    • openapi.json
    DocsReferenceDiscount codes

    Discount codes API

    Create and deactivate discount codes with the Anytime Capital Payments API: a percentage or amount off, with an optional use limit and expiry date.

    View as MarkdownOpen in Claude

    Codes customers enter at checkout on payment links that allow them (allowDiscountCodes): a percentage or a fixed amount off the subtotal, with an optional limit on uses and an expiry. Codes are stored upper case and are unique per business. Add ?code=FALL15 to a link's url to apply one when checkout opens.

    TopicDetail
    Endpoints`POST /api/v1/discount-codes`, `GET /api/v1/discount-codes`, `GET /api/v1/discount-codes/{id}`, `POST /api/v1/discount-codes/{id}/deactivate`
    Key permissionsdiscount_codes:write, discount_codes:read
    Samplescurl; Node.js 18+ with the built-in fetch (in an ES module); the Node SDK (preview: not on npm yet); Python with requests.
    Every request can also answer401 UNAUTHORIZED, 401 API_KEY_EXPIRED, 403 NOT_ENROLLED, 403 PERMISSION_DENIED, 403 IP_NOT_ALLOWED, 429 RATE_LIMITED, 500 INTERNAL_ERROR. See Error codes.

    On subscriptions

    Whether a code also works on subscription plans, for how many payments, and for new customers only, is set in the dashboard on the Discounts page. See Subscription discounts.

    The discount code object

    JSON
    {
      "object": "discount_code",
      "livemode": true,
      "id": "dc_311",
      "code": "FALL15",
      "percentOffBps": 1500,
      "amountOffCents": null,
      "maxRedemptions": 100,
      "redemptions": 12,
      "expiresAt": "2026-11-30T23:59:59.000Z",
      "status": "active",
      "active": true,
      "createdAt": "2026-10-01T08:00:00.000Z",
      "archivedAt": null
    }
    FieldTypeDescription
    objectstringThe type of object. Always discount_code.
    livemodebooleanFalse for test-mode data (an ak_test_ key); true for live data.
    idstringdc_…
    codestringWhat customers type, upper case.
    percentOffBpsinteger or nullPercent off in basis points (1500 is 15%).
    amountOffCentsinteger or nullAmount off. Integer cents.
    maxRedemptionsinteger or nullMost uses.
    redemptionsintegerUses so far.
    expiresAtstring (date-time) or nullExpires.
    statusstringactive, expired (past expiresAt), used_up (reached maxRedemptions) or archived (deactivated).
    activebooleanAccepted at checkout now: not expired, not used up and not deactivated.
    createdAtstring (date-time)Created.
    archivedAtstring (date-time) or nullDeactivated.

    Endpoints

    Create a discount code

    POST/api/v1/discount-codes
    Permission discount_codes:writeSupports Idempotency-Key.

    A percentage or fixed amount off. Unique per business: 409 CODE_TAKEN otherwise. Codes made here apply to payment links that allow them. To use a code on subscription plans too, turn on Use on subscriptions for it in the dashboard (see Subscription discounts).

    Headers

    Idempotency-Key
    string
    Recommended. A unique key such as a UUID: a retry with the same key within 24 hours gets the first response back instead of acting twice. See Idempotency.

    Body

    code
    stringrequired
    3–40 letters, numbers, dashes or underscores; stored upper case.
    percentOffBps
    integer or null
    Percent off in basis points: 1500 is 15%. From 1 to 10,000.
    amountOffCents
    integer or null
    Amount off, in cents. From 1 ($0.01) to 1,000,000 ($10,000.00).
    maxRedemptions
    integer or null
    Most uses. From 1 to 1,000,000.
    expiresAt
    string (date-time) or null
    When it stops working: in the future, within five years.
    Request
    curl -X POST https://anytime-capital.com/api/v1/discount-codes \
      -H "Authorization: Bearer $ANYTIME_API_KEY" \
      -H "Idempotency-Key: discount-fall15" \
      -H "Content-Type: application/json" \
      -d '{
        "code": "FALL15",
        "percentOffBps": 1500,
        "maxRedemptions": 100
      }'
    const res = await fetch("https://anytime-capital.com/api/v1/discount-codes", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.ANYTIME_API_KEY}`,
        "Content-Type": "application/json",
        "Idempotency-Key": "discount-fall15",
      },
      body: JSON.stringify({ code: "FALL15", percentOffBps: 1500, maxRedemptions: 100 }),
    });
    const discountCode = await res.json();
    if (!res.ok) throw new Error(`${discountCode.error.code}: ${discountCode.error.message}`);
    import { AnytimeCapital } from "@anytimecapital/node";
    
    const client = new AnytimeCapital({ apiKey: process.env.ANYTIME_API_KEY! });
    
    const discountCode = await client.discountCodes.create(
      { code: "FALL15", percentOffBps: 1500, maxRedemptions: 100 },
      { idempotencyKey: "discount-fall15" },
    );
    import os
    
    import requests
    
    res = requests.post(
        "https://anytime-capital.com/api/v1/discount-codes",
        headers={
            "Authorization": f"Bearer {os.environ['ANYTIME_API_KEY']}",
            "Idempotency-Key": "discount-fall15",
        },
        json={"code": "FALL15", "percentOffBps": 1500, "maxRedemptions": 100},
        timeout=30,
    )
    discountCode = res.json()
    if not res.ok:
        raise RuntimeError(f"{discountCode['error']['code']}: {discountCode['error']['message']}")
    Response 201
    {
      "object": "discount_code",
      "livemode": true,
      "id": "dc_311",
      "code": "FALL15",
      "percentOffBps": 1500,
      "amountOffCents": null,
      "maxRedemptions": 100,
      "redemptions": 0,
      "expiresAt": null,
      "status": "active",
      "active": true,
      "createdAt": "2026-10-01T08:00:00.000Z",
      "archivedAt": null
    }

    Errors

    400INVALID_JSON
    The body isn't valid JSON, or couldn't be read. An empty body reads as {}. Send Content-Type: application/json and a JSON object.
    400INVALID_INPUT
    A field, filter, limit or cursor is missing or invalid. The message starts with the field's name, as in amountCents: …, or reads Invalid cursor. Fix the named field. Don't retry the same request unchanged.
    400INVALID_IDEMPOTENCY_KEY
    The Idempotency-Key header is empty, longer than 255 characters, or has characters other than printable ASCII. Use a UUID. See Idempotency.
    409CODE_TAKEN
    The business already has a discount code with this code. Pick another code, or use the existing one.
    422IDEMPOTENCY_KEY_REUSED
    The Idempotency-Key was used in the last 24 hours with a different body or endpoint. Use a new key for a new request; reuse a key only to retry the same request.

    List discount codes

    GET/api/v1/discount-codes
    Permission discount_codes:read

    Discount codes, newest first.

    Query

    active
    boolean
    true for codes not deactivated (they may still have expired or run out: see status), false for deactivated ones.
    limit
    integer
    How many objects per page, 1–100. Default 25. See Pagination.
    cursor
    string
    The previous page's nextCursor, for the page after it.
    Request
    curl "https://anytime-capital.com/api/v1/discount-codes?active=true" \
      -H "Authorization: Bearer $ANYTIME_API_KEY"
    const res = await fetch("https://anytime-capital.com/api/v1/discount-codes?active=true", {
      headers: { Authorization: `Bearer ${process.env.ANYTIME_API_KEY}` },
    });
    const page = await res.json();
    if (!res.ok) throw new Error(`${page.error.code}: ${page.error.message}`);
    import { AnytimeCapital } from "@anytimecapital/node";
    
    const client = new AnytimeCapital({ apiKey: process.env.ANYTIME_API_KEY! });
    
    const page = await client.discountCodes.list({ active: true });
    import os
    
    import requests
    
    res = requests.get(
        "https://anytime-capital.com/api/v1/discount-codes",
        headers={"Authorization": f"Bearer {os.environ['ANYTIME_API_KEY']}"},
        params={"active": "true"},
        timeout=30,
    )
    page = res.json()
    if not res.ok:
        raise RuntimeError(f"{page['error']['code']}: {page['error']['message']}")
    Response 200
    {
      "object": "list",
      "data": [
        {
          "object": "discount_code",
          "livemode": true,
          "id": "dc_311",
          "code": "FALL15",
          "percentOffBps": 1500,
          "amountOffCents": null,
          "maxRedemptions": 100,
          "redemptions": 12,
          "expiresAt": "2026-11-30T23:59:59.000Z",
          "status": "active",
          "active": true,
          "createdAt": "2026-10-01T08:00:00.000Z",
          "archivedAt": null
        }
      ],
      "hasMore": false,
      "nextCursor": null
    }

    Errors

    400INVALID_INPUT
    A field, filter, limit or cursor is missing or invalid. The message starts with the field's name, as in amountCents: …, or reads Invalid cursor. Fix the named field. Don't retry the same request unchanged.

    Get a discount code

    GET/api/v1/discount-codes/{id}
    Permission discount_codes:read

    One discount code.

    Path

    id
    stringrequired
    dc_…
    Request
    curl https://anytime-capital.com/api/v1/discount-codes/dc_311 \
      -H "Authorization: Bearer $ANYTIME_API_KEY"
    const res = await fetch("https://anytime-capital.com/api/v1/discount-codes/dc_311", {
      headers: { Authorization: `Bearer ${process.env.ANYTIME_API_KEY}` },
    });
    const discountCode = await res.json();
    if (!res.ok) throw new Error(`${discountCode.error.code}: ${discountCode.error.message}`);
    import { AnytimeCapital } from "@anytimecapital/node";
    
    const client = new AnytimeCapital({ apiKey: process.env.ANYTIME_API_KEY! });
    
    const discountCode = await client.discountCodes.retrieve("dc_311");
    import os
    
    import requests
    
    res = requests.get(
        "https://anytime-capital.com/api/v1/discount-codes/dc_311",
        headers={"Authorization": f"Bearer {os.environ['ANYTIME_API_KEY']}"},
        timeout=30,
    )
    discountCode = res.json()
    if not res.ok:
        raise RuntimeError(f"{discountCode['error']['code']}: {discountCode['error']['message']}")
    Response 200
    {
      "object": "discount_code",
      "livemode": true,
      "id": "dc_311",
      "code": "FALL15",
      "percentOffBps": 1500,
      "amountOffCents": null,
      "maxRedemptions": 100,
      "redemptions": 12,
      "expiresAt": "2026-11-30T23:59:59.000Z",
      "status": "active",
      "active": true,
      "createdAt": "2026-10-01T08:00:00.000Z",
      "archivedAt": null
    }

    Errors

    404NOT_FOUND
    No such object on your business (an id from another business reads the same), or no such endpoint under /api/v1, which still answers in JSON. Check the id and the path. Ids are case-sensitive.

    Deactivate a discount code

    POST/api/v1/discount-codes/{id}/deactivate
    Permission discount_codes:writeSupports Idempotency-Key.

    Stop it being accepted at checkout. Safe to repeat. Payments that used it keep it; bring it back from Discounts in the dashboard.

    Path

    id
    stringrequired
    dc_…

    Headers

    Idempotency-Key
    string
    Recommended. A unique key such as a UUID: a retry with the same key within 24 hours gets the first response back instead of acting twice. See Idempotency.
    Request
    curl -X POST https://anytime-capital.com/api/v1/discount-codes/dc_311/deactivate \
      -H "Authorization: Bearer $ANYTIME_API_KEY" \
      -H "Idempotency-Key: discount-fall15-off"
    const res = await fetch("https://anytime-capital.com/api/v1/discount-codes/dc_311/deactivate", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.ANYTIME_API_KEY}`,
        "Idempotency-Key": "discount-fall15-off",
      },
    });
    const discountCode = await res.json();
    if (!res.ok) throw new Error(`${discountCode.error.code}: ${discountCode.error.message}`);
    import { AnytimeCapital } from "@anytimecapital/node";
    
    const client = new AnytimeCapital({ apiKey: process.env.ANYTIME_API_KEY! });
    
    const discountCode = await client.discountCodes.deactivate(
      "dc_311",
      { idempotencyKey: "discount-fall15-off" },
    );
    import os
    
    import requests
    
    res = requests.post(
        "https://anytime-capital.com/api/v1/discount-codes/dc_311/deactivate",
        headers={
            "Authorization": f"Bearer {os.environ['ANYTIME_API_KEY']}",
            "Idempotency-Key": "discount-fall15-off",
        },
        timeout=30,
    )
    discountCode = res.json()
    if not res.ok:
        raise RuntimeError(f"{discountCode['error']['code']}: {discountCode['error']['message']}")
    Response 200
    {
      "object": "discount_code",
      "livemode": true,
      "id": "dc_311",
      "code": "FALL15",
      "percentOffBps": 1500,
      "amountOffCents": null,
      "maxRedemptions": 100,
      "redemptions": 12,
      "expiresAt": "2026-11-30T23:59:59.000Z",
      "status": "archived",
      "active": false,
      "createdAt": "2026-10-01T08:00:00.000Z",
      "archivedAt": "2026-10-24T12:00:00.000Z"
    }

    Errors

    400INVALID_IDEMPOTENCY_KEY
    The Idempotency-Key header is empty, longer than 255 characters, or has characters other than printable ASCII. Use a UUID. See Idempotency.
    404NOT_FOUND
    No such object on your business (an id from another business reads the same), or no such endpoint under /api/v1, which still answers in JSON. Check the id and the path. Ids are case-sensitive.
    422IDEMPOTENCY_KEY_REUSED
    The Idempotency-Key was used in the last 24 hours with a different body or endpoint. Use a new key for a new request; reuse a key only to retry the same request.
    PreviousSubscriptions & plansNext Meters & usage events

    Anytime Capital is a fintech company, not a bank. Payment processing, banking and payout services are provided by Anytime Capital's licensed partners. Rates shown are for US card payments; international cards, currency conversion and disputes may carry additional fees shown in your dashboard before you accept a payment.

    On this page

    • The discount code object
    • Endpoints
    • Create a discount code
    • List discount codes
    • Get a discount code
    • Deactivate a discount code
    Anytime Capital
    (470) 748-2530
    App Store

    Business

    • Business Checking
    • Business Debit Cards
    • Payments
    • Ecommerce Payments
    • Invoicing
    • Developer Docs

    Solutions

    • CPAs & Accountants
    • Financial Advisors
    • Boat & Auto Dealerships
    • Dental & Medical Practices
    • Creators & Coaches
    • All solutions

    Crypto

    • Crypto Wallet
    • Tether Wallet
    • Buy Digital Assets
    • Explore Markets
    • Security & Licenses
    • Compare Platforms
    • Bitcoin ATM Alternative

    Company

    • Our Story
    • Schedule Appointment
    • Careers
    • Media & Press
    • Investor Relations
    • FAQ

    Branches

    • Atlanta, Georgia
    • Miami, Florida
    • Houston, Texas
    • All branches

    Legal

    • Terms & Conditions
    • Privacy Policy
    • Your Privacy Choices
    • Fraud Notice

    © 2026 Anytime Capital LLC. Anytime Capital is a fintech company, not a bank.

    The Anytime Capital Mastercard® Prepaid Card is issued by Pathward®, N.A., Member FDIC. Mastercard® is a registered trademark of Mastercard International Incorporated. All other trademarks and service marks belong to their respective owners.

    Mastercard