如何测试 Braintree 交易退款? [英] How to test a Braintree transaction refund?

查看:43
本文介绍了如何测试 Braintree 交易退款?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对 Braintree 交易退款进行测试,但遇到了问题.Braintree 的 API 仅允许您为已结算的交易发出退款.但是,在沙盒环境中创建的交易仅每 24 小时结算"一次.因此,当我尝试在测试套件中退款时,退款总是被拒绝,因为原始交易是submitted_for_settlement"而不是settled".

I'm trying to run tests on Braintree transaction refunding, but I'm running into a problem. Braintree's API only allows you to issue refunds for transactions that have settled. However, transactions created in the sandbox environment only "settle" once every 24 hours. So, when I try to refund them in the test suite, the refunds are always rejected because the original transaction is "submitted_for_settlement" and not "settled".

有什么办法吗?

推荐答案

我在 Braintree 工作.如果您还有其他问题,可以随时与我们的支持团队联系.

Braintree PHP 库中的 TestHelper 有一种在沙盒中结算交易的方法:

The TestHelper in the Braintree PHP library has a method to settle a transaction in sandbox:

class Braintree_TestHelper
{
    . . .

    public static function settle($transactionId)
        {
            $http = new Braintree_Http(Braintree_Configuration::$global);
            $path = Braintree_Configuration::$global->merchantPath() . '/transactions/' . $transactionId . '/settle';
            $http->put($path);
        }

    . . .
}

我们支持的其他语言也有类似的方法.

Similar methods exist for our other supported languages.

这篇关于如何测试 Braintree 交易退款?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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