> For the complete documentation index, see [llms.txt](https://docs.2checkout.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.2checkout.com/json-rpc-api-reference/json-rpc-api-6.0/api-requests/subscription/update-and-assign-a-subscription.md).

# Update and assign a subscription

Use the **updateSubscription** method to move a subscription from under a customer to another customer entity. 2Checkout moves subscription under the customer for which you provide the **2Checkout customer reference** or the **External customer reference** during the subscription update process.

<div data-with-frame="true"><img src="/files/1a467106d81dcd2202ec961d02c6abcce13bb4db" alt=""></div>

## Requirements

* Use **2Checkout customer references** or **External customer references** belonging to the target customer. 2Checkout re-assigns the subscription to the target customer.
* **Customer references** must be valid and associated to the target customer entity under which you move the subscription.

If you provide both the **2Checkout customer reference** and **External customer reference** they need to belong to the same target customer entity.

## Request parameters

<table><thead><tr><th width="139.3333740234375">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>sessionID</code></td><td><strong>Required (string)</strong><br>Session identifier, the output of the <strong>Login</strong> method. Include <code>sessionID</code> into all your requests. 2Checkout throws an exception if the values are incorrect. The <code>sessionID</code> expires in <strong>10 minutes</strong>.</td></tr><tr><td><a href="/pages/HF4ggLSOZbG1LYQjqUXU"><code>Subscription</code></a></td><td><strong>Required (Object)</strong><br>To only move a subscription from a source customer to a target customer, send only the <strong>2Checkout customer reference</strong> or the <strong>External customer reference</strong>.</td></tr></tbody></table>

### Request sample

```php
<?php

require ('PATH_TO_AUTH');

$SubscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';

$jsonRpcRequest = array (
  'method' => 'getSubscription',
  'params' => array($sessionID, $SubscriptionReference),
  'id' => $i++,
  'jsonrpc' => '2.0'
);

$updatedSubscription = callRPC((Object)$jsonRpcRequest, $host, true);
var_dump ($updatedSubscription);

$updatedSubscription->AvangateCustomerReference = 'YOUR_SUBSCRIPTION_REFERENCE'; // AvangateCustomerReference is displayed as 2CheckoutCustomerReference in your Control Panel

$jsonRpcRequest = array (
  'method' => 'updateSubscription',
  'params' => array($sessionID, $updatedSubscription),
  'id' => $i++,
  'jsonrpc' => '2.0'
);

var_dump (callRPC((Object)$jsonRpcRequest, $host, true));
```

## Response parameters

<table><thead><tr><th width="124.4000244140625">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Boolean</strong></td><td><strong>true</strong> or <strong>false</strong> depending on whether the changes were successful or not.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.2checkout.com/json-rpc-api-reference/json-rpc-api-6.0/api-requests/subscription/update-and-assign-a-subscription.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
