> ## 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.

# Creating an AutoBill with Multiple Products

Subscribe allows you to include multiple line items on an AutoBill, which can include multiple recurring Products, and one-time, non-recurring, Charges.

**Note:** You can add Products and Charges to, or removed them from, the AutoBill at any time using the `AutoBill.modify` call. If you add or remove a product or charge in the middle of a billing cycle, you can set a flag to have Subscribe determine the prorated amount to charge, or refund, based on the point in the billing cycle at which you made the change, and the billing date of the AutoBill.

You add Products to an AutoBill using the `AutoBillItem` object. An `AutoBillItem` includes a `Product`, the number of cycles the `Product` is to be included in on the `AutoBill`, and an amount (price).

In previous releases of Subscribe, for products sold in multiples you had to add each product as a separate AutoBillItem.You can still do that. Alternatively, you can now use the `Quantity` field to indicate how many of that individual item are being purchased. For recurring items (pre-paid), the quantity value will be multiplied by the individual item product price to determine the total recurring charge. For license-based items (rated, pre-paid products), the quantity value will be used with the appropriate Rate Plan tier structure to determine the charge. For usage-based items (rated, post-paid products), do not use the quantity field.

For more information, see the AutoBillItem Subobject in the Subscribe API Guide.

## Create an AutoBill with two products

```

$autobill = new AutoBill();
$autobill->setMerchantAutoBillId('ab-1');

$product1 = new Product();
$product1->setMerchantProductId('prod-AAA');

$product2 = new Product();
$product2->setMerchantProductId('prod-BBB');

$item1 = new AutoBillItem();
$item1->setIndex(0);
$item1->setAmount(4.50);
$item1->setCurrency('USD');
$item1->setCycles(null);
$item1->setProduct($product1);

$item2 = new AutoBillItem();
$item2->setIndex(1);
$item2->setAmount(7.95);
$item2->setCurrency('USD');
$item2->setCycles(null);
$item2->setProduct($product1);

$autobill->setItems( [ $item1, $item2 ] );

$autobill_factory = new AutoBill();
$response = $autobill_factory->update(
      $autobill, // $autobill is of type Vindicia::Soap::AutoBill
      'Fail', // $duplicateBehavior is of type 
         // Vindicia::Soap::DuplicateBehavior
      true, //$validatePaymentMethod is of type xsd:boolean
      100, // $minChargebackProbability is of type xsd:int
      false, // $ignoreAvsPolicy is of type xsd:boolean
      false, // $ignoreCvnPolicy is of type xsd:boolean
      null, // $campaignCode is of type xsd:string
      false, // $dryrun is of type xsd:boolean
      );

// check $response

$response = $autobill->addCharge(
      'prod-bac',// product Id for this charge 'fee for swapping tiles',
      null, // will get tax class from Product
      1.50,
      'USD',
      null, // not a token
      1 // just once
      );

// check $response
```

**Parent topic:**[Creating AutoBills](../topics/Creating_AutoBills)


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