---
title: "Incluir desconto"
url: "https://devcenter.stone.com.br/apis/v5-docs-legacy/versions/b9aaff36-6dcc-4353-8398-836d6c13dfa5/operations/incluir-desconto-1"
---

> Full API specification: https://devcenter.stone.com.br/apis/v5-docs-legacy/versions/b9aaff36-6dcc-4353-8398-836d6c13dfa5.md

# Incluir desconto

`POST` `/subscriptions/{subscription_id}/discounts`

Operation ID: `incluir-desconto-1`

Este recurso permite adicionar um desconto, através do identificador da assinatura (`subscription_id`).

## Path parameters

- `subscription_id` (string, required) - Código da assinatura.<br>Formato `sub_XXXXXXXXXXXXXXXX`

## Request body

Content types: `application/json`

## Responses

- `200` - 200
- `404` - 404
- `422` - 422

## OpenAPI definition

```yaml
openapi: 3.1.0
info:
  title: Pagar.me v5 API (Legado)
  version: 5.0.0
servers:
  - url: https://api.stone.com.br/core/v5
paths:
  /subscriptions/{subscription_id}/discounts:
    post:
      summary: Incluir desconto
      description: Este recurso permite adicionar um desconto, através do
        identificador da assinatura (`subscription_id`).
      operationId: incluir-desconto-1
      parameters:
        - name: subscription_id
          in: path
          description: Código da assinatura.<br>Formato `sub_XXXXXXXXXXXXXXXX`
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - value
                - discount_type
              properties:
                value:
                  type: string
                  description: Valor do desconto.
                discount_type:
                  type: string
                  description: "Tipo do desconto. <br>Valores possíveis: **flat** ou
                    **percentage**. O padrão é **percentage**"
                cycles:
                  type: string
                  description: Indica quantas vezes o desconto será aplicado. <br>Caso não seja
                    informado, o desconto será aplicado até que o item seja
                    excluído
                item_id:
                  type: string
                  description: "Código do item da assinatura. <br>Formato: `si_XXXXXXXXXXXXXXXX`
                    <br>Caso seja informado, o desconto será aplicado no item.
                    Max: 36 caracteres"
            examples:
              Request Example:
                value:
                  value: 10
                  discount_type: percentage
                  cycles: "1"
                  item_id: si_GyL1lmGU6tOXYr2O
      responses:
        "200":
          description: "200"
          content:
            application/json:
              examples:
                Result:
                  value: |-
                    {
                      "id": "dis_LP4j5dXztPSj5A02",
                        "value": 10,
                        "discount_type": "percentage",
                        "cycles": 1,
                        "status": "active",
                        "created_at": "2019-05-22T14:23:55Z",
                        "updated_at": "2019-05-22T14:23:55Z",
                        "subscription": {
                            "id": "sub_DvPanXLsqcQnk8e1",
                            "code": "5Z7ZU01F60",
                            "start_at": "2019-05-22T00:00:00Z",
                            "interval": "day",
                            "interval_count": 1,
                            "billing_type": "prepaid",
                            "next_billing_at": "2019-05-25T00:00:00Z",
                            "payment_method": "credit_card",
                            "currency": "BRL",
                            "installments": 1,
                            "minimum_price": 10,
                            "status": "active",
                            "boleto_due_days": 5,
                            "created_at": "2019-05-22T14:05:49Z",
                            "updated_at": "2019-05-22T14:21:51Z"
                      }
                    }
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: dis_LP4j5dXztPSj5A02
                  value:
                    type: integer
                    example: 10
                    default: 0
                  discount_type:
                    type: string
                    example: percentage
                  cycles:
                    type: integer
                    example: 1
                    default: 0
                  status:
                    type: string
                    example: active
                  created_at:
                    type: string
                    example: 2019-05-22T14:23:55Z
                  updated_at:
                    type: string
                    example: 2019-05-22T14:23:55Z
                  subscription:
                    type: object
                    properties:
                      id:
                        type: string
                        example: sub_DvPanXLsqcQnk8e1
                      code:
                        type: string
                        example: 5Z7ZU01F60
                      start_at:
                        type: string
                        example: 2019-05-22T00:00:00Z
                      interval:
                        type: string
                        example: day
                      interval_count:
                        type: integer
                        example: 1
                        default: 0
                      billing_type:
                        type: string
                        example: prepaid
                      next_billing_at:
                        type: string
                        example: 2019-05-25T00:00:00Z
                      payment_method:
                        type: string
                        example: credit_card
                      currency:
                        type: string
                        example: BRL
                      installments:
                        type: integer
                        example: 1
                        default: 0
                      minimum_price:
                        type: integer
                        example: 10
                        default: 0
                      status:
                        type: string
                        example: active
                      boleto_due_days:
                        type: integer
                        example: 5
                        default: 0
                      created_at:
                        type: string
                        example: 2019-05-22T14:05:49Z
                      updated_at:
                        type: string
                        example: 2019-05-22T14:21:51Z
        "404":
          description: "404"
          content:
            application/json:
              examples:
                Result:
                  value: |-
                    {
                      "message": "Subscription not found."
                    }
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Subscription not found.
        "422":
          description: "422"
          content:
            application/json:
              examples:
                Result:
                  value: >-
                    {
                      "message": "The request is invalid.",
                      "errors": {
                        "discount.discount_type": [
                          "The discount_type field is invalid. Possible values are 'flat' or 'percentage'."
                        ]
                      },
                      "request": {
                        "discount_type": "null",
                        "value": 10
                      }
                    }
              schema:
                oneOf:
                  - type: object
                    properties:
                      message:
                        type: string
                        example: The request is invalid.
                      errors:
                        type: object
                        properties:
                          discount.value:
                            type: array
                            items:
                              type: string
                              example: The value field should be greater than the zero.
                      request:
                        type: object
                        properties:
                          discount_type:
                            type: string
                            example: percentage
                  - type: object
                    properties:
                      message:
                        type: string
                        example: The request is invalid.
                      errors:
                        type: object
                        properties:
                          discount.discount_type:
                            type: array
                            items:
                              type: string
                              example: The discount_type field is invalid. Possible values are 'flat' or
                                'percentage'.
                      request:
                        type: object
                        properties:
                          discount_type:
                            type: string
                            example: "null"
                          value:
                            type: integer
                            example: 10
                            default: 0
      deprecated: false
security:
  - sec0: []
components:
  securitySchemes:
    sec0:
      type: http
      scheme: basic
```
