0

我浏览了他们的文档,上面写着将 Auto Settle Flag 设置为 MULTI。但是 PHP SDK 库中没有这样的参数。

从他们的文档

如何在 HPP 中将自动结算标志设置为 MULTI?

我还在下面添加了代码示例:

require_once('vendor/autoload.php');

use GlobalPayments\Api\Entities\Address;
use GlobalPayments\Api\Entities\Enums\AddressType;
use GlobalPayments\Api\ServicesConfig;
use GlobalPayments\Api\HostedPaymentConfig;
use GlobalPayments\Api\Entities\HostedPaymentData;
use GlobalPayments\Api\Entities\Enums\HppVersion;
use GlobalPayments\Api\Entities\Exceptions\ApiException;
use GlobalPayments\Api\Services\HostedService;

// configure client, request and HPP settings
$config = new ServicesConfig();
$config->merchantId = "MerchantId";
$config->accountId = "internet";
$config->sharedSecret = "secret";
$config->serviceUrl = "https://pay.sandbox.realexpayments.com/pay";

$config->hostedPaymentConfig = new HostedPaymentConfig();
$config->hostedPaymentConfig->version = HppVersion::VERSION_2;
$service = new HostedService($config);

// Add 3D Secure 2 Mandatory and Recommended Fields
$hostedPaymentData = new HostedPaymentData();
$hostedPaymentData->customerEmail = "james.mason@example.com";
$hostedPaymentData->customerPhoneMobile = "44|07123456789";
$hostedPaymentData->addressesMatch = false;

$billingAddress = new Address();
$billingAddress->streetAddress1 = "Flat 123";
$billingAddress->streetAddress2 = "House 456";
$billingAddress->streetAddress3 = "Unit 4";
$billingAddress->city = "Halifax";
$billingAddress->postalCode = "W5 9HR";
$billingAddress->country = "826";

$shippingAddress = new Address();
$shippingAddress->streetAddress1 = "Apartment 825";
$shippingAddress->streetAddress2 = "Complex 741";
$shippingAddress->streetAddress3 = "House 963";
$shippingAddress->city = "Chicago";
$shippingAddress->state = "IL";
$shippingAddress->postalCode = "50001";
$shippingAddress->country = "840";

try {
   $hppJson = $service->authorize(19.99)
      ->withCurrency("EUR")
      ->withHostedPaymentData($hostedPaymentData)
      ->withAddress($billingAddress, AddressType::BILLING)
      ->withAddress($shippingAddress, AddressType::SHIPPING)
      ->serialize();      
   // TODO: pass the HPP JSON to the client-side    
} catch (ApiException $e) {
   // TODO: Add your error handling here
}
4

1 回答 1

0

目前,Global Payments PHP SDK 似乎不支持多捕获。

https://github.com/globalpayments/php-sdk/blob/master/src/Gateways/RealexConnector.php#L163

但是,正在添加多捕获功能,并将在将来的某个时候提供。

在此之前,请随时更新 repo 的 fork,以满足您的需求。我们在基本级别 TransactionBuilder 上添加了一个多捕获布尔标志,并通过 AuthorizationBuilder 将此标志使用到 RealexConnector 的 processTransaction 方法中。然后我会检查标志,并将自动设置设置为“MULTI”,如果未设置,则遵循 0/1 值的现有逻辑。

于 2020-07-07T12:22:20.997 回答