Joomla Extensions
IOS and Android
eCommerce Templates
Hosting + Joobi Apps + eCommerce Theme
The class should be named in this format " _ _payment" which also extends to "Payment_System_class."i.e. class Paypal_Paypal_payment extends Payment_System_class { ... }
It is because the first payment name is used as the name of the main Joobi sub-folder name. And the second name is used as the name of the class file. Lastly, the "_payment" describes the type of Joobi extension used.
i.e. ../joobi/node/Paypal/payment/paypal.php
This is how the class file would be placed when the installation of the payment widget is completed.
These parameters are to be defined as global parameters of the Payment System class.
paymentName
String
Payment unique name of the payment system
acceptAddress
False
These are the functions which need to be coded for the API integration between Joobi payment system and the payment system you wanted to use.
These are the parameters that will be used to inform the payment system of the customer's order details.
$this->addField('first_name', $order->firstName );$this->addField('last_name', $order->lastName );$this->addField('email', $order->email );$this->addField('item_name', $order->orderName );$this->addField('item_number', $order->orderID );$this->addField('currency_code', $order->currencyCode );$this->addField('mc_gross', $order->totalPrice );
//overriding the addressif ( !empty($order->addressName)
$this->addField( 'address1', $order->address1 );if ( !empty($order->address2) ) $this->addField( 'address2', $order->address2 );
$this->addField( 'city', $order->city );if ( !empty($order->zip) ) $this->addField( 'zip', $order->zip );if ( !empty($order->state) ) $this->addField( 'state', $order->state );
$this->addField( 'country', $order->countryISO2 );
//passtrought variables$this->addField( 'invoice', $order->orderID );
These parameters are available in supplying the payment system in which the information of the products are placed on the cart of the customer.
foreach ($products as $product) {
if ( $real==$calculatedPrice ) {
}//endforeach
//Checking the product optionsif( isset( $product->Options ) && !empty( $product->Options ) ) {
}//endif
These parameters are used in the confirmation of the response given from the payment system used. They need to be assigned with the parameter values that were passed and returned from the used payment system. The method object is commonly called IPN (Instant Payment Notification) or INS (Instant Notification System), as used by our examples using Paypal's parameters.
//This is used this way to make uniformity for the name format$IPN->paymentSystem = $this->paymentName;//IDs transaction / payer$IPN->transactionID = WGlobals::getVar( 'txn_id', '', 'string' );$IPN->payerID = WGlobals::getVar( 'payer_id', '', 'string' );$IPN->receiverName = WGlobals::getVar( 'business', '', 'string' );$IPN->receiverID = WGlobals::getVar( 'receiver_id', '', 'string' );$IPN->receiverEmail = WGlobals::getVar( 'receiver_email', '', 'string' );$IPN->token = WGlobals::getVar( 'custom', '', 'string' );$IPN->paymentType = WGlobals::getVar( 'payment_type', '', 'string' );$IPN->transactionType = WGlobals::getVar( 'txn_type', '', 'string' );$IPN->parentID = WGlobals::getVar( 'parent_txn_id', '', 'string' );
//load the status$IPN->addressStatus = WGlobals::getVar( 'address_status', '', 'string' );$IPN->paymentStatus = WGlobals::getVar( 'payment_status', '', 'string' );$IPN->payerStatus = WGlobals::getVar( 'payer_status', '', 'string' );$pending_reason = WGlobals::getVar( 'pending_reason', '', 'string' );$reason_code = WGlobals::getVar( 'reason_code', '', 'string' );$IPN->reason = $pending_reason . $reason_code;
//payer information$IPN->payerEmail = WGlobals::getVar( 'payer_email', '', 'string' );$IPN->payerName = WGlobals::getVar( 'payer_business_name', '', 'string' );$IPN->firstName = WGlobals::getVar( 'first_name', '', 'string' );$IPN->lastName = WGlobals::getVar( 'last_name', '', 'string' );$IPN->addressName = WGlobals::getVar( 'address_name', '', 'string' );$IPN->addressStreet = WGlobals::getVar( 'address_street', '', 'string' );$IPN->addressZip = WGlobals::getVar( 'address_zip', '', 'string' );$IPN->addressCity = WGlobals::getVar( 'address_city', '', 'string' );$IPN->addressState = WGlobals::getVar( 'address_state', '', 'string' );$IPN->country = WGlobals::getVar( 'residence_country', '', 'string' );$IPN->countryISO2 = WGlobals::getVar( 'residence_country_code', '', 'string' );
//information about the order$IPN->numberOfProducts = WGlobals::getVar( 'num_cart_items', 0, 'int' );$IPN->paymentDate = WGlobals::getVar( 'payment_date', '', 'string' );$IPN->currencyCode = WGlobals::getVar( 'mc_currency', '', 'string' );
//total and fees$IPN->shipping = WGlobals::getVar( 'mc_shipping', '', 'string' );$IPN->handling = WGlobals::getVar( 'mc_handling', '', 'string' );$IPN->tax = WGlobals::getVar( 'tax', '', 'string' );$IPN->totalPrice = WGlobals::getVar( 'mc_gross', '', 'string' );$IPN->fee = WGlobals::getVar( 'mc_fee', '', 'string' );$IPN->comments = WGlobals::getVar( 'memo', '', 'string' );
These are the possible values used in converting the transaction payment status from the payment system to our order payment status.
$statusLower = strtolower($IPN->paymentStatus);switch ( $statusLower ) {
}//endswitch