External APIs
Buxale Affiliate Platform Integration Documentation
Introduction
Buxale is an affiliate platform developed for BKF. It provides a way for affiliates to earn commissions by referring new users to the platform. The Buxale service handles all payment and commission logic. In this documentation, we will provide an overview of the integration and usage of the Buxale service in the BKF application.
Overview
The BkfAffiliateService class is used to interact with the Buxale API. It is responsible for creating and managing user accounts, affiliate codes, and service users. During the checkout process, users can provide an affiliate code which will be used to match the affiliate.
The BkfAffiliateService class is located in the App\Services namespace and has the following main functions:
searchUserAccount(User $user): ?arraycreateUserAccount(User $user): ?intcreateAffiliateCode(User $user): ?stringcreateServiceUser(User $user, string $code): ?intgetServiceUser(User $user): ?arraydeleteServiceUser(User $user): boolsendCodeEvent(User $user, string $event, ?float $purchaseValueNet = null): boolgetCodeCommissions(User $user): ?arrayupdateEmail(User $user, string $oldEmail, string $newEmail)helperGetLocalAffiliateProgramUser(User $user): UsergetAffiliateCodeData(User $user): ?array
Workflow
- When a user registers on the platform, a Buxale user account is created using the
createUserAccount(User $user)method. This method returns the Buxale user ID. - An affiliate code is generated for the user using the
createAffiliateCode(User $user)method. This method returns the affiliate code. - During the checkout process, users can provide an affiliate code. This code is used to match the affiliate by creating a service user using the
createServiceUser(User $user, string $code)method. This method returns the service user ID. - Commissions are calculated and tracked by the external Buxale service. You can retrieve the commission stats for a user using the
getCodeCommissions(User $user)method.
Important Notes
- All payments and commission logic are handled by the external Buxale service.
- The affiliate code provided during the checkout process is used to match the affiliate and track commissions. Please refer to the BkfAffiliateService class for the full implementation and additional methods.