Recurring payment extension


New Member
Hello again mailwizz community,so i'm working on an update for recurring payment on a payment gateway extension i made for my country,so i saw that @twisted1919 created something like that for a payment gateway he did,so i wanted to know how i can get the payment gateway to call back a url on the backend to notify the mailwizz backend that a payment has been made so his quota should be refreshed..thanks again
@kofo - in my recurring extension, i have this piece of code:
// register the url rule to resolve the extension page.
    array('ext_stripe_subscriptions_webhooks/index', 'pattern' => 'stripe/webhooks'),

// add the backend controller
Yii::app()->controllerMap['ext_stripe_subscriptions_webhooks'] = array(
    'class'     => $this->extension->getPathAlias('frontend.controllers.ExtStripeSubscriptionsWebhooksController'),
    'extension' => $this->extension,
So basically anyone hitting the will instantiate the ExtStripeSubscriptionsWebhooksController controller which is located inside the extension, and that will take proper actions.
yes i understand that @twisted1919 but how can i get the controller to 1) create an order for the customer email 2)complete the transaction and complete the order....basically if you can just show me a sample code to create an order for a customer using an email and price plan
@kofo - i can show you the controller i have:
class ExtStripeSubscriptionsWebhooksController extends Controller
     * @var PaymentGatewayStripeSubscriptionsExt
    public $extension;
     * Default action.
    public function actionIndex()
        $rawBody = Yii::app()->request->getRawBody();
        $data    = !empty($rawBody) ? @json_decode($rawBody, true) : null;
        if (empty($data) || empty($data['data']) || 
            empty($data['data']['object']['customer']) || 
            empty($data['data']['object']['subscription']) || 
            empty($data['data']['object']['paid']) || 
            empty($data['type']) || $data['type'] != 'invoice.payment_succeeded') {
        try {
            $stripeCustomer = \Stripe\Customer::retrieve($data['data']['object']['customer']);
            $subscription   = $stripeCustomer->subscriptions->retrieve($data['data']['object']['subscription']);
        } catch (Exception $e) {
            Yii::log($e->getMessage(), CLogger::LEVEL_ERROR);

        $order = PricePlanOrder::model()->findByAttributes(array(
            'customer_id' => $subscription->metadata->customer_id,
            'order_id'    => $subscription->metadata->order_id,
            'status'      => PricePlanOrder::STATUS_INCOMPLETE,
        if (!empty($order)) {
            $order->status = PricePlanOrder::STATUS_COMPLETE;
        $order = new PricePlanOrder();
        foreach ($subscription->metadata as $key => $value) {
            if ($order->hasAttribute($key)) {
                $order->setAttribute($key, $value);
        $order->order_id = $order->date_added = $order->last_updated = null;
        $order->status = PricePlanOrder::STATUS_COMPLETE;

        $transaction = new PricePlanOrderTransaction();
        $transaction->order_id                       = $order->order_id;
        $transaction->payment_gateway_name           = 'Stripe Subscriptions -';
        $transaction->payment_gateway_transaction_id = $subscription->id;
        $transaction->payment_gateway_response       = print_r((array)$subscription, true);
        $transaction->status                         = PricePlanOrderTransaction::STATUS_SUCCESS;
@Niko - It's in the review queue as we speak, will take a few days to get approved but you'll then see it in your Store area from mailwizz.
Is compatible with older version of mwizz?
>= but that's just because of the design. if you open the extension and modify the minimum requirement to it will work, it's just it will look a bit distinct.