PHP Braintree集成 [英] php braintree integration

查看:86
本文介绍了PHP Braintree集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Braintree API集成到我的PHP应用程序中.我是集成支付网关的新手.请帮我提供一些Braintree API的示例代码.

I am trying to integrate the Braintree API into my PHP application. I am new in integrating payment gateway. Please, help me with some example code for Braintree API.

推荐答案

以下是您绝对需要入门的代码:

Here is the code you will absolutely need to get started:

require_once 'PATH_TO_BRAINTREE/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');

登录沙盒帐户时,可以在右上角的帐户"菜单下,依次单击我的用户"和"API密钥",找到商户ID,公钥和私钥.实际上,您只需从语言下拉菜单中选择"PHP",然后单击复制"按钮,即可使用您的凭据正确填充上述代码.

You can find your merchant ID, public key and private key when you log into your sandbox account by looking under the "Account" menu in the top right, clicking on "My User" then on "API Keys". You can actually just select "PHP" from the language dropdown and then the "Copy" button to get the above code populated correctly with your credentials.

在那之后,我建议尝试创建一个简单的事务,以确保一切正常.看看Braintree PHP文档上的快速入门示例,看看是否可以运行该代码(替换后以获取成功的交易.

After that I would recommend trying to get a simple transaction created to make sure you have everything working. Take a look at the quick start example on the Braintree PHP docs and see if you can run that code (after replacing the Braintree_Configuration and require lines) as is to get a successful transaction.

如果您可以使用该代码,那么我可以继续进行自己的集成,或者您可以看一下示例应用程序在PHP中更好地了解完全集成的外观.

If you can get that code working I would either move on to your own integration or you can take a look at this example application in PHP to get a better idea of what a full integration might look like.

如果您仍然遇到问题,请随时联系Braintree支持.如果您还有更多技术问题,支持团队会迅速做出回应,甚至可以与您联系开发人员.

If you're still running into problems feel free to contact Braintree support. The support team responds quickly and can even put you in touch with a developer if you have more technical questions.

这篇关于PHP Braintree集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