This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Update subscription

PUT https://api-sandbox.payabli.com/api/Subscription/{subId}
Content-Type: application/json

Updates a subscription's details.

Reference: https://docs.payabli.com/developers/api-reference/subscription/update-subscription

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: payabliApi
  version: 1.0.0
paths:
  /Subscription/{subId}:
    put:
      operationId: update-subscription
      summary: Update a subscription
      description: Updates a subscription's details.
      tags:
        - subpackage_subscription
      parameters:
        - name: subId
          in: path
          description: 'The subscription ID. '
          required: true
          schema:
            type: integer
        - name: requestToken
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/type_subscription:UpdateSubscriptionResponse
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                paymentDetails:
                  $ref: '#/components/schemas/type_:PaymentDetail'
                  description: >-
                    Object describing details of the payment. To skip the
                    payment, set the `totalAmount` to 0. Payments will be paused
                    until the amount is updated to a non-zero value. When
                    `totalAmount` is set to 0, the `serviceFee` must also be set
                    to 0.
                scheduleDetails:
                  $ref: '#/components/schemas/type_:ScheduleDetail'
                  description: Object describing the schedule for subscription
                setPause:
                  $ref: '#/components/schemas/type_subscription:SetPause'
servers:
  - url: https://api-sandbox.payabli.com/api
  - url: https://api.payabli.com/api
components:
  schemas:
    type_:PaymentCategories:
      type: object
      properties:
        amount:
          type: number
          format: double
          description: Price/cost per unit of item or category.
        description:
          type: string
          description: Description of item or category
        label:
          type: string
          description: Name of item or category.
        qty:
          type: integer
          default: 1
          description: Quantity of item or category
      required:
        - amount
        - label
      title: PaymentCategories
    type_:SplitFundingContent:
      type: object
      properties:
        accountId:
          type: string
          description: The accountId for the account the split should be sent to.
        amount:
          type: number
          format: double
          description: Amount from the transaction to send to this recipient.
        description:
          type: string
          description: A description for the split.
        recipientEntryPoint:
          type: string
          description: The entrypoint the split should be sent to.
      title: SplitFundingContent
    type_:SplitFunding:
      type: array
      items:
        $ref: '#/components/schemas/type_:SplitFundingContent'
      description: >-
        Split funding instructions for the transaction. The total amount of the
        splits must match the total amount of the transaction.
      title: SplitFunding
    type_:PaymentDetail:
      type: object
      properties:
        categories:
          type: array
          items:
            $ref: '#/components/schemas/type_:PaymentCategories'
          description: >-
            Array of payment categories/line items describing the amount to be
            paid.

            **Note**: These categories are for information only and aren't
            validated against the total amount provided.
        checkImage:
          type: object
          additionalProperties:
            description: Any type
          description: Object containing image of paper check.
        checkNumber:
          type: string
          description: >-
            A check number to be used in the ach transaction. **Required** for
            payment method = 'check'.
        currency:
          type: string
          description: >-
            The currency for the transaction, `USD` or `CAD`. If your paypoint
            is configured for CAD, you must send the `CAD` value in this field,
            otherwise it defaults to USD, which will cause the transaction to
            fail.
        serviceFee:
          type: number
          format: double
          description: >-
            Service fee to be deducted from the total amount. This amount must
            be a number, percentages aren't accepted. If you are using a
            percentage-based fee schedule, you must calculate the value
            manually.
        splitFunding:
          $ref: '#/components/schemas/type_:SplitFunding'
          description: >-
            Split funding instructions for the transaction. See [Split a
            Transaction](/developers/developer-guides/money-in-split-funding)
            for more.
        checkUniqueId:
          type: string
          description: >-
            Unique identifier for a processed check image. Required for RDC
            (Remote Deposit Capture) transactions where `achCode` is `BOC`. Use
            the `id` value from the [check
            processing](/developers/api-reference/moneyin/check-capture)
            response.
        totalAmount:
          type: number
          format: double
          description: >-
            Total amount to be charged. If a service fee is sent, then this
            amount should include the service fee."
      required:
        - totalAmount
      description: Details about the payment.
      title: PaymentDetail
    type_:Frequency:
      type: string
      enum:
        - onetime
        - weekly
        - every2weeks
        - every6months
        - monthly
        - every3months
        - annually
      description: Frequency for operation.
      title: Frequency
    type_:ScheduleDetail:
      type: object
      properties:
        endDate:
          type: string
          description: >-
            Subscription end date in any of the accepted formats: YYYY-MM-DD,
            MM/DD/YYYY or the value `untilcancelled` to indicate a scheduled
            payment with infinite cycle.
        frequency:
          $ref: '#/components/schemas/type_:Frequency'
          description: Frequency of the subscription.
        planId:
          type: integer
          description: >-
            This field is for future development, leave null. Identifier of
            subscription plan applied in the scheduled payment/subscription.
        startDate:
          type: string
          description: >-
            Subscription start date in any of the accepted formats: YYYY-MM-DD,
            MM/DD/YYYY. This must be a future date.
      title: ScheduleDetail
    type_subscription:SetPause:
      type: boolean
      description: >-
        Flag indicating if subscription is paused. When a subscription is
        paused, no payments are processed until the subscription is unpaused,
        and the next payment date isn't calculated automatically. If you want to
        skip a payment instead, set the `totalAmount` to 0 in the
        `paymentDetails` object.
      title: SetPause
    type_:IsSuccess:
      type: boolean
      description: >-
        Boolean indicating whether the operation was successful. A `true` value
        indicates success. A `false` value indicates failure.
      title: IsSuccess
    type_:ResponseText:
      type: string
      description: 'Response text for operation: ''Success'' or ''Declined''.'
      title: ResponseText
    type_:CustomerId:
      type: integer
      format: int64
      description: The Payabli-generated unique ID for the customer.
      title: CustomerId
    type_subscription:UpdateSubscriptionResponse:
      type: object
      properties:
        isSuccess:
          $ref: '#/components/schemas/type_:IsSuccess'
        responseData:
          type: string
          description: >-

            If `isSuccess` = true, this contains the identifier of the
            subscription, and sometimes extra information, depending on what was
            updated.


            If `isSuccess` = false, this contains the reason for the failure.
        responseText:
          $ref: '#/components/schemas/type_:ResponseText'
        customerId:
          $ref: '#/components/schemas/type_:CustomerId'
      required:
        - responseText
      description: Success response
      title: UpdateSubscriptionResponse
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: requestToken

