giftd/giftd-php-client
Composer 安装命令:
composer require giftd/giftd-php-client
包简介
GIFTD API PHP client. Allows to check promo codes
README 文档
README
This repository contains a PHP Client for the API of Giftd.tech project.
Check out the full API documentation.
Requirements
-
PHP version >= 5.3.3
-
php-cURL extension
Take a look at example.php to find usage examples.
Installation
composer require giftd/giftd-php-client
Basic usage example
<?php $basketTotal = 900; $promoCode = '1234-5678-9876-4321'; $giftdUserId = 1234; $giftdApiKey = '7815696ecbf1c96e6894b779456d330e'; $apiClient = new Giftd\ApiClient($giftdUserId, $giftdApiKey); $card = $apiClient->checkByToken($promoCode, $basketTotal); if ($card) { if ($card->is_available) { echo "Available amount: {$card->amount_available}; minimum amount total: {$card->min_amount_total}"; // You may redeem this promocode after user finishes the order (i.e. charge the card): // $apiClient->charge($promoCode, $card->amount_available) } else { echo "No amount available on the gift card"; } } else { echo "Wrong token passed, gift card not found!"; } ?>
Support
Please send your questions and suggestions to support@giftd.tech.
统计信息
- 总下载量: 4.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-04