如何在 bluesnap 支付网关中获取交易 ID 和名称

how to get transaction id and name in bluesnap payment gateway

我在 PHP 中使用 bluesnap 支付网关。它工作正常。但是在 return 我没有得到交易 ID,客户名称也没有显示在沙盒帐户中。

下面是我的交易页面,其中 blusnap 代码将是 运行 和 return 所需的输出。

require_once('New_folder/vendor/autoload.php');

$environment = 'sandbox'; // or 'production'
$keys = \tdanielcox\Bluesnap\Bluesnap::init($environment, 'API_111111111111111111111', 'password11');

$response = \tdanielcox\Bluesnap\CardTransaction::create([
    'creditCard' => [
        'firstName' => 'Jane',
        'lastName' => 'Shopper',
        'cardNumber' => '3566000020000410',
        'expirationMonth' => '02',
        'expirationYear' => '2023',
        'securityCode' => '123'
    ],
    'amount' => 10.00,
    'currency' => 'USD',
    'recurringTransaction' => 'ECOMMERCE',
    'cardTransactionType' => 'AUTH_CAPTURE',
]);

if ($response->failed())
{
    $error = $response->data;
    $transaction = $response->data;
echo"<pre>";
print_r($transaction);
echo"</pre>";

    // handle error
}

$transaction = $response->data;
echo"<pre>";
print_r($transaction);
echo"</pre>";
//$transaction;

我的成功响应是: 在此 return 交易 ID 未显示。而且也没有在 bluesnap 沙箱面板中获取客户名称。

tdanielcox\Bluesnap\Models\CardTransaction Object
(
[children:protected] => Array
    (
        [transactionMetaData] => item
        [creditCard] => item
        [vendorInfo] => item
    )

[cardTransactionType] => AUTH_CAPTURE
[amount] => 10
[recurringTransaction] => ECOMMERCE
[merchantTransactionId] => 
[softDescriptor] => BLS*onboardingDefault
[vaultedShopperId] => 27595185
[currency] => USD
[transactionMetaData] => 
[creditCard] => tdanielcox\Bluesnap\Models\CreditCard Object
    (
        [cardNumber] => 
        [encryptedCardNumber] => 
        [cardLastFourDigits] => 0410
        [cardType] => JCB
        [expirationMonth] => 
        [expirationYear] => 
        [securityCode] => 
        [encryptedSecurityCode] => 
        [children:protected] => Array
            (
            )

        [cardSubType] => CREDIT
        [cardCategory] => STANDARD
        [binCategory] => CONSUMER
        [cardRegulated] => N
        [issuingCountryCode] => us
    )

[transactionFraudInfo] => 
[id] => 1031167745
[usdAmount] => 10
[transactionApprovalDate] => 05/29/2020
[transactionApprovalTime] => 00:07:12
[cardHolderInfo] => Array
    (
    )

[processingInfo] => Array
    (
        [processingStatus] => success
        [cvvResponseCode] => ND
        [authorizationCode] => 654321
        [avsResponseCodeZip] => U
        [avsResponseCodeAddress] => U
        [avsResponseCodeName] => U
    )

[fraudResultInfo] => Array
    (
    )

)

购物者姓名在您的请求中的位置不正确。试试这个:

create([
'cardHolderInfo' => [
        'firstName' => 'Jane',
        'lastName' => 'Shopper'
    ],
    'creditCard' => [
        'cardNumber' => '3566000020000410',
        'expirationMonth' => '02',
        'expirationYear' => '2023',
        'securityCode' => '123'
    ],
    'amount' => 10.00,
    'currency' => 'USD',
    'recurringTransaction' => 'ECOMMERCE',
    'cardTransactionType' => 'AUTH_CAPTURE',
]);

来源:https://developers.bluesnap.com/v8976-JSON/docs/auth-capture

transactionId 总是在响应中返回,确保显示它的 php 代码或模型没有任何问题..