```

## SDK Code Examples

```typescript PauseSubscription
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.subscription.updateSubscription(231, {
        setPause: true,
    });
}
main();

```

```python PauseSubscription
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.subscription.update_subscription(
    sub_id=231,
    set_pause=True,
)

```

```csharp PauseSubscription
using PayabliPayabliApi;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.Subscription.UpdateSubscriptionAsync(
            231,
            new RequestUpdateSchedule {
                SetPause = true
            }
        );
    }

}

```

```go PauseSubscription
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-sandbox.payabli.com/api/Subscription/231"

	payload := strings.NewReader("{\n  \"setPause\": true\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("requestToken", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby PauseSubscription
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.payabli.com/api/Subscription/231")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["requestToken"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"setPause\": true\n}"

response = http.request(request)
puts response.read_body
```

```java PauseSubscription
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api-sandbox.payabli.com/api/Subscription/231")
  .header("requestToken", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"setPause\": true\n}")
  .asString();
```

```php PauseSubscription
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api-sandbox.payabli.com/api/Subscription/231', [
  'body' => '{
  "setPause": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'requestToken' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```swift PauseSubscription
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["setPause": true] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Subscription/231")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

```typescript UnpauseSubscription
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.subscription.updateSubscription(231, {
        setPause: false,
    });
}
main();

```

```python UnpauseSubscription
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.subscription.update_subscription(
    sub_id=231,
    set_pause=False,
)

```

```csharp UnpauseSubscription
using PayabliPayabliApi;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.Subscription.UpdateSubscriptionAsync(
            231,
            new RequestUpdateSchedule {
                SetPause = false
            }
        );
    }

}

```

```go UnpauseSubscription
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-sandbox.payabli.com/api/Subscription/231"

	payload := strings.NewReader("{\n  \"setPause\": false\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("requestToken", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby UnpauseSubscription
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.payabli.com/api/Subscription/231")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["requestToken"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"setPause\": false\n}"

response = http.request(request)
puts response.read_body
```

```java UnpauseSubscription
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api-sandbox.payabli.com/api/Subscription/231")
  .header("requestToken", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"setPause\": false\n}")
  .asString();
```

```php UnpauseSubscription
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api-sandbox.payabli.com/api/Subscription/231', [
  'body' => '{
  "setPause": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'requestToken' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```swift UnpauseSubscription
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["setPause": false] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Subscription/231")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

```typescript UpdateSubscription
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.subscription.updateSubscription(231, {
        paymentDetails: {
            totalAmount: 100,
            serviceFee: 0,
        },
        scheduleDetails: {
            endDate: "03-20-2025",
            frequency: "weekly",
            planId: 1,
            startDate: "09-20-2024",
        },
    });
}
main();

```

```python UpdateSubscription
from payabli import payabli, PaymentDetail, ScheduleDetail

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.subscription.update_subscription(
    sub_id=231,
    payment_details=PaymentDetail(
        total_amount=100,
        service_fee=0,
    ),
    schedule_details=ScheduleDetail(
        end_date="03-20-2025",
        frequency="weekly",
        plan_id=1,
        start_date="09-20-2024",
    ),
)

```

```csharp UpdateSubscription
using PayabliPayabliApi;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.Subscription.UpdateSubscriptionAsync(
            231,
            new RequestUpdateSchedule {
                PaymentDetails = new PaymentDetail {
                    TotalAmount = 100,
                    ServiceFee = 0
                },
                ScheduleDetails = new ScheduleDetail {
                    EndDate = "03-20-2025",
                    Frequency = Frequency.Weekly,
                    PlanId = 1,
                    StartDate = "09-20-2024"
                }
            }
        );
    }

}

```

```go UpdateSubscription
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-sandbox.payabli.com/api/Subscription/231"

	payload := strings.NewReader("{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"scheduleDetails\": {\n    \"endDate\": \"03-20-2025\",\n    \"frequency\": \"weekly\",\n    \"planId\": 1,\n    \"startDate\": \"09-20-2024\"\n  }\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("requestToken", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby UpdateSubscription
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.payabli.com/api/Subscription/231")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["requestToken"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"scheduleDetails\": {\n    \"endDate\": \"03-20-2025\",\n    \"frequency\": \"weekly\",\n    \"planId\": 1,\n    \"startDate\": \"09-20-2024\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java UpdateSubscription
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api-sandbox.payabli.com/api/Subscription/231")
  .header("requestToken", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"scheduleDetails\": {\n    \"endDate\": \"03-20-2025\",\n    \"frequency\": \"weekly\",\n    \"planId\": 1,\n    \"startDate\": \"09-20-2024\"\n  }\n}")
  .asString();
```

```php UpdateSubscription
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api-sandbox.payabli.com/api/Subscription/231', [
  'body' => '{
  "paymentDetails": {
    "totalAmount": 100,
    "serviceFee": 0
  },
  "scheduleDetails": {
    "endDate": "03-20-2025",
    "frequency": "weekly",
    "planId": 1,
    "startDate": "09-20-2024"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'requestToken' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```swift UpdateSubscription
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "paymentDetails": [
    "totalAmount": 100,
    "serviceFee": 0
  ],
  "scheduleDetails": [
    "endDate": "03-20-2025",
    "frequency": "weekly",
    "planId": 1,
    "startDate": "09-20-2024"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Subscription/231")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```