Wave 2.0 / Paddle Affiliate Support?

goekki85

Apr 7th, 2021 07:21 AM

Hey everyone!

i cant wait for Wave 2.0 with Paddle Support. I've already buyed the SaaSAdventure course some time ago and build everything with Paddle Integration instead of Stripe (SaaSAdventure is by far the best course i got for this topic).

I now want to integrate Paddle's affiliate system to reward affiliates if they direct the traffic to my SaaS. I already did that utilizing Paddle's Paylink API with an additional parameter.

So before i come to my question i want to explain how i did it with laravel-cashier.

Here is the Paddle documentation. You can find the section to split funds between affiliates under "Using Pay Links to Split Funds"

The Laravel Cashier-Paddle packages gives you everything you need to accomplish this and provides a way to generate PayLinks with an affiliate parameter.

Here are the steps to get this working:

  1. You need an Paddle account which is activated for affiliates
  2. You need to add Paddle.js to every page between your landing page and the billing page.
  3. You need a database table with 2 fields (VendorID of the Affiliate + Split percentage)
  4. Your affiliates will get a link from Paddle which they promote. Paddle will set a cookie to the browser for your own domain. You are able to read the cookie in your Laravel application. Now you need to check if the visitor on your billing page came from an affiliate or not. To do this, you check the database if the affiliates vendor id is present or not. If the affiliates vendor id is in the database you can tell Paddle to Split the funds. My implementation is attached below. (Sorry for any programming "anti-patterns". This is my first version.)
public function billing(Request $request)
    {

        $user = auth()->user();

        //CHECK IF AFFILIATE COOKIE IS SET
        if (isset($_COOKIE['paddlejs_campaign_affiliate'])) {

            //CHECK IF AFFILIATE VENDOR ID IS SET IN COOKIE
            if (!empty(json_decode($_COOKIE['paddlejs_campaign_affiliate'])->affiliate)) {

                $affiliate_cookie = json_decode($_COOKIE['paddlejs_campaign_affiliate'])->affiliate;

                //TRY TO GET AFFILIATES VENDORID FROM DATABASE
                $affiliate_from_db = DB::table('affiliates')->where('vendor_id', $affiliate_cookie)->first();
                
                //IF THE VENDORID FROM THE COOKIE IS NOT IN DB, THAN GENERATE A PAYLINK WITHOUT AFFILIATE SPLIT
                if ($affiliate_from_db === null) {
                    $payLink = $user->newSubscription('default', $premium = XXXXXX)
                        ->create();

                 //IF THE VENDORID FROM THE COOKIE IS FOUND IN THE DB, THAN GENERATE A PAYLINK WITH AFFILIATE SPLIT      
                } else {
                    $payLink = $user->newSubscription('default', $premium = XXXXXX)
                        ->create([
                            'affiliates' => [$affiliate_from_db->vendor_id . ':' . $affiliate_from_db->percent / 100],
                        ]);
                }  
            } 

            //AFFILIATE VENDOR ID IS NOT SET IN COOKIE, SO GENERATE PAYLINK WITHOUT AFFILIATE SPLIT
            else {

                $payLink = $user->newSubscription('default', $premium = XXXXXX)
                    ->create();
            }

        //IF COOKIE IS NOT SET, GENERATE PAYLINK WITHOUT AFFILIATE SPLIT
        } else {
            $payLink = $user->newSubscription('default', $premium = XXXXXX)
                ->create();
        }

        return view('settings.billing', compact('payLink', 'user'));


    }

Will it be possible in Wave 2.0 to generate Paddle PayLinks with additional parameters? I already buyed Spark which is amazing but they dont support that. I already talked to them.

Wave looks very promising and i would use it if this is possible instead using of my custom implementation (which i don't trust 100% :-) ).

Many Thanks in advance!

tnylea

Apr 9th, 2021 07:19 PM

Hey @goekki85,

This does look really cool and I would be more than happy to add this implementation if you would like to submit a PR.

So, the new version of Wave is available; however, may not be ready for a couple days. You can check it out at https://github.com/thedevdojo/wave, would be happy to get some feedback.

Hope you're having a great day! Talk to you soon.

ngatsejacques

Jul 28th, 2022 01:29 AM

Hi, Does Paddle support affiliation ? I can't find it anywhere