directaff/php-sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

directaff/php-sdk

最新稳定版本:0.1.1

Composer 安装命令:

composer require directaff/php-sdk

包简介

DirectAff php sdk

README 文档

README

Introduction

The DirectAff PHP SDK provides a simple interface to interact with the DirectAff API. This SDK offers methods to register, deposit, withdraw, manage bonuses, bet/win actions, and handle chargebacks.

Installation

This package can be installed via Composer:

composer require directaff/php-sdk

Configuration

Before making any API calls, ensure you set the base URL, secret API key, and brand ID:

use DirectAff\DirectAff;
$directAff = new DirectAff();
$directAff->setBaseUrl('YOUR_API_BASE_URL')
          ->setSecretApiKey('YOUR_SECRET_API_KEY')
          ->setBrandId(YOUR_BRAND_ID);

Methods

Register

To register a user:

$response = $directAff->register([
    'clickId' => 'exampleClickId',
    'identification' => 'exampleUsername', // it can be username or email or phone, userId
    'registration_date' => '2023-01-01 00:00:00'
]);

Register Through Promo Code (offline marketing)

To register a user through promo code:

$response = $directAff->registerThroughPromoCode([
    'promoCode' => 'examplePromoCode',
    'identification' => 'exampleUsername', // it can be username or email or phone, userId
    'ipAddress' => '127.0.0.1',
    'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)',
    'registration_date' => '2023-01-01 00:00:00'
]);

Deposit

To record a deposit:

$response = $directAff->deposit([
    'clickId' => 'exampleClickId',
    'amount' => 100,
    'currency' => 'USD',
    'depositId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);

Withdraw

To record a withdrawal:

$response = $directAff->withdraw([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'withdrawId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);

Chargeback

To record a chargeback:

$response = $directAff->chargeback([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'chargebackId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);

Bonus Added

To record a bonus added:

$response = $directAff->bonusAdded([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'bonusId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);

Bonus Removed

To record a bonus removed:

$response = $directAff->bonusRemoved([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'bonusId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);

Bet and Win

To record bet and win:

$response = $directAff->betWin([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'betAmount' => '125.10',
    'winAmount' => '104.25'
]);

Error Handling

Errors from the DirectAff API are returned as associative arrays with a success key set to false and an error key containing the error message.

For example:

[
    'success' => false,
    'error' => 'Click not found'
]

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-19