我正在尝试为Global Payment Gateway创建定期付款。但是变得低于错误-
所选网关不支持此事务类型。
$config = new ServicesConfig();
$config->merchantId = "merchantId";
$config->accountId = "accountId";
$config->sharedSecret = "sharedSecret";
$config->serviceUrl = "https://pay.sandbox.realexpayments.com/pay";
$config->hostedPaymentConfig = new HostedPaymentConfig();
$config->hostedPaymentConfig->version = HppVersion::VERSION_2;
if ($recurring){
$config->hostedPaymentConfig->cardStorageEnabled = "1";
}
$service = new HostedService(
$config
);
$hostedPaymentData = new HostedPaymentData();
$hostedPaymentData->offerToSaveCard = true; // display the save card tick box
$hostedPaymentData->customerExists = false; // new customer
echo $service->Authorize($amount)
->withCurrency($currency_code)
->withRecurringInfo(RecurringType::FIXED, RecurringSequence::FIRST)
->withOrderId($order_id)
->withHostedPaymentData($hostedPaymentData)
->serialize();
在服务器端,我从付款网关收到带有客户ID和付款ID的POST响应。
$parsedResponse = $service->parseResponse(json_encode($_POST));
$responseValues = $parsedResponse->responseValues; // get values accessible by key
$schedule = createSchedule($responseValues);
function createSchedule($responseValues)
{
$schedule = new Schedule();
$customerKey = $responseValues['SAVED_PAYER_REF'];
$paymentMethodKey = $responseValues['SAVED_PMT_REF'];
$orderId = $responseValues['ORDER_ID'];
$amount = $responseValues['AMOUNT'];
$schedule->id = getIdentifier('CreditV');
$schedule->customerKey = $customerKey;
$schedule->paymentKey = $paymentMethodKey;
$schedule->amount = $amount;//$_REQUEST['a3'] * 100;
$schedule->currency = 'EUR';//$_REQUEST['cc']
$schedule->startDate = date('mdY'); //, strtotime("last day of next month")
$schedule->paymentSchedule = PaymentSchedule::DYNAMIC; //or PaymentSchedule::FIRST_DAY_OF_THE_MONTH
$schedule->frequency = ScheduleFrequency::WEEKLY; //'Monthly', 'Bi-Monthly', 'Quarterly', 'Semi-Annually'
$schedule->numberOfPayments = 4;
$schedule->description = 'Test';
$schedule->poNumber = $orderId;
$schedule->reprocessingCount = 1;
$schedule->emailReceipt = 'Never';
$schedule->status = 'Active';
$response = $schedule->create();
return $response;
}
function getIdentifier($id)
{
$identifierBase = '%s-%s' . substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, 10);
return sprintf($identifierBase, date('Ymd'), $id);
}
答案 0 :(得分:0)
感谢您的提问。不幸的是,Global Payments SDK现在不支持使用Global Payments电子商务解决方案创建计划的付款。它可以与Heartland网关一起使用,但这是单独的产品,目前仅在美国使用。
如果您是带有“托管付款”页面的字符串卡,则可以使用我们的XML API针对它们设置时间表:https://developer.globalpay.com/#!/api/payment-scheduler