Wave 2.0 / Paddle Affiliate Support?

goekki85

April 7, 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!

Select One:
tnylea

April 9, 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.

Select One:
Write
Preview
Help

Markdown Basics

DevDojo uses Markdown syntax for writing posts, commments, and other content throughout the site. Below you will find some commonly used markdown syntax. For a deeper dive in Markdown check out this Cheat Sheet


Bold & Italic

Italics *asterisks*

Bold **double asterisks**


Code

Inline Code `backtick`

Code Block

```
Three back ticks and then enter your code blocks here.
```

Headers

# This is Heading 1
## This is Heading 2
### This is Heading 3
#### This is Heading 4
##### This is Heading 5

Here is an example of how each heading will looks

Heading 1

Heading 2

Heading 3

Heading 4
Heading 5

Quotes

> type a greater than sign and start typing your quote.

Links

You can add links by typing the alt text inside of [] and the link inside of (), like so:

[links](https://devdojo.com)

Images

You can add images by selecting the image icon, which will upload and add an image to the editor, or you can manually add the image by adding an exclamation !, followed by the alt text inside of [], and the link inside of (), like so:

![alt text for image](https://cdn.devdojo.com/images/image.png)

Embedding Codepens

You can also embed a codepen pen by writing the following:

{% codepen https://codepen.io/your/pen/url %}

You may also choose the default tabs you wish to show your pen by writing the default-tab like so: (default is result)

{% codepen https://codepen.io/your/pen/url default-tab=result,html %}


Embedding YouTube Videos

You can also embed a YouTube video by writing the following:

{% youtube VIDEO_ID_HERE %}


Embedding Katacoda Terminal

You can also embed a Katacoda Terminal by writing the following:

{% katacoda %}

You may also choose if the terminal should float at the bottom of the page or be embeded in the post itself by writing float like so:

{% katacoda float %}


Embedding Asciinema

You can also embed an Asciinema video by writing the following:

{% asciinema YOUR_VIDEO_ID %}

You may also choose if the video should be added as an alternate rel tag, so it could later on be played with the `asciinema play https://devdojo/post-name` command, with the rel argument like so:

{% asciinema YOUR_VIDEO_ID rel %}


Embedding Gists

You can also embed a Gists by writing the following:

{% gist GIST_ID_HERE %}


Embedding buymeacoffee.com

You can also embed your "Buy me a coffee" button by writing the following:

{% buymeacoffee BUY_ME_A_COFFEE_USERNAME_HERE %}


Embedding CodeSandbox

You can also embed CodeSandbox by writing the following:

{% codesandbox YOUR_CODESANDBOX_EMBED_URL %}

Example:

{% codesandbox https://codesandbox.io/embed/rough-field-mykn0?fontsize=14&hidenavigation=1&theme=dark %}


That's about it. It's time to start crafting your story.

Please login, or signup to write a response.

Back to DevDojo