---
agentTools:
  projectIndex: https://zafepay.readme.io/llms.txt
---

# Update subscription

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Onlypays",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.staging.zafepay.com/api"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "x-bearer-format": "bearer"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v1/integration/subscriptions/{subscription_id}": {
      "put": {
        "summary": "Update subscription",
        "description": "",
        "operationId": "update-subscription-extra-fields",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "Header to access api endpoints (Check the authentication section).",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subscription": {
                    "properties": {
                      "name": {
                        "type": "string",
                        "description": "Name of the Subscription to be created."
                      },
                      "description": {
                        "type": "string",
                        "description": "A description for the Subscription."
                      },
                      "recurrence": {
                        "type": "string",
                        "description": "Recurrence of the Subscription charge. The following values ​​are available: \"week\" (weekly charge), \"month\" (monthly charge), \"bimonth\" (charge every two months), \"quarter\" (quarterly charge), \"semester\" (semester charge), \"year\" (year charge) and \"custom\" (personalized charge. If you choose this option you must send in the custom_recurrence_amount attribute how often do you want to charge the Subscription).",
                        "enum": [
                          "week",
                          "month",
                          "bimonth",
                          "quarter",
                          "semester",
                          "year",
                          "custom"
                        ]
                      },
                      " custom_recurrence_amount": {
                        "type": "string",
                        "description": "Specify how often you want to charge the Subscription in case you choose custom recurrence (in days)."
                      },
                      "cumulative_debt": {
                        "type": "boolean",
                        "description": "In this field you can define if you want future installments to continue to be created in case of having any debt. It is false by default, that is, if an installment cannot be charged for a subscription_buyer to this Subscription, the next one will not be generated. If this attribute is true, the installments will be generated automatically regardless of any debt, which would accumulate."
                      },
                      "start_at": {
                        "type": "string",
                        "description": "If you want to start charging in a specific date (in ISO 8601 format). If not, the first charge will be when a customer subsribe for the Subscription.",
                        "format": "date"
                      },
                      " periods": {
                        "type": "integer",
                        "description": "If you want to charge x number of times for the Subscription.",
                        "format": "int32"
                      },
                      " expiration_time": {
                        "type": "string",
                        "description": "You can define a date for stop accepting subscription_buyers to the Subscription (in ISO 8601 format).",
                        "format": "date"
                      },
                      " dop": {
                        "type": "integer",
                        "description": "You can define a scpecific day of payment for all the customers that are subscribed to this subscription. If not, the day of payment depends on the day each customer subscribe.",
                        "format": "int32"
                      },
                      " has_apportion": {
                        "type": "boolean",
                        "description": "If you want the Subscription to be charged on a prorated basis (default false)."
                      },
                      "success_url": {
                        "type": "string",
                        "description": "A URL to redirect your clients when the payment of the Subscription is successful."
                      },
                      "failure_url": {
                        "type": "string",
                        "description": "A URL to redirect your clients when the payment of the Subscription fails."
                      },
                      "status": {
                        "type": "string",
                        "description": "The status of the Subscription. It can be \"active\" (default) or \"inactive\". If you change the status to inactive, all registrations for this Subscription will be canceled and unpaid installments will not be charged (the pending and expired installments of the subscription_buyers).",
                        "enum": [
                          "active",
                          "inactive"
                        ]
                      },
                      "image": {
                        "type": "string",
                        "description": "An image for the Subscription.",
                        "format": "binary"
                      },
                      "extra_fields": {
                        "type": "array",
                        "description": "Extra fields that your customers can fill out when buying or subscribing to this Subscription (Independent of these extra fields, the email and the name are always requested).",
                        "items": {
                          "properties": {
                            "id": {
                              "type": "string",
                              "description": "The id of the extra field that you want to edit, if applicable."
                            },
                            "name": {
                              "type": "string",
                              "description": "The name of the extra field you wan to ask for your customer."
                            },
                            "mandatory": {
                              "type": "boolean",
                              "description": "If the extra field is mandatory to answer (default false)."
                            },
                            "remove_extra_field": {
                              "type": "boolean",
                              "description": "If you want to remove the extra field from the Subscription"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "external_id": {
                        "type": "string",
                        "description": "An external id to identify the subscription."
                      }
                    },
                    "required": [],
                    "type": "object",
                    "description": "Envelops the message content."
                  },
                  "products": {
                    "type": "array",
                    "description": "The products you want to offer in this Subscription. A Subscription cannot be left without an associated Product.",
                    "items": {
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "The id of the product you want to add to the Subscription, if applicable."
                        },
                        "quantity": {
                          "type": "integer",
                          "description": "The quantity of the product you want to add to the Subscription.",
                          "format": "int32"
                        },
                        "remove_subscription_product": {
                          "type": "boolean",
                          "description": "If you want to remove the product from the Subscription set this value to true."
                        }
                      },
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"data\": {\n        \"id\": \"a3a50c65-0dbc-4fd9-9735-b3c36feb37ea\",\n        \"created_at\": \"2023-10-07T12:49:32\",\n        \"custom_recurrence_amount\": 0,\n        \"dop\": null,\n        \"expiration_time\": null,\n        \"external_id\": \"subs1\",\n        \"extra_fields\": [\n            {\n                \"id\": \"f2d4dc86-dfee-4667-9462-6eb5207599aa\",\n                \"mandatory\": true,\n                \"question\": \"Rut\"\n            }\n        ],\n        \"has_apportion\": null,\n        \"inscription_link\": \"http://localhost:8080/subscriptions/a3a50c65-0dbc-4fd9-9735-b3c36feb37ea\",\n        \"name\": \"July gym subscription\",\n        \"periods\": null,\n        \"products\": [\n            {\n                \"id\": \"219bbac0-c429-4803-8ef4-7965945665ac\",\n                \"created_at\": \"2023-10-06T22:57:53\",\n                \"currency\": \"CLP\",\n                \"description\": \"First semester 2023\",\n                \"external_id\": \"001\",\n                \"image\": null,\n                \"name\": \"Boxing classes\",\n                \"status\": \"active\",\n                \"updated_at\": \"2023-10-06T22:57:53\",\n                \"value\": 40990\n            }\n        ],\n        \"promotional_discount_percentage\": null,\n\t\t\t\t\"promotional_periods\": null,\n        \"recurrence\": \"month\",\n        \"start_at\": null,\n        \"status\": \"active\",\n        \"updated_at\": \"2023-10-10T14:33:51\",\n        \"value\": 40990\n    }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "a3a50c65-0dbc-4fd9-9735-b3c36feb37ea"
                        },
                        "created_at": {
                          "type": "string",
                          "example": "2023-10-07T12:49:32"
                        },
                        "custom_recurrence_amount": {
                          "type": "integer",
                          "example": 0,
                          "default": 0
                        },
                        "dop": {},
                        "expiration_time": {},
                        "external_id": {
                          "type": "string",
                          "example": "subs1"
                        },
                        "extra_fields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "example": "f2d4dc86-dfee-4667-9462-6eb5207599aa"
                              },
                              "mandatory": {
                                "type": "boolean",
                                "example": true,
                                "default": true
                              },
                              "question": {
                                "type": "string",
                                "example": "Rut"
                              }
                            }
                          }
                        },
                        "has_apportion": {},
                        "inscription_link": {
                          "type": "string",
                          "example": "http://localhost:8080/subscriptions/a3a50c65-0dbc-4fd9-9735-b3c36feb37ea"
                        },
                        "name": {
                          "type": "string",
                          "example": "July gym subscription"
                        },
                        "periods": {},
                        "products": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "example": "219bbac0-c429-4803-8ef4-7965945665ac"
                              },
                              "created_at": {
                                "type": "string",
                                "example": "2023-10-06T22:57:53"
                              },
                              "currency": {
                                "type": "string",
                                "example": "CLP"
                              },
                              "description": {
                                "type": "string",
                                "example": "First semester 2023"
                              },
                              "external_id": {
                                "type": "string",
                                "example": "001"
                              },
                              "image": {},
                              "name": {
                                "type": "string",
                                "example": "Boxing classes"
                              },
                              "status": {
                                "type": "string",
                                "example": "active"
                              },
                              "updated_at": {
                                "type": "string",
                                "example": "2023-10-06T22:57:53"
                              },
                              "value": {
                                "type": "integer",
                                "example": 40990,
                                "default": 0
                              }
                            }
                          }
                        },
                        "promotional_discount_percentage": {},
                        "promotional_periods": {},
                        "recurrence": {
                          "type": "string",
                          "example": "month"
                        },
                        "start_at": {},
                        "status": {
                          "type": "string",
                          "example": "active"
                        },
                        "updated_at": {
                          "type": "string",
                          "example": "2023-10-10T14:33:51"
                        },
                        "value": {
                          "type": "integer",
                          "example": 40990,
                          "default": 0
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "security": []
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "64c97d0ad3b2f2002d150a5d:64e923d629d07800609d3afb"
}
```