WebSession.initialize
Web Session Object
Transaction Object
Token Object
Season Set Object
Refund Object
RatePlan Object
Product Object
Payment Provider Object
Payment Method Object
NameValuePair Object
GiftCard Object
Entitlement Object
Chargeback Object
Campaign Object
BillingPlan Object
AutoBill Object
Address Object
Activity Object
Account Object
WebSession.initialize
The initialize method creates a WebSession object. Call this method before presenting your HOA-based Web order form to your customer. The call returns the new WebSession object with a populated VID attribute. Embed that VID in the order form as a hidden form element with the name vin_WebSession_vid to make it available to HOA at form submission. You only need to pass in the CashBox API object attributes that you have collected thus far in the customer’s flow. Remaining attributes can be passed in with the WebSession.finalize call.
To create a WebSession object, set the values for its data members (see WebSession Data Members) and then call initialize() to store the changes in the Vindicia database. Do not set a value for VID because CashBox automatically generates that when you call initialize().
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.
session: the WebSession object to create.
Output
return: an object of type Return that indicates the success or failure of the call.
session: the WebSession object that contains the data that you passed, the VID, and the expireTime value assigned by CashBox.
Returns
In addition to those listed in Standard Return Codes, this call returns:
Return Code |
Return String |
402 |
One of the following:
|
Example
// to create a WebSession object
$ws = new WebSession();
// HOA should make an AutoBill.update call when the form is submitted
$ws->setMethod('AutoBill_Update');
// Customer's IP address. When customer submits the form
// it should come from the same IP address
$ws->setIpAddress("124.23.210.175");
// Page to which HOA will redirect customer's browser
// after successfully making the AutoBill.update call when the
// customer submits the form
$ws->setReturnURL("https://merchant.com/subscribe/success.php");
// Page to which HOA will redirect customer's browser
// if the AutoBill.update call it makes when the customer submits
// the form unsuccessful
$ws->setErrorURL("https://merchant.com/subscribe/failed.php");
// Private name values pairs. These are needed to create the
// AutoBill object, but we do not want them to appear in the
// form the customer fills in
$pnv1 = new NameValuePair();
// The name is flattened Object name concatenated
// with attribute names with an underscore.
// The CashBox Account object for which HOA should create the
// AutoBill object
$pnv1->setName('Account_VID');
$pnv1->setValue('36c8de2cb74b2c2b08b259cf231ac8d90d1bb3b8');
// The CashBox Product object HOA should use in constructing
// the AutoBill object
$pnv2 = new NameValuePair();
$pnv2->setName('Product_merchantProductId');
$pnv2->setValue('StartWars II');
$pnv3 = new NameValuePair();
$pnv3->setName('vin_BillingPlan_merchantBillingPlanId');
// When customer submits the form, the billing plan
// should be one of the two comma separated values
$pnv3->setValue('GoldAccess2010, PlatinumAccess2010');
$ws->setPrivateFormValues(array($pnv1, $pnv2, $pnv3));
// Method parameter name values pairs. These are needed to make the
// AutoBill.update call which takes parameters in addition to the
// AutoBill object itself. We do not want these to come from the form
// submission because that makes them susceptible to hacking
$mpnv1 = new NameValuePair();
// The name is flattened object name, method name, and parameter
// name concatenated with an underscore.
$mpnv1->setName('AutoBill_Update_minChargebackProbability');
$mpnv1->setValue('80');
// Leave other parameter values to their default values
$ws->setMethodParamValues(array($mpnv1));
// Now create the WebSession object on Vindicia servers
// by making the SOAP call to initialize the object
$response = $ws->initialize();
if ($response->['returnCode'] == 200) {
$ret_ws = $response['data']->session;
// The VID of the WebSession object serves as session id
$sessionId = $ret_ws->getVID();
// Embed the sessionId as hidden field in the order web form
// Compose and present the order web form here
}
else {
// Return error to the customer who requested the web order form
}
For Users
Learn More