Hi,
1. Yes, they are plans.
2. No it's a table of akeeba subscriptions where the plans are stored.
If you look at the sql install script of akeeba subscriptions, you can see the structure of that table:
github.com/akeeba/akeebasubs/blob/develo...nd/sql/xml/mysql.xml
We just used the structure of that table for the data to take in but you can just replicate that structure in $results.
3. For example, you could have a function like that:
function onCheckSubscription(&$subLevel,&$result){
// $subLevel is an array of subscription ids that the merchant set in the product_subscription_id column of the products of the order to link HikaShop products to subscriptions
$object = new stdClass();
$object->akeebasubs_level_id = 'XXX'; // where XXX is the id of your level in emerald that you set in the product_subscription_id of the product in HikaShop
$object->duration = 31; // the duration of the renewal period
$object->price = '10'; // the amount of the recurring fee
$object->recurring = '1'; // the fact that is it a recurring subscription
$result = array($object);
return true;
}
That would make it so that if in your cart, you have a products linked to the subscription XXX (with the value XXX in its product_subscription_id), it will display PayPal recurring as a payment method on the checkout and not the other payment methods and the PayPal recurring plugin will automatically setup a recurring payment every 31 days with a price of 10.
So in that onCheckSubscription function, it's up to you to load the subscription data from emerald's database, and make it translate to the $result array with the format that will be used by the PayPal recurring payment plugin.
2. Yes, you need to use onAfterOrderUpdate to create/extends subscriptions when orders are confirmed. That's the same principle whether the subscription is a recurring one or not.
The onCheckSubscription and onCheckSubscriptionPlugin function allows you to give to the PayPal recurring plugin the information of the duration of the recurring and the amount you want the customers to pay each time and whether a product is attached to a recurring subscription or not (you might be selling both types of products/subscriptions on your website) so that our system can properly handle the payments.
Basically, you don't have to care about how the payment is done, confirmed, etc.
You just provide the recurring options coming from the emerald subscriptions attached to the products and HikaShop handles the rest and the subscription creation/extension works the same as when you don't support recurring payments.