> 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-import/add-import-test-subscriptions-with-credit-debit-card-data.md).

# Add / import test subscriptions with credit / debit card data

Use the **addSubscription** method to import a test subscription into the 2Checkout system.

Import test subscription and data from your or a third-party system with payment information assigned, and test advanced renewal and upgrade scenarios in the 2Checkout platform. Contact 2Checkout directly for additional details.

## Requirements

Test subscriptions can be imported only for **eStore** orders. Only dummy credit card data can be assigned to subscriptions. Check [here](/test-your-integration/test-your-integration/test-payment-methods.md) the list of credit cards that can be used for import.

Cardholder name is composed as **FirstName + " " + LastName.**

## Request parameters

<table><thead><tr><th width="194.800048828125">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>sessionID</code></td><td><p><strong>Required (string)</strong></p><p>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>.</p></td></tr><tr><td><a href="/json-rpc-api-reference/json-rpc-api-6.0/api-requests/subscription-import.md"><code>Subscription import</code></a></td><td><p><strong>Required (object)</strong></p><p>Object designed to provide 2Checkout with all the information to create a subscription.</p></td></tr><tr><td><code>Test</code></td><td><p><strong>Optional (integer)</strong></p><p>To add test subscriptions, set the <strong>Test</strong> parameter to 1. Default value is 0, and belongs to regular subscriptions.</p></td></tr><tr><td><a href="/json-rpc-api-reference/json-rpc-api-6.0/api-requests/subscription-import.md#card-payment"><code>CardPayment</code></a></td><td><p><strong>Optional (object)</strong></p><p>Object containing card details. See the list of credit cards that can be used for import: <a href="/test-your-integration/test-your-integration/test-payment-methods.md">Test payment methods</a>.</p></td></tr></tbody></table>

### Request sample

```php
<?php

require ('PATH_TO_AUTH');

$Product = new stdClass ();
$Product->ProductCode = 'my_subscription_1';
$Product->ProductId = 4639321;
$Product->ProductName = '2Checkout Subscription Imported';
$Product->ProductVersion = 1.0;
$Product->ProductQuantity = 3;
$Product->PriceOptionCodes = array();

$EndUser = new stdClass ();
$EndUser->Address1 = 'Address line 1';
$EndUser->Address2 = 'Address line 2';
$EndUser->City = 'LA';
$EndUser->Company = 'Company Name';
$EndUser->CountryCode = "US";
$EndUser->Email = 'customerAPI@2Checkout.com';
$EndUser->FirstName = 'Customer'; // first name and last name are used for determining the CardHolder Name
$EndUser->Language = 'en';
$EndUser->LastName = '2Checkout'; // first name and last name are used for determining the CardHolder Name
$EndUser->Phone = '1234567890';
$EndUser->State = 'California';
$EndUser->Fax = NULL;
$EndUser->Zip = '90210';

$Subscription = new stdClass();
$Subscription->ExternalSubscriptionReference = '12345678912ImportedSubscription';
$Subscription->SubscriptionCode= NULL;
$Subscription->StartDate = '2013-01-01';
$Subscription->ExpirationDate = '2017-12-30';
$Subscription->Product = $Product;
$Subscription->EndUser = $EndUser;
$Subscription->ExternalCustomerReference = '12354678ExtCustRef';
$Subscription->Test = 1; // send 1 for test subscription, 0 for regular subscriptions.

$PaymentCard = new stdClass ();
$PaymentCard->CardNumber = '4111111111111111' ;
$PaymentCard->CardType = 'VISA';
$PaymentCard->ExpirationYear = '2018';
$PaymentCard->ExpirationMonth = '12';
$PaymentCard->CCID = '123';
$PaymentCard->HolderNameTime = '15';
$PaymentCard->CardNumberTime = '15';
$PaymentCard->AutoRenewal = true;

$jsonRpcRequest = array (
'method' => 'addSubscription',
'params' => array($sessionID, $Subscription, $PaymentCard),
'id' => $i++,
'jsonrpc' => '2.0');

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

## Response parameters

<table><thead><tr><th width="210.7999267578125">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>SubscriptionReference</code></td><td><p><strong>String</strong></p><p>Unique, system-generated subscription identifier.</p></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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.2checkout.com/json-rpc-api-reference/json-rpc-api-6.0/api-requests/subscription-import/add-import-test-subscriptions-with-credit-debit-card-data.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
