Knowledgebase: On Demand (VOD)
Integrate a VOD Payment Processor
Posted by Mark [Elevated X Support], Last modified by Mark [Elevated X Support] on 01 June 2018 12:28 AM
This document covers the addition of VOD payment processors not already integrated with the Elevated X platform for third party developers who are creating code that integrates with the payment processor and Elevated X VOD features.

Currently integrated processors: CCBill, Epoch, Verotel, NetBilling, OrbitalPay, NATS

Note: Our support staff DOES NOT not troubleshoot or assist with ANY integration of custom code.

Setup Requirements

1. Within cmsinclude.ini.php, you will need to define both CUSTOM_PURCHASE_FUNCTION and CUSTOM_POSTBACK_FUNCTION.

CUSTOM_PURCHASE_FUNCTION=custom_biller_purchase
CUSTOM_POSTBACK_FUNCTION=custom_biller_postback

2. Within cmsinclude.ini.php, you will also need to specify an include for where these custom files will sit.

require[] = "customcode.php"

This article includes a sample customcode.php that includes sample dummy code. Please see this for more details.

3. Within the CMS admin panel, you will need to go to VOD -> Billing, and add an entry of type custom.

4. Within the CMS admin panel, you will need to set up your area so it uses this custom billing type.

Click here for more information.

Information about CUSTOM_PURCHASE_FUNCTION:

When this hook is called.

When a user initiates a purchase, this hook is called.

What is passed to it:

function custom_biller_purchase($arr, &$out);

$arr: The first argument is an array of arguments that are being passed along by the VOD system.

$arr["billertype"]: This value is "custom" as it is the custom payment processor type.
$arr["userid"]: This is the internal userid within the VOD system. This needs to be passed along through your script when it's being sent to the postback function.
$arr["packageid"]: This is an array of integers that specifies which package ids are being purchased.
$arr["setid"]: This is an array of integers that specify what set(s) are being purchased.
$arr["amount"]: The amount that is being charged.

$arr["transaction"]: This exists if the user has already made a prior purchase within the system. This is used for things like one-click upgrades, where a user has already made a purchase. This will be an associative array, if present.

$out: The second argument is passed by reference. Setting values within the $out array will affect how the system treats the call.

$out["redirect"]: If this value is set, the system will redirect the user to an alternate page. In this case, this is the billing page where information is gathered.

$out["success"]: If this value is set to 1 instead of 0, the system will treat the purchase as already being successful, and will add credits / purchases within the VOD system.

$out["errmsg"]: If there is an error, setting this value will present an error to the user as a popup dialog box.

What is returned:

This function should return false or null.

Information about CUSTOM_POSTBACK_FUNCTION:

When this hook is called.

When a successful purchase action has been called within your custom payform, you will need to do a curl post to postback.php within your VOD area.

If you pass along the required information to postback.php, the system will call your custom postback function, which verifies the order, and tells the system whether to add the order to the system, or print an error message.

What is passed to it:

function custom_biller_postback($out)

$out: The first argument is passed by reference. Setting values within the $out array will affect how the system treats the call.

$out["redirect"]: If this value is set, the system will redirect the user to an alternate page. In this case, this is the billing page where information is gathered.

$out["success"]: If this value is set to 1 instead of 0, the system will treat the purchase as already being successful, and will add credits / purchases within the VOD system.

$out["errmsg"]: If there is an error, setting this value will present an error to the user as a popup dialog box.

$out["plainoutput"]: If this is set, instead of postback.php trying to print the value of $out as json_encoded array, instead print this message instead.

$out["outputfunction"]: If this is set, instead of postback.php trying to print out the value of $out, a custom anonymous function is called when a purchase is successful.

Example:
$out["outputfunction"] = function() { 

  header("Content-Type: text/xml");

  echo "<result>1</result>";

  exit;

};

What is returned:

This function should return an array with the following information:

$arr["userid"]: This should be the internal userid within the VOD system. This should be passed along through your payment processor system, as received from your CUSTOM_PURCHASE_FUNCTION.

$arr["packageid"]: This should be a comma separated list of package ids within the VOD system. This should be passed along through your payment processor system, as received from your CUSTOM_PURCHASE_FUNCTION.

$arr["setid"]: This should be a comma separated list of set ids within the VOD system. This should be passed along through your payment processor system, as received from your CUSTOM_PURCHASE_FUNCTION.

$arr["amount"]: This is the amount the enduser was charged.

$arr["transaction"]: This is optional. This can contain information such as a transaction id, subscription id, or any other information that you may want to check for if a user tries to make orders in the future.

Note: This must be an associative array in order for this to be included in the system.

After setting these, please be sure to actually return $arr; at the end of your function. See references for more information.

References:

Attached to this document are the following:

customcode.php: This includes reference hooks to the VOD system that you or your coder will need to modify to integrate with the system.

custom_payform.php: This is a stub payment processing form. You or your coder can use this as a starting reference for integrating the system with your merchant or third party payment processor.


Attachments 
 
(2 vote(s))
Helpful
Not helpful

Comments (0)