---
title: "Editar meio de pagamento da assinatura"
url: "https://devcenter.stone.com.br/apis/v5-docs-legacy/versions/b9aaff36-6dcc-4353-8398-836d6c13dfa5/operations/editar-meio-de-pagamento-da-assinatura"
---

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

# Editar meio de pagamento da assinatura

`PATCH` `/subscriptions/{subscription_id}/payment-method`

Operation ID: `editar-meio-de-pagamento-da-assinatura`

Com o verbo HTTP PATCH, através do identificador da assinatura (`subscription_id`) é possível atualizar o meio de pagamento da assinatura.

## 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}/payment-method:
    patch:
      summary: Editar meio de pagamento da assinatura
      description: Com o verbo HTTP PATCH, através do identificador da assinatura
        (`subscription_id`) é possível atualizar o meio de pagamento da
        assinatura.
      operationId: editar-meio-de-pagamento-da-assinatura
      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
              properties:
                payment_method:
                  type: string
                  description: 'Meio de pagamento.<br>Valores possíveis: **credit_card**,
                    **boleto**, **cash** ou **debit_card** . Deve-se adicionar o
                    meio de pagamento após o objeto "payment_method"'
                card:
                  type: object
                  description: Dados do novo cartão. <br>**Obrigatório** , caso o `payment_method`
                    escolhido seja `credit_card` e o `card_id` e o `card_token`
                    não sejam informados.
                  properties: {}
                card_id:
                  type: string
                  description: Código do novo cartão.<br>**Obrigatório** , caso o `payment_method`
                    escolhido seja `credit_card` e o objeto `card` e o
                    `card_token` não sejam informados.
                card_token:
                  type: string
                  description: Token do novo cartão. <br>**Obrigatório** , caso o `payment_method`
                    escolhido seja `credit_card` e o `card_id` e o `card` não
                    sejam informados.<br>[Saiba mais token de
                    cartão](https://docs.pagar.me/reference/criar-token-cart%C3%A3o-1)
            examples:
              JSON (to boleto):
                value:
                  payment_method: boleto
              JSON (to credit card by Id):
                value:
                  payment_method: credit_card
                  card_id: card_PoDev5OCEEUjRJXp
      responses:
        "200":
          description: "200"
          content:
            application/json:
              examples:
                OK (to boleto):
                  value: >-
                    {
                      "id": "sub_05jkdIfGYPfN26mI",
                      "payment_method": "boleto",
                      "currency": "BRL",
                      "interval": "month",
                      "interval_count": 3,
                      "billing_type": "prepaid",
                      "gateway_affiliation_id":"C56A4180-65AA-42EC-A945-5FD21DEC0538",
                      "boleto_due_days":5,
                      "minimum_price": 10000,
                      "current_period": {
                        "start_at": "2016-07-19T00:00:00Z",
                        "end_at": "2016-10-18T23:59:59Z"
                      },
                      "next_billing_at": "2016-10-19T00:00:00Z",
                      "installments": 3,
                      "customer": {
                        "id": "cus_017228NmffGbA3d4",
                        "name": "Luke Skywalker",
                        "email": "lskywalker@r2d2.com",
                        "delinquent": false,
                        "created_at": "2016-07-12T18:25:40Z",
                        "updated_at": "2016-07-12T18:25:40Z"
                      },
                      "discounts": [
                        {
                          "id": "si_k2zpBDMsOs0fDfHe",
                          "cycles": 3,
                          "value": 10,
                          "discount_type": "percentage",
                          "created_at": "2016-07-12T18:25:40Z"
                        }
                      ],
                      "increments": [
                        {
                          "id": "inc_IYzpxgjsOs0fDIoP",
                          "cycles": 2,
                          "value": 20,
                          "discount_type": "percentage",
                          "created_at": "2016-07-12T18:25:40Z"
                        }
                      ],
                      "items": [
                        {
                          "id": "si_B6555Riyq9lj6klS",
                          "description": "Musculação",
                          "quantity": 1,
                          "pricing_scheme": {
                            "price": 18990,
                            "scheme_type": "unit"
                          },
                          "status": "active",
                          "created_at": "2016-07-12T18:25:40Z",
                          "updated_at": "2016-07-12T18:25:40Z"
                        },
                        {
                          "id": "si_lFjtC2xYGttulJpn",
                          "description": "Matrícula",
                          "quantity": 1,
                          "cycles": 1,
                          "pricing_scheme": {
                            "price": 5990,
                            "scheme_type": "unit"
                          },
                          "status": "active",
                          "created_at": "2016-07-12T18:25:40Z",
                          "updated_at": "2016-07-12T18:25:40Z"
                        }
                      ],
                      "status": "active",
                      "created_at": "2016-07-12T18:25:40Z",
                      "updated_at": "2016-07-12T18:25:40Z",
                      "metadata": {
                        "id": "my_subscription_id"
                      }
                    }
                OK (to credit card by Id):
                  value: >-
                    {
                        "id": "sub_WeEMlp2FXFMjVq3Q",
                        "code": "8YNU49TD4Z",
                        "start_at": "2018-04-05T00:00:00Z",
                        "interval": "month",
                        "interval_count": 1,
                        "billing_type": "postpaid",
                        "current_cycle": {
                            "id": "cycle_6ow0JqhD5sJmMJPl",
                            "start_at": "2018-04-05T00:00:00Z",
                            "end_at": "2018-05-04T23:59:59Z",
                            "billing_at": "2018-05-05T00:00:00Z"
                        },
                        "setup": {
                            "id": "or_0Wd7bYRMSmSYy8qz",
                            "description": "Inscrição",
                            "amount": 9990,
                            "status": "paid"
                        },
                        "next_billing_at": "2018-05-05T00:00:00Z",
                        "payment_method": "credit_card",
                        "currency": "BRL",
                        "statement_descriptor": "Spotify",
                        "installments": 1,
                        "status": "active",
                        "created_at": "2018-04-05T03:20:16Z",
                        "updated_at": "2018-04-05T03:20:16Z",
                        "customer": {
                            "id": "cus_px3yqRSlRsVqawgj",
                            "name": "Tony Stark",
                            "email": "ef61ded5-9e60-40c7-89cd-a3b6e70515e8@avengers.com",
                            "delinquent": false,
                            "created_at": "2018-04-05T03:20:15Z",
                            "updated_at": "2018-04-05T03:20:15Z",
                            "phones": {}
                        },
                        "card": {
                            "id": "card_PoDev5OCEEUjRJXp",
                            "first_six_digits": "542501",
                            "last_four_digits": "7793",
                            "brand": "Mastercard",
                            "holder_name": "Tony Stark",
                            "exp_month": 1,
                            "exp_year": 2022,
                            "status": "active",
                            "created_at": "2018-04-05T04:05:02Z",
                            "updated_at": "2018-04-05T04:05:02Z",
                            "billing_address": {
                                "street": "Malibu Point",
                                "number": "10880",
                                "zip_code": "90265",
                                "neighborhood": "Central Malibu",
                                "city": "Malibu",
                                "state": "CA",
                                "country": "US",
                                "line_1": "10880, Malibu Point, Central Malibu"
                            },
                            "type": "credit"
                        },
                        "plan": {
                            "id": "plan_dxVldzsgzu9rpe8v",
                            "name": "Premium",
                            "description": "Vá de Premium. E seja feliz!",
                            "url": "/plans/plan_dxVldzsgzu9rpe8v/vodafone-teste/premium",
                            "statement_descriptor": "Spotify",
                            "interval": "month",
                            "interval_count": 1,
                            "billing_type": "postpaid",
                            "payment_methods": [
                                "boleto",
                                "credit_card"
                            ],
                            "installments": [
                                1
                            ],
                            "status": "active",
                            "currency": "BRL",
                            "created_at": "2018-04-04T22:17:16Z",
                            "updated_at": "2018-04-04T22:17:16Z"
                        },
                        "items": [
                            {
                                "id": "si_5LPVYR1c7WuJd06l",
                                "name": "Name - Premium",
                                "description": "Test - Description",
                                "quantity": 1,
                                "status": "active",
                                "created_at": "2018-04-05T03:20:16Z",
                                "updated_at": "2018-04-05T03:20:16Z",
                                "pricing_scheme": {
                                    "price": 1490,
                                    "scheme_type": "unit"
                                }
                            }
                        ]
                    }
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: sub_WeEMlp2FXFMjVq3Q
                  code:
                    type: string
                    example: 8YNU49TD4Z
                  start_at:
                    type: string
                    example: 2018-04-05T00:00:00Z
                  interval:
                    type: string
                    example: month
                  interval_count:
                    type: integer
                    example: 1
                    default: 0
                  billing_type:
                    type: string
                    example: postpaid
                  current_cycle:
                    type: object
                    properties:
                      id:
                        type: string
                        example: cycle_6ow0JqhD5sJmMJPl
                      start_at:
                        type: string
                        example: 2018-04-05T00:00:00Z
                      end_at:
                        type: string
                        example: 2018-05-04T23:59:59Z
                      billing_at:
                        type: string
                        example: 2018-05-05T00:00:00Z
                  setup:
                    type: object
                    properties:
                      id:
                        type: string
                        example: or_0Wd7bYRMSmSYy8qz
                      description:
                        type: string
                        example: Inscrição
                      amount:
                        type: integer
                        example: 9990
                        default: 0
                      status:
                        type: string
                        example: paid
                  next_billing_at:
                    type: string
                    example: 2018-05-05T00:00:00Z
                  payment_method:
                    type: string
                    example: credit_card
                  currency:
                    type: string
                    example: BRL
                  statement_descriptor:
                    type: string
                    example: Spotify
                  installments:
                    type: integer
                    example: 1
                    default: 0
                  status:
                    type: string
                    example: active
                  created_at:
                    type: string
                    example: 2018-04-05T03:20:16Z
                  updated_at:
                    type: string
                    example: 2018-04-05T03:20:16Z
                  customer:
                    type: object
                    properties:
                      id:
                        type: string
                        example: cus_px3yqRSlRsVqawgj
                      name:
                        type: string
                        example: Tony Stark
                      email:
                        type: string
                        example: ef61ded5-9e60-40c7-89cd-a3b6e70515e8@avengers.com
                      delinquent:
                        type: boolean
                        example: false
                        default: true
                      created_at:
                        type: string
                        example: 2018-04-05T03:20:15Z
                      updated_at:
                        type: string
                        example: 2018-04-05T03:20:15Z
                      phones:
                        type: object
                        properties: {}
                  card:
                    type: object
                    properties:
                      id:
                        type: string
                        example: card_PoDev5OCEEUjRJXp
                      first_six_digits:
                        type: string
                        example: "542501"
                      last_four_digits:
                        type: string
                        example: "7793"
                      brand:
                        type: string
                        example: Mastercard
                      holder_name:
                        type: string
                        example: Tony Stark
                      exp_month:
                        type: integer
                        example: 1
                        default: 0
                      exp_year:
                        type: integer
                        example: 2022
                        default: 0
                      status:
                        type: string
                        example: active
                      created_at:
                        type: string
                        example: 2018-04-05T04:05:02Z
                      updated_at:
                        type: string
                        example: 2018-04-05T04:05:02Z
                      billing_address:
                        type: object
                        properties:
                          street:
                            type: string
                            example: Malibu Point
                          number:
                            type: string
                            example: "10880"
                          zip_code:
                            type: string
                            example: "90265"
                          neighborhood:
                            type: string
                            example: Central Malibu
                          city:
                            type: string
                            example: Malibu
                          state:
                            type: string
                            example: CA
                          country:
                            type: string
                            example: US
                          line_1:
                            type: string
                            example: 10880, Malibu Point, Central Malibu
                      type:
                        type: string
                        example: credit
                  plan:
                    type: object
                    properties:
                      id:
                        type: string
                        example: plan_dxVldzsgzu9rpe8v
                      name:
                        type: string
                        example: Premium
                      description:
                        type: string
                        example: Vá de Premium. E seja feliz!
                      url:
                        type: string
                        example: /plans/plan_dxVldzsgzu9rpe8v/vodafone-teste/premium
                      statement_descriptor:
                        type: string
                        example: Spotify
                      interval:
                        type: string
                        example: month
                      interval_count:
                        type: integer
                        example: 1
                        default: 0
                      billing_type:
                        type: string
                        example: postpaid
                      payment_methods:
                        type: array
                        items:
                          type: string
                          example: boleto
                      installments:
                        type: array
                        items:
                          type: integer
                          example: 1
                          default: 0
                      status:
                        type: string
                        example: active
                      currency:
                        type: string
                        example: BRL
                      created_at:
                        type: string
                        example: 2018-04-04T22:17:16Z
                      updated_at:
                        type: string
                        example: 2018-04-04T22:17:16Z
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          example: si_5LPVYR1c7WuJd06l
                        name:
                          type: string
                          example: Name - Premium
                        description:
                          type: string
                          example: Test - Description
                        quantity:
                          type: integer
                          example: 1
                          default: 0
                        status:
                          type: string
                          example: active
                        created_at:
                          type: string
                          example: 2018-04-05T03:20:16Z
                        updated_at:
                          type: string
                          example: 2018-04-05T03:20:16Z
                        pricing_scheme:
                          type: object
                          properties:
                            price:
                              type: integer
                              example: 1490
                              default: 0
                            scheme_type:
                              type: string
                              example: unit
        "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": {
                            "": [
                                "The card_id, card_token or card field is required."
                            ]
                        },
                        "request": {
                            "payment_method": "credit_card"
                        }
                    }
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The request is invalid.
                  errors:
                    type: object
                    properties:
                      "":
                        type: array
                        items:
                          type: string
                          example: The card_id, card_token or card field is required.
                  request:
                    type: object
                    properties:
                      payment_method:
                        type: string
                        example: credit_card
      deprecated: false
security:
  - sec0: []
components:
  securitySchemes:
    sec0:
      type: http
      scheme: basic
```
