Braintree Payments支持返回subscription_id的Webhooks。我一直在寻找一个PHP代码示例,它将返回给定subscription_id的事务详细信息。 Braintree文档没有提供任何示例。
我知道这段代码错了,但我想在解决方案上付出一些努力。 :)
<?php
$id = $_SERVER['QUERY_STRING'];
require_once '_environment.php';
$collection = Braintree_Transaction::search(array(
Braintree_TransactionSearch::subscriptionId()->is($id)
));
foreach ($collection AS $item) {
echo "<li>" . $item->id;
}
?>
答案 0 :(得分:1)
我在Braintree工作。如果您需要更多帮助,可以随时reach out to our support team。
您只需要get the subscription:
$subscription = Braintree_Subscription::find('a_subscription_id');
它有list of all of its transactions:
$transactions = $subscription->transactions;