- Issue created by @kumkum29
- Status changed to Closed: won't fix
10 months ago 7:22am 19 June 2024 - 🇮🇱Israel jsacksick
Access denied is returned in case there are no payment options. You need to configure a payment gateway that supports tokenization... For example Commerce Stripe, Commerce Braintree, Commerce Authorize.net...
See the code below:
if (!$payment_options) { $payment_options = $this->buildPaymentOptions($form_state); if (!$payment_options) { throw new AccessDeniedHttpException(); } $form_state->set('payment_options', $payment_options); }
ANd then buildPaymentOptions() has that:
$payment_gateway_storage = $this->entityTypeManager->getStorage('commerce_payment_gateway'); $payment_gateways = $payment_gateway_storage->loadByProperties(['status' => TRUE]); $payment_gateways = array_filter($payment_gateways, function ($payment_gateway) { return $payment_gateway->getPlugin() instanceof SupportsCreatingPaymentMethodsInterface; });