Произошла ошибка: отправка номеров кредитных карт непосредственно в Stripe API обычно небезопасна. Чтобы продолжить обработку, используйте Stripe.js, мобильные привязки Stripe или элементы Stripe. Для получения дополнительной информации см. https://dashboard.stripe.com/account/in ... n/settings. Если у вас есть право напрямую обрабатывать данные карты, см. https://support.stripe.com/questions/en ... -data-apis. Файл: /home/wlms/webapps/wlms-apiv2/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php Строка: 38
Мой внутренний код:
публичная функция doPayment($payRequest)
{
Код: Выделить всё
try {
$payment_transaction_id = $paymentRequest['payment_transaction_id'];
$zeroDecimalCurrencies = array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
if (!in_array($paymentRequest['currency'], $zeroDecimalCurrencies)) {
$payment_amount = ($paymentRequest['total_value']) * 100;
} else {
$payment_amount = $paymentRequest['total_value'];
}
$paymentIntentCreate = $this->stripe->paymentIntents->create([
"amount" => $payment_amount,
"currency" => $paymentRequest['currency'],
'payment_method_types' => ['card'],
'customer' => $paymentRequest['stripe_customer_id']
]);
$paymentIntentConfirm = $this->stripe->paymentIntents->confirm(
$paymentIntentCreate->id,
['payment_method' => $paymentRequest['payment_method_id']]
);
$gateWayResponse = PaymentGatewayResponse::create(array('transaction_id' => $payment_transaction_id, 'response' => $paymentIntentConfirm));
return $paymentIntentConfirm;
} catch (\Stripe\Exception\CardException $e) {
ErrorLogger::logError($e);
return false;
// Since it's a decline, \Stripe\Exception\CardException will be caught
} catch (\Stripe\Exception\RateLimitException $e) {
ErrorLogger::logError($e);
return false;
// Too many requests made to the API too quickly
} catch (\Stripe\Exception\InvalidRequestException $e) {
ErrorLogger::logError($e);
return false;
// Invalid parameters were supplied to Stripe's API
} catch (\Stripe\Exception\AuthenticationException $e) {
ErrorLogger::logError($e);
return false;
// Authentication with Stripe's API failed
// (maybe you changed API keys recently)
} catch (\Stripe\Exception\ApiConnectionException $e) {
ErrorLogger::logError($e);
return false;
// Network communication with Stripe failed
} catch (\Stripe\Exception\ApiErrorException $e) {
ErrorLogger::logError($e);
return false;
// Display a very generic error to the user, and maybe send
// yourself an email
} catch (Exception $e) {
ErrorLogger::logError($e);
return false;
// Something else happened, completely unrelated to Stripe
}
$gateWayResponse = PaymentGatewayResponse::create(array('transaction_id' => $payment_transaction_id, 'response' => $e->getMessage()));
return ['status' => 0, 'data' => $e->getMessage(), 'message' => 'Payment Failed'];
}
Убедитесь, что ваш внешний интерфейс правильно токенизирует данные карты и отправляет на серверную часть только токенизированный pay_method_id.
Есть решения?
Подробнее здесь: https://stackoverflow.com/questions/785 ... lly-unsafe