> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# BillingPlan.update

Use the `update` method to create a new `BillingPlan` , or to update an existing `BillingPlan` object.

Billing Plans may be created using either the Subscribe API or the Subscribe Portal. Use the `BillingPlan.update` method of the API to create or update a large number of billing plans.

To create a `BillingPlan` object, initialize the object, set the values for its data members as appropriate, and then call the `update()` method to store the changes. When creating a new `BillingPlan` object, do not set a value for `VID`; Subscribe will automatically generate a VID for the object when you call `update()`.

Set the `BillingPlanPeriod` object’s `free` flag to `true` to override any price setting for Products included in the AutoBill. If set to `true`, no Product price will be applied to the AutoBill; only Charges.

**Note:** Setting this `BillingPlanPeriod` flag to `true` causes Subscribe to ignore any price defined elsewhere for the Billing Period, and set the period to free.

When updating an existing `BillingPlan` object, identify it with its VID or your billing plan ID (`merchantBillingPlanId`). Be certain to add billing plan periods and prices in the appropriate currencies.

**Note:** Changing the pricing structure for a Billing Plan will change the price for any active AutoBills associated with the plan. If your customer has already received a pre-billing notification before you change the Billing Plan’s price, but before they are billed, they will be charged the old price for that Billing Cycle. If they have not received a pre-billing notification, the new Billing Plan price will take effect upon the next Billing Cycle.

## Input

*srd*: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a `method` call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the *srd*. A null *srd* returns the complete response.

*billingPlan*: the `BillingPlan` object to be created or updated. If you are updating an existing plan, identify this object with its VID or your billing plan ID (`merchantBillingPlanId`).

## Output

*return*: an object of type `Return` that indicates the success or failure of the call.

*billingPlan*: the `BillingPlan` object that was created or updated.

*created*: a Boolean flag that, if set to `true`, indicates that this method has created a new `BillingPlan` object. A `false` setting indicates that update has updated an existing `BillingPlan` object.

## Returns

This method returns the codes listed in [The Return Object](The_Return_Object).

## Example

```

// to create a billing plan

// Create a new billing plan
$plan = new BillingPlan();

   // Identify the billing plan by your unique identifier, etc.
$plan->setMerchantBillingPlanId('12345');
$plan->setPreNotifyDays(7);
$plan->setStatus('Active');
$plan->description('1 Free Month then 2 Months at $5.00 (USD), 
      $5.60 (CAD) then $120.00(USD), $135.00(CAD) per year');
$plan->periods[0]=(new BillingPlanPeriod(type => 'Month',
      quantity => 1,
      cycles => 1, //Just once
      prices => [new BillingPlanPrices('amount' => 0,
      'currency' => 'USD'),
      new BillingPlanPrices('amount' => 0, 'currency' => 'CAD')]));
$plan->periods[1]=(new BillingPlanPeriod(type => 'Month',
      quantity => 1,
      cycles => 2, //for 2 months
      prices => [new BillingPlanPrices
      ('amount' => 5.00, 'currency' => 'USD'),
      new BillingPlanPrices('amount' => 5.60, 'currency' => 'CAD')]));
$plan->periods[2]=(new BillingPlanPeriod(
      type => 'Year',
      quantity => 1,
      cycles => 0, //Repeat infinitely
      prices => [new BillingPlanPrices('amount' => 120.00,
      'currency' => 'USD'),
      new BillingPlanPrices('amount' => 135.00, 'currency' => 'CAD')]));
$response = $plan->update();
if($response['returnCode'] == 200 && $response['created'])
{
   print "Billing plan successfully created. VID: " 
      . $response['data']->billingPlan->getVID() . "\n";
}
```

**Parent topic:**[BillingPlan Methods](../topics/BillingPlan_Methods)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.