Create a Commission with Affast

This guide will show you how to create a commission for a referral. You can create many commissions for a referral if you want to implement Recurring commissions model (lifetime commissions) for your application.

When will you should create a commission?

You can create a commission whenever you want to give the marketer a commission.

For example, if your website is a SaaS application, and it allows customer to register an account with 14 day-free trial. You don't want to give a commission to the marketer until the customer finishes his trial period, and actually pays for his subscription. Then, let's just create a commission whenever the subscription invoice is paid.

Create a Commission

To create commission, you need to make a request to the Commission API endpoint.

$response = $this->http->post('https://affast.app/api/commissions', [
    'referral_id'    => $customer->referred_by,
    'invoice_amount' => 40 // This is $40.
]);

$commission = $response->body();

Commission States

  • Pending: This is the initial state of a commission. You can cancel a commission at this state.
  • Next Payout: After x days, all pending commissions will be changed to this state automatically which mean it become available for the marketers. You can config x days setting in your Admin panel.
  • Paid: After you mark the next payout commissions, their state will be changed to Paid.
  • Canceled: The commission will have Canceled state if you cancel it.