PayPal Chained Payments in Yii – Using the PayPal Adaptive Payments API

A quite common problem in various projects is integrating a payment functionality where the site acts as the middleman between the author of a paid content and the end user. Premium themes or video courses, for instance. The user pays the website, then the website pays the author, keeping some cut to itself of course. That behavior can be automated with PayPal, and with them, it’s called Adaptive Payments, or, to be more specific, Chained Payments. In the documentation, they’re illustrated like this:


In this tutorial, we’ll follow a very simple practice to stick this mechanism into a Yii project. It will be easily modifiable, and you’ll be able to use it for nearly any payment purposes. Ready for it? Let’s go!

Continue reading

Handling Statistics – Pulling data from Yii and displaying with HighCharts

“Facts are stubborn things, but statistics are pliable.” 
― Mark Twain

Sometimes, you might want to display some kind of charts in your Yii project based on the data that you’ve collected in your database. From the front end, there is an awesome way to do so, being a plugin called HighCharts, that is both eye-appealing and free to use if you’re not a commercial website. In this post, we’ll be looking at how to integrate it with a back end running on Yii. For an example of data, we’ll be logging website visits and visitors.

Gathering data

First of all, let’s get some data to start with. Create a simple table in the database that looks like this:

Снимок экрана 2014-08-17 в 17.01.38

and generate a model for it using Gii.

Continue reading