'iPay Payment Gateway Module', 'APIVersion' => '1.1', // Use API Version 1.1 'DisableLocalCredtCardInput' => true, 'TokenisedStorage' => false, ); } /** * Define gateway configuration options. * * The fields you define here determine the configuration options that are * presented to administrator users when activating and configuring your * payment gateway module for use. * * Supported field types include: * * text * * password * * yesno * * dropdown * * radio * * textarea * * Examples of each field type and their possible configuration parameters are * provided in the sample function below. * * @return array */ function gatewaymodule_config() { return array( // the friendly display name for a payment gateway should be // defined here for backwards compatibility 'FriendlyName' => array( 'Type' => 'System', 'Value' => 'iPay Third Party Payment Gateway Module', ), // a text field type allows for single line text input 'accountID' => array( 'FriendlyName' => 'Account ID', 'Type' => 'text', 'Size' => '25', 'Default' => '', 'Description' => 'Enter your account ID here', ), // a password field type allows for masked text input 'hashkey' => array( 'FriendlyName' => 'Secret Key', 'Type' => 'password', 'Size' => '25', 'Default' => '', 'Description' => 'Enter secret key here', ), // the yesno field type displays a single checkbox option 'testMode' => array( 'FriendlyName' => 'Test Mode', 'Type' => 'yesno', 'Description' => 'Tick to enable test mode', ), // the dropdown field type renders a select menu of options 'dropdownField' => array( 'FriendlyName' => 'Dropdown Field', 'Type' => 'dropdown', 'Options' => array( 'option1' => 'Display Value 1', 'option2' => 'Second Option', 'option3' => 'Another Option', ), 'Description' => 'Choose one', ), // the radio field type displays a series of radio button options 'radioField' => array( 'FriendlyName' => 'Radio Field', 'Type' => 'radio', 'Options' => 'First Option,Second Option,Third Option', 'Description' => 'Choose your option!', ), // the textarea field type allows for multi-line text input 'textareaField' => array( 'FriendlyName' => 'Textarea Field', 'Type' => 'textarea', 'Rows' => '3', 'Cols' => '60', 'Description' => 'Freeform multi-line text input field', ), ); } /** * Payment link. * * Required by third party payment gateway modules only. * * Defines the HTML output displayed on an invoice. Typically consists of an * HTML form that will take the user to the payment gateway endpoint. * * @param array $params Payment Gateway Module Parameters * * @see http://docs.whmcs.com/Payment_Gateway_Module_Parameters * * @return string */ function gatewaymodule_link($params) { // Gateway Configuration Parameters $accountId = $params['accountID']; $secretKey = $params['hashkey']; $testMode = $params['live']; $dropdownField = $params['dropdownField']; $radioField = $params['radioField']; $textareaField = $params['textareaField']; // Invoice Parameters $invoiceId = $params['invoiceid']; $orderId = $invoiceId; $description = $params["description"]; $amount = $params['amount']; $currencyCode = $params['currency']; // Client Parameters $firstname = $params['clientdetails']['firstname']; $lastname = $params['clientdetails']['lastname']; $email = $params['clientdetails']['email']; $address1 = $params['clientdetails']['address1']; $address2 = $params['clientdetails']['address2']; $city = $params['clientdetails']['city']; $state = $params['clientdetails']['state']; $postcode = $params['clientdetails']['postcode']; $country = $params['clientdetails']['country']; $phone = $params['clientdetails']['phonenumber']; // System Parameters $companyName = $params['companyname']; $systemUrl = $params['systemurl']; $returnUrl = $params['returnurl']; $langPayNow = $params['langpaynow']; $moduleDisplayName = $params['name']; $moduleName = $params['paymentmethod']; $whmcsVersion = $params['whmcsVersion']; $url = 'https://www.ipayafrica.com/payments/v3/ke'; $postfields = array(); $postfields['username'] = $username; $postfields['invoice_id'] = $invoiceId; $postfields['description'] = $description; $postfields['amount'] = $amount; $postfields['currency'] = $currencyCode; $postfields['first_name'] = $firstname; $postfields['last_name'] = $lastname; $postfields['email'] = $email; $postfields['address1'] = $address1; $postfields['address2'] = $address2; $postfields['city'] = $city; $postfields['state'] = $state; $postfields['postcode'] = $postcode; $postfields['country'] = $country; $postfields['phone'] = $phone; $postfields['callback_url'] = $systemUrl . '/modules/gateways/callback/' . $moduleName . '.php'; $postfields['return_url'] = $returnUrl; $htmlOutput = '
'; return $htmlOutput; } /** * Refund transaction. * * Called when a refund is requested for a previously successful transaction. * * @param array $params Payment Gateway Module Parameters * * @see http://docs.whmcs.com/Payment_Gateway_Module_Parameters * * @return array Transaction response status */ /*function gatewaymodule_refund($params) { // Gateway Configuration Parameters $accountId = $params['accountID']; $secretKey = $params['secretKey']; $testMode = $params['testMode']; $dropdownField = $params['dropdownField']; $radioField = $params['radioField']; $textareaField = $params['textareaField']; // Transaction Parameters $transactionIdToRefund = $params['transid']; $refundAmount = $params['amount']; $currencyCode = $params['currency']; // Client Parameters $firstname = $params['clientdetails']['firstname']; $lastname = $params['clientdetails']['lastname']; $email = $params['clientdetails']['email']; $address1 = $params['clientdetails']['address1']; $address2 = $params['clientdetails']['address2']; $city = $params['clientdetails']['city']; $state = $params['clientdetails']['state']; $postcode = $params['clientdetails']['postcode']; $country = $params['clientdetails']['country']; $phone = $params['clientdetails']['phonenumber']; // System Parameters $companyName = $params['companyname']; $systemUrl = $params['systemurl']; $langPayNow = $params['langpaynow']; $moduleDisplayName = $params['name']; $moduleName = $params['paymentmethod']; $whmcsVersion = $params['whmcsVersion']; // perform API call to initiate refund and interpret result return array( // 'success' if successful, otherwise 'declined', 'error' for failure 'status' => 'success', // Data to be recorded in the gateway log - can be a string or array 'rawdata' => $responseData, // Unique Transaction ID for the refund transaction 'transid' => $refundTransactionId, // Optional fee amount for the fee value refunded 'fees' => $feeAmount, ); } */ /** * Cancel subscription. * * If the payment gateway creates subscriptions and stores the subscription * ID in tblhosting.subscriptionid, this function is called upon cancellation * or request by an admin user. * * @param array $params Payment Gateway Module Parameters * * @see http://docs.whmcs.com/Payment_Gateway_Module_Parameters * * @return array Transaction response status */ function gatewaymodule_cancelSubscription($params) { // Gateway Configuration Parameters $accountId = $params['accountID']; $secretKey = $params['secretKey']; $testMode = $params['testMode']; $dropdownField = $params['dropdownField']; $radioField = $params['radioField']; $textareaField = $params['textareaField']; // Subscription Parameters $subscriptionIdToCancel = $params['subscriptionID']; // System Parameters $companyName = $params['companyname']; $systemUrl = $params['systemurl']; $langPayNow = $params['langpaynow']; $moduleDisplayName = $params['name']; $moduleName = $params['paymentmethod']; $whmcsVersion = $params['whmcsVersion']; // perform API call to cancel subscription and interpret result return array( // 'success' if successful, any other value for failure 'status' => 'success', // Data to be recorded in the gateway log - can be a string or array 'rawdata' => $responseData, ); }