Recharge Discounts API

Discount codes applied to checkouts, addresses, and charges.

OpenAPI Specification

recharge-payments-discounts-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Recharge Addresses Discounts API
  description: The Recharge API is a REST API (with a few RPC-style action endpoints) for building and operating subscription and recurring-billing commerce on top of Recharge. It has predictable, resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP status codes and verbs. All requests are made over HTTPS to https://api.rechargeapps.com and authenticated with a store API token passed in the X-Recharge-Access-Token header. The API is versioned via the X-Recharge-Version header; supported versions are 2021-11 (recommended) and 2021-01. This document grounds a representative subset of the public surface - Subscriptions, Customers, Orders, Charges, Products, Addresses, Payment Methods, Onetimes, Discounts, and Webhook endpoints. See developer.rechargepayments.com for the complete reference.
  version: 2021-11
  contact:
    name: Recharge
    url: https://developer.rechargepayments.com
  termsOfService: https://getrecharge.com/legal
servers:
- url: https://api.rechargeapps.com
  description: Recharge API
security:
- apiToken: []
tags:
- name: Discounts
  description: Discount codes applied to checkouts, addresses, and charges.
paths:
  /discounts:
    get:
      operationId: listDiscounts
      tags:
      - Discounts
      summary: List discounts
      responses:
        '200':
          description: A list of discounts.
          content:
            application/json:
              schema:
                type: object
                properties:
                  discounts:
                    type: array
                    items:
                      $ref: '#/components/schemas/Discount'
    post:
      operationId: createDiscount
      tags:
      - Discounts
      summary: Create a discount
      responses:
        '201':
          description: The created discount.
  /discounts/{id}:
    parameters:
    - $ref: '#/components/parameters/Id'
    get:
      operationId: getDiscount
      tags:
      - Discounts
      summary: Retrieve a discount
      responses:
        '200':
          description: The requested discount.
    put:
      operationId: updateDiscount
      tags:
      - Discounts
      summary: Update a discount
      responses:
        '200':
          description: The updated discount.
    delete:
      operationId: deleteDiscount
      tags:
      - Discounts
      summary: Delete a discount
      responses:
        '204':
          description: The discount was deleted.
components:
  schemas:
    Discount:
      type: object
      properties:
        id:
          type: integer
          format: int64
        code:
          type: string
        value:
          type: string
        value_type:
          type: string
          enum:
          - percentage
          - fixed_amount
        status:
          type: string
          enum:
          - enabled
          - disabled
          - fully_disabled
  parameters:
    Id:
      name: id
      in: path
      required: true
      description: The unique identifier of the resource.
      schema:
        type: integer
        format: int64
  securitySchemes:
    apiToken:
      type: apiKey
      in: header
      name: X-Recharge-Access-Token
      description: Store API token generated in the Recharge merchant portal under Apps and integrations.