WebSession object must be created before serving the order form to the customer for submission to the Vindicia server.
The WebSession object:
-
Tracks the submission of an order form containing sensitive payment data. Use the
WebSession’sVIDas a session ID, to track the session from your customer’s first order form request, to your final success or failure page for the session. - Establishes a time limit for the entire sequence.
-
Ensures that a single form submission from a customer results in only one API call, specified when the session is initiated (see the
WebSessionobject’smethoddata member). That way, if the customer submits the same form repeatedly, HOA does not make multiple API calls, resulting in the creation of multiple Subscribe objects. TheWebSessionobject supports the following Subscribe API calls (methods):Account_UpdateAccount_UpdatePaymentMethodAutoBill_UpdatePaymentMethod_UpdatePaymentMethod_ValidateTransaction_AuthTransaction_AuthCapture
-
Stores the result of the Subscribe API calls made by HOA after finalization of the
WebSessionobject. Your success / failure page then examines this information to determine its content, and directs the customer to the appropriate next steps. (See theWebSessionobject’sapiReturnattribute in Section 19.1: WebSession Data Members in the Subscribe API Guide.) -
Holds some of the data required to complete the Subscribe API call that HOA makes after the customer has submitted the form. (See the
WebSessionobject’sprivateFormValuesattribute in Section 19.1: WebSession Data Members in the Subscribe API Guide.) For details on theWebSessionobject’s attributes, see Section 19.1: WebSession Data Members in the Subscribe API Guide. The following example shows a typical initialization of aWebSessionobject. This example creates anAutoBillobject for a new subscription, without passing sensitive Payment Method information through your servers. When a customer requests a page to start a subscription, initiate aWebSessionobject.
WebSession object:
-
HOA calls
AutoBill.updatewhen you finalize theWebSessionobject. -
AutoBill.update()may use an existingAccountobject for the customer. Note: Do not allow this object’s VID to appear in the form sent to the customer’s browser, not even as a hidden element. -
AutoBill.update()uses an existingProductobject. Note: Do not allow this object’s VID to appear in the form sent to the customer’s browser. Hiding this VID prevents hackers from specifying a random Product ID, that may correspond to a Product ID that you do not wish to make available for subscriptions in this context. -
AutoBill.update()uses one of two existingBillingPlanobjects. (Specify existing Billing Plan IDs to prevent other, possibly inactive or invalid, IDs from being submitted. This helps to regulate and control the AutoBill creation process.)
NameValuePair objects.)
Account, BillingPlan, and other objects as private values in the WebSession object, and assumes that objects with these IDs already exist in Subscribe. (Note that use of the forward slash character (/) in merchant identifiers is not allowed. See Merchant Identifiers for more information.) Always specify merchant IDs of objects as private values stored in the WebSession object, even if the objects do not yet exist. These are your internal object IDs; for security reasons do not pass them in through the form submission, or store them as hidden fields in the form. If an object ID is present in the WebSession object’s private values, when HOA completes the desired API call, HOA first looks for an object with that ID in the Subscribe database. If no such object is available, HOA creates a new object with that ID, and populates it with related data, either submitted through the form, or previously stored in the WebSession object.
For example, if an Account with merchantAccountId: df943 does not yet exist in Subscribe, when the WebSession is finalized, HOA will create a new Account object with merchantAccountId: df943. In this case, the Account attributes, such as customer’s name, email, and shipping address, must be passed in through the form; which means that your form must include the fields necessary for your customer to submit this information.
The WebSession object created remains valid for one hour (by default), within which time the customer must complete and submit the form.
Parent topic:Working with HOA with Hosted Fields
