Braintree Webhook停留在对未定义方法Braintree \ Gateway :: webhookNotification()的调用中)>

问题描述 投票:0回答:1

我正在使用PHP SDK进行Braintree市场付款,需要Webhook通知,我试图实现Webhook,但我不知道这一点。我收到此错误

Call to undefined method Braintree\Gateway::webhookNotification()

我正在使用此代码金额和payment_method_nonce来自Dropin Ui脑树对于单笔付款,如果没有Webhook通知,也可以正常工作。

<?php
require_once("../includes/braintree_init.php");

$amount = $_POST["amount"];
$nonce = $_POST["payment_method_nonce"];

$merchantAccountParams = [
  'individual' => [
    'firstName' => 'Jane',
    'lastName' => 'Doe',
    'email' => '[email protected]',
    'phone' => '5553334444',
    'dateOfBirth' => '1981-11-19',
    'ssn' => '456-45-4567',
    'address' => [
      'streetAddress' => '111 Main St',
      'locality' => 'Chicago',
      'region' => 'IL',
      'postalCode' => '60622'
    ]
  ],
  'business' => [
    'legalName' => 'Jane\'s Ladders',
    'dbaName' => 'Jane\'s Ladders',
    'taxId' => '98-7654321',
    'address' => [
      'streetAddress' => '111 Main St',
      'locality' => 'Chicago',
      'region' => 'IL',
      'postalCode' => '60622'
    ]
  ],
  'funding' => [
    'descriptor' => 'Blue Ladders',
    'destination' => Braintree_MerchantAccount::FUNDING_DESTINATION_BANK,
    'email' => '[email protected]',
    'mobilePhone' => '5555555555',
    'accountNumber' => '1123581321',
    'routingNumber' => '071101307'
  ],
  'tosAccepted' => true,
  'masterMerchantAccountId' => "jonestechsolutionsllc",
  //'id' => "9m63s6"
];
$result = $gateway->merchantAccount()->create($merchantAccountParams);

$sampleNotification = $gateway->webhookTesting()->sampleNotification(
    Braintree_WebhookNotification::SUB_MERCHANT_ACCOUNT_APPROVED,
    $result->merchantAccount->id
);

$webhookNotification = $gateway->webhookNotification()->parse(
    $sampleNotification['bt_signature'],
    $sampleNotification['bt_payload']
);


$webhookNotification->subscription->id;

$res = $gateway->transaction()->sale([
  'merchantAccountId' => $result->merchantAccount->id,
  'amount' => '10.00',
  'paymentMethodNonce' => $nonce,
  'serviceFeeAmount' => "1.00"
]);
print_r($webhookNotification);
print_r($res);
exit;

在我的错误日志中,我收到此错误

Call to undefined method Braintree\Gateway::webhookNotification()

有人可以帮忙吗?

我正在使用PHP SDK进行Braintree市场付款,需要Webhook通知,我试图实现Webhook,但我不知道这一点。我收到此错误调用未定义方法Braintree \ ...

php payment braintree
1个回答
0
投票

问题是我还没有在braintree中设置webhook

© www.soinside.com 2019 - 2024. All rights reserved.