Moab Viewpoint
Redirecting to a Payment Site

Redirecting to a Payment Site

Redirecting is the process of pointing users to an external payment site. When billing is enabled in Moab and Viewpoint, it might be necessary for users to get funds from an external source. If configured, the user is redirected during the checkout shopping cart process. The user is only redirected if they currently do not have enough credits to check out a shopping cart.

The administrator of the external payment site is responsible for debiting accounts and triggering the necessary actions. To successfully redirect to a unique payment site, you must specify the URL for the unique payment site in the core.xml file. You can optionally specify HTTP POST data in the request body via the <post-field> element passed to the redirected site. For each <post-field> element specified, a <key> and an associated <value> must be defined. The key is the name of the HTTP POST parameter; the value is the variable associated with the key.

To specify a payment site URL, do the following:

  • Specify a fully qualified URL to the payment site in the <url> element.

To specify HTTP POST request parameters, do the following:

  1. Specify a parameter to be passed to the redirected site in the <key> element, which must be a child of a <post-field> element.
  2. Define an id attribute in the <component> element (which must be a child of a <value> element). For example:
    <post-field>
    	<key>CartID</key>
    	<value>
    		<component id="cart-id" />
    	</value>
    </post-field>
    
  3. (Optional Step) Define a rule for passing POST data to the redirect site. Using the <rule> element, you can optionally set requirements for whether to pass data.
Note Consider consulting with Adaptive Computing's Professional Services if you want to alter HTTP POST parameters.

The following represents an example core.xml file configuration pertaining to redirecting; in this example, "AccountID" and "ProjectID" are only passed if the "payment-id" component's value is equal to "moab-account":

<redirect>
  <url>http://127.0.0.1:8080</url>
  <post-field>
    <key>AccountID</key>
    <value>
      <component id="payment-value" />
    </value>
    <rule comparison="equals">
      <first>
        <component id="payment-id" />
      </first>
      <second>moab-account</second>
    </rule>
  </post-field>
  <post-field>
    <key>ProjectID</key>
    <value>
      <component id="payment-value" />
    </value>
      <rule comparison="equals">
        <first>
          <component id="payment-id" />
        </first>
        <second>moab-account</second>
      </rule>
  </post-field>
  <post-field>
    <key>CartID</key>
      <value>
        <component id="cart-id" />
      </value>
  </post-field>
  <post-field>
    <key>DollarAmount</key>
      <value>
        <calculate operation="double-to-string" precision="2">
          <component id="cost" />
        </calculate>
      </value>
  </post-field>
  <post-field>
    <key>RequestorEmail</key>
      <value>
        <component id="user-name" />
      </value>
  </post-field>
</redirect>