eusonlito/braintree_php

此包已被弃用且不再维护。未建议替代包。

Braintree PHP 客户端库

3.5.0 2015-09-23 21:46 UTC

README

Braintree PHP 库提供对 Braintree 网关的集成访问。更新原始代码以支持命名空间和 PSR-4 加载。

依赖项

需要 PHP 版本 >= 5.4.0。

以下 PHP 扩展是必需的

  • curl
  • dom
  • hash
  • openssl
  • xmlwriter

Composer 安装

"eusonlito/braintree_php" : "dev-master"

快速入门示例

<?php

require_once '/braintree/folder/src/autoload.php';

Braintree\Configuration::reset();
Braintree\Configuration::environment('sandbox');
Braintree\Configuration::merchantId('your_merchant_id');
Braintree\Configuration::publicKey('your_public_key');
Braintree\Configuration::privateKey('your_private_key');

$result = Braintree\Transaction::sale(array(
    'amount' => '1000.00',
    'creditCard' => array(
        'number' => '5105105105105100',
        'expirationDate' => '05/12'
    )
));

if ($result->success) {
    print_r("success!: " . $result->transaction->id);
} else if ($result->transaction) {
    print_r("Error processing transaction:");
    print_r("\n  code: " . $result->transaction->processorResponseCode);
    print_r("\n  text: " . $result->transaction->processorResponseText);
} else {
    print_r("Validation errors: \n");
    print_r($result->errors->deepAll());
}

?>

HHVM 支持

Braintree PHP 库将在 HHVM >= 3.4.2 上运行。

旧版 PHP 支持

版本 2.40.0 与 PHP 5.2 和 5.3 兼容。您可以在我们的发布页面找到它。

文档

开源归属

帮助 Braintree 运行的开源项目列表可以在 此处 找到。

许可证

查看 LICENSE 文件。