MMv4 KB
 
Working with RMV XML Data
  Last Edited - 06/26/2012 10:32am PDT
  Category Path - Shopping Cart Software Components > Administration Area > Modules > Subscription Products > Memberships & Remote Member Validation (RMV) System
 
Modular Merchant's Remote Membership Validation (RMV) system makes it simple to set up a "members-only" area on your website where your customers can log in to access content that they have purchased. When a customer purchases an eligible product, they will automatically gain access to the protected membership area on your website. Anyone who has not purchased that product won't have access to the website!

The shopping cart's RMV system can be set to return its data to your login script in XML format. This XML data contains:

  • The customer's account information (billing address, shipping address, custom fields, etc.)
  • When $subscription_vs_order is set to subscription, a list of the products in the customer's subscription will be included.
  • When $subscription_vs_order is set to order, a list of the orders in the customer's purchase history that contain the eligible products will be inlcuded.

The XML data returned by the shopping cart is contained in a variable named $rmv_results.

Here is an example of the format of the XML data contained within the $rmv_results variable:

code
<?xml version="1.0" encoding="utf-8"?>
    <rmv_results>
        <submitted_api_data>
            <api_request_date>1281292833</api_request_date>
            <api_key>9c1bc31d5d4f89ssa51d621a74b2fd</api_key>
            <api_version>3.1</api_version>
            <email>user@email.com</email>
            <password>123ABC</password>
            <pids>1,2,3</pids>
            <subscription_vs_order>order</subscription_vs_order>
            <lookup_range>0</lookup_range>
            <check_ip>N</check_ip>
            <all_any>any</all_any>
            <results_format>xml</results_format>
        </submitted_api_data>
        <customer_data>
            <cid>12345</cid>
            <email>user%40email.com</email>
            <password>qRyP2mrnCrclhZ%2Bw%2BRPv5ds89uvr35gb</password>
            <bill_first_name>Dudley</bill_first_name>
            <bill_last_name>Heromin</bill_last_name>
            <bill_address1>000+Paved+Road</bill_address1>
            <bill_address2>Suite+000</bill_address2>
            <bill_city>Anytown</bill_city>
            <bill_state>OR_US</bill_state>
            <bill_zip>00000</bill_zip>
            <bill_country_iso>US</bill_country_iso>
            <bill_state_iso>OR</bill_state_iso>
            <bill_state_long>Oregon</bill_state_long>
            <bill_country_long>United States</bill_country_long>
            <phone_ac>000</phone_ac>
            <phone>555-5555</phone>
            <cid_active>Y</cid_active>
            <cmr_custom_1>customer+field+one</cmr_custom_1>
            <cmr_custom_2>customer+field+two</cmr_custom_2>
            <cmr_custom_3>customer+field+three</cmr_custom_3>
            <cmr_custom_4>customer+field+four</cmr_custom_4>
            <cmr_custom_5>customer+field+five</cmr_custom_5>
            <cmr_custom_6>customer+field+six</cmr_custom_6>
            <cmr_custom_7>customer+field+seven</cmr_custom_7>
            <cmr_custom_8>customer+field+eight</cmr_custom_8>
            <cmr_custom_9>customer+field+nine</cmr_custom_9>
            <cmr_custom_10>customer+field+ten</cmr_custom_10>
            <use_prev_cc>0</use_prev_cc>
            <has_tab>N</has_tab>
            <tab_terms>0</tab_terms>
            <tab_limit>0.00</tab_limit>
            <tax_exempt>N</tax_exempt>
            <notes>notes+about+this+customer+account</notes>
            <cmr_news>news+alerts+for+this+customer</cmr_news>
            <create_date>1211994000</create_date>
            <edit_date>1277335992</edit_date>
            <edited_by>000</edited_by>
            <ship_addr_id>123</ship_addr_id>
            <ship_nick_name>Dudley+Heromin</ship_nick_name>
            <ship_first_name>Heromin</ship_first_name>
            <ship_last_name>Heromin</ship_last_name>
            <ship_address1>000+Gravel+Road</ship_address1>
            <ship_address2>Suite+000</ship_address2>
            <ship_city>Anytown</ship_city>
            <ship_state>CA_US</ship_state>
            <ship_zip>00000</ship_zip>
            <ship_country_iso>US</ship_country_iso>
            <ship_state_iso>CA</ship_state_iso>
            <ship_state_long>California</ship_state_long>
            <ship_country_long>United+States</ship_country_long>
        </customer_data>
        <order_data>
            <order_item>
                <order_id>56789</order_id>
                <order_date>1222122161</order_date>
                <order_product>
                    <product_sid>123</product_sid>
                    <product_name>Sample+Product</product_name>
                </order_product>
            </order_item>
        </order_data>
        <subscription_data>
            <subscription_item>
                <product_sid>123</product_sid>
                <product_name>Sample+Product</product_name>
                <bill_date>1222122161</bill_date>
            </subscription_item>
        </subscription_data>
    </rmv_results>

The <order_data>...</order_data> section is only included when the $subscription_vs_order option is set to order.

The <order_item>...</order_item> section will be repeated for every order found within the specified date range in the customer's purchase history that contains eligible products.

The <subscription_data>...</subscription_data> section is only included when the $subscription_vs_order option is set to subscription.

The <subscription_item>...</subscription_item> section will be repeated for every product, due within the specified date range, in the customer's subscription.

tip
The XML data is "url encoded". To improve its legibility, be sure to apply urldecode() or a similar function to it.

reference
The PHP website includes some tutorials on how to turn XML data into an object that PHP can use.

Powered by ModularKB