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

# AutoBill.fetchByWebSessionVid

Use Vindicia’s Hosted Order Automation (HOA) feature to create Subscribe objects that contain sensitive payment information, such as credit-card account numbers, directly on Vindicia’s servers, after your customers have submitted such data through a specially designed Web order form you serve from your server. Because HOA bypasses your server altogether at form submission, you need not comply with PCI requirements. See Hosted Order Automation in the Subscribe Programming Guide for details.

Within your HOA implementation, you may call the `fetchByWebSessionVid` method to retrieve the `AutoBill` object, created by HOA on Vindicia’s servers when a customer submits an order form which results in a one-time or recurring bill. You must create a `WebSession` object on Vindicia’s servers before serving the form to your customer to track the form’s submission to Vindicia. For more information, see [The WebSession Object](The_WebSession_Object).

The `WebSession` object’s VID serves as the tracking ID for various activities, starting from serving the order form to a customer, and ending in returning a success or failure page to that same customer. This method is useful when programming the success page (see the `returnURL` attribute in [WebSession Data Members](WebSession_Data_Members)), to which HOA redirects the customer’s browser after successfully processing the data in the order form. On the success page, the `WebSession` object’s VID is available to you because HOA passes it during the redirection. In turn, you can pass that VID as the input parameter to this call, and retrieve the `AutoBill` object created by HOA. Finally, you can extract the contents of the `AutoBill` object and include them, as appropriate, in the success page to be returned to the customer.

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

*vid*: the `WebSession` object’s Vindicia unique identifier for tracking the submission of the order form.

## Output

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

*autobill*: an `AutoBill` object that was created by HOA as a result of an order form submitted by a customer.

## Returns

In addition to those listed in [The Return Object](The_Return_Object), this call returns:

| Return Code | Return String |
| - | - |
| `400` | `Missing required parameter 'vid'.` |
| `404` | `Unable to find requested AutoBill: No matches.` |

## Example

```

// to use the fetchByWebSessionVid call on a success web page
$webSessionVid = …; //passed in by redirected page
$soap = new WebSession($soapLogin, $soapPwd);
$response = $soap->fetchByVID($webSessionVid);
if ($response['returnCode'] == 200) {
   $fetchedWs = $response['data']->session;
   // check if the Subscribe API call made by HOA was successful
$retCode = $fetchedWs->apiReturn->returnCode;
if ($retCode == 200) {
   // Assuming HOA created an AutoBill object, let's fetch it
   $soapAbill = new AutoBill($soapLogin, $soapPwd);
   $resp = $soapAbill->fetchByWebSessionVid($webSessionVid);
   if ($resp['returnCode'] == 200) {
      $createdAutoBill = $resp['data']->autobill;
      // Get AutoBill contents here to be included in
      // HTML returned to the customer.
   }
   else {
      // Return error message to customer
   }
}
else {
   // return failure page to customer
}
}
else {
   // Return error message to the customer 
}
```

**Parent topic:**[AutoBill Methods](../topics/AutoBill_Methods)


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