I'm installing brain tree on my server, I visit their GitHub and download their sample project this work fine the only problem is that this is not a clean installation. I download the clean installation from braintree the structure of these folders are completely different. I have access to my merchant number and everything else I need but I do not know where I need to put them, do I place them in every file that is using?. Before I was using Checkout to make all changes. in the version that I download it look like I have to send customers info and transactions to different files. sorry if this situation sound confusing but Braintree get started did not a great job explaining things.
New download file structure
old file Structure
答案 0 :(得分:2)
完全披露:我在Braintree工作。如果您有任何其他问题,请随时联系support。
客户端库本身在根级别上将具有与您在示例集成中看到的不同的文件结构。这是因为客户端库在安装时通过composer安装到示例集成中的/ vendor目录中。如果从/ vendor目录中检查它,它看起来应该非常相似
也就是说,任何Braintree与PHP集成,您都需要让PHP脚本加载库本身来初始化创建对Braintree的API调用所需的各种类,方法和对象。这意味着您的API密钥和Braintree客户端库中/lib/Braintree.php
文件的路径。通常的做法是包含一个“自动加载”PHP文件,以便在给定文件中使用这些API密钥和客户端库的路径,该文件将使用Braintree API调用。下面是一个类似文件的示例:
<?php
require_once '/PATH/to/braintree-php-3.17.0/lib/Braintree.php';
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('your_merchant_id');
Braintree_Configuration::publicKey('your_public_key');
Braintree_Configuration::privateKey('your_private_key');
?>
关于将信息发送到其他文件的第二个问题,根据您的集成情况可能会出现这种情况。如果特定文件处理对Braintree的特定API调用,那么情况就是如此。来自表单的用于创建客户的操作将被发送到包含Braintree_Customer::create()
调用的一个php文件,并且用于创建事务的操作将转到包含{{1}的文件。打电话。您不必将数据发送到 Braintree客户端库中的各种php文件,因为我们documentation中概述的API调用根据需要创建/发送各种事务对象到Braintree。
然而,这些可能是包含在单个PHP文件中的类或其他逻辑的一部分。这一切都取决于你的整合。