← Back to Stripe for Shopaholic Support
Hello, I've installed this plugin following the documentation.
The problem is there is no "Stripe payment gateway" option in the "Settings > Catalog Configuration > Payment Methods". When I try to create a payment method, there are no options to "Enter your Stripe public key in "API Key public" field and your secret key in "apiKey" fields."
Any help is appreciated. Thanks.
I've updated Plugin.php to this:
use Lovata\OmnipayShopaholic\Classes\Helper\PaymentGateway;
use Lovata\OrdersShopaholic\Models\PaymentMethod;
public function boot()
{
Event::listen(PaymentMethod::EVENT_GET_GATEWAY_LIST, function () {
return [
ExtendFieldHandler::STRIPE_GATEWAY_ID => 'Stripe',
];
});
PaymentMethod::extend(function ($obElement) {
/** @var PaymentMethod $obElement */
$obElement->addGatewayClass('Stripe', PaymentGateway::class);
});
$this->addEventListener();
}
And now I'm able to see the Stripe payment gateway option and settings for API Key. Could you please fix this plugin to works with October 2? Thank you very much.
Vojta Svoboda said:
I've updated Plugin.php to this:
use Lovata\OmnipayShopaholic\Classes\Helper\PaymentGateway; use Lovata\OrdersShopaholic\Models\PaymentMethod; public function boot() { Event::listen(PaymentMethod::EVENT_GET_GATEWAY_LIST, function () { return [ ExtendFieldHandler::STRIPE_GATEWAY_ID => 'Stripe', ]; }); PaymentMethod::extend(function ($obElement) { /** @var PaymentMethod $obElement */ $obElement->addGatewayClass('Stripe', PaymentGateway::class); }); $this->addEventListener(); }
And now I'm able to see the Stripe payment gateway option and settings for API Key. Could you please fix this plugin to works with October 2? Thank you very much.
Added your fix in new plugin version.
Great, the new version works :-) Could you please update the README/documentation with step by step list of how to get it works? Because in Stripe.js documentation, there is a new required field https://stripe.com/docs/js/elements_object/create, so it is needed to create a Payment Intent call before creating a payment gate.
Vojta Svoboda said:
Great, the new version works :-) Could you please update the README/documentation with step by step list of how to get it works? Because in Stripe.js documentation, there is a new required field https://stripe.com/docs/js/elements_object/create, so it is needed to create a Payment Intent call before creating a payment gate.
I am currently looking to figure this part out myself. Thanks so much for the recent update! The issue I am running into now is that I don't appear to be able to actually make a payment intent with the checkout button. I am actually testing this on shopaholic's theme as well just to make sure I am doing it right, and in that theme it also does the same thing.
This is how I create payment intent and read clientSecret parameter in PaymentCardForm.php:
use Omnipay\Omnipay;
public function getPaymentIntentClientSecret()
{
$paymentMethod = $this->obOrderItem->payment_method->getObject();
// create payment intent gateway
$gw = Omnipay::create('Stripe\PaymentIntents');
$gw->initialize([
'apiKey' => $paymentMethod->getProperty('apiKey'),
]);
$paymentIntent = $gw->authorize([
'amount' => $this->obOrder->total_price_data->price_with_tax_value,
'currency' => $paymentMethod->gateway_currency,
'payment_method' => 'card',
]);
$data = $paymentIntent->getData();
unset($data['payment_method']);
$response = $paymentIntent->sendData($data);
$data = $response->getData();
return $data['client_secret'] ?? null;
}
Vojta Svoboda said:
This is how I create payment intent and read clientSecret parameter in PaymentCardForm.php:
use Omnipay\Omnipay; public function getPaymentIntentClientSecret() { $paymentMethod = $this->obOrderItem->payment_method->getObject(); // create payment intent gateway $gw = Omnipay::create('Stripe\PaymentIntents'); $gw->initialize([ 'apiKey' => $paymentMethod->getProperty('apiKey'), ]); $paymentIntent = $gw->authorize([ 'amount' => $this->obOrder->total_price_data->price_with_tax_value, 'currency' => $paymentMethod->gateway_currency, 'payment_method' => 'card', ]); $data = $paymentIntent->getData(); unset($data['payment_method']); $response = $paymentIntent->sendData($data); $data = $response->getData(); return $data['client_secret'] ?? null; }
Adding this to your PaymentCardForm.php file (adding the function inside the ComponentSubmitForm I am assuming) caused it to work? My issue right now is that my submit button doesn't seem do do anything at all when I checkout, both on my own shopping cart and the shopaholic theme. I only have stripe as a payment method.
Adding this to your PaymentCardForm.php file (adding the function inside the ComponentSubmitForm I am assuming) caused it to work? My issue right now is that my submit button doesn't seem do do anything at all when I checkout, both on my own shopping cart and the shopaholic theme. I only have stripe as a payment method.
Added new version to the plugin with new method and code example. Please see "Payment Intent example" section in docs: https://octobercms.com/plugin/vdomah-stripeshopaholic Thanks Vojta Svoboda for contribution!
Vojta Svoboda said:
This is how I create payment intent and read clientSecret parameter in PaymentCardForm.php:
use Omnipay\Omnipay; public function getPaymentIntentClientSecret() { $paymentMethod = $this->obOrderItem->payment_method->getObject(); // create payment intent gateway $gw = Omnipay::create('Stripe\PaymentIntents'); $gw->initialize([ 'apiKey' => $paymentMethod->getProperty('apiKey'), ]); $paymentIntent = $gw->authorize([ 'amount' => $this->obOrder->total_price_data->price_with_tax_value, 'currency' => $paymentMethod->gateway_currency, 'payment_method' => 'card', ]); $data = $paymentIntent->getData(); unset($data['payment_method']); $response = $paymentIntent->sendData($data); $data = $response->getData(); return $data['client_secret'] ?? null; }
So with the new updates to the plugin and the new documentation on the main plugin page, I now am able to get stripe to actually do something (as in, when I enter my info and hit pay, it takes me to a page that loads the stripe box), but when I actually enter my data, I am not actually successfully completing a payment in stripe. My stripe dashboard shows me all of my payments, and they are all telling me "incomplete" (and for some reason I have 2 for each attempt).
Under one of these payments, the Events and Logs section tells me the following: Latest activity
PaymentIntent status: requires_payment_method The PaymentIntent requires a payment method Set an existing payment method on the PaymentIntent or have the customer enter a new payment method.
However, I don't see anywhere were we are actually sending this or where the customer is able to select anything but a card number.
vdomah said:
Hi, thanks for report, I'll check it shortly
Is it possible for me to get approved to post here? I am worried that my reported issues aren't being seen by anyone that I don't actually quote. My colleague was going to check out my issue and he said he couldn't even see my replies.
jlarson69874 said:
vdomah said:
Hi, thanks for report, I'll check it shortly
Is it possible for me to get approved to post here? I am worried that my reported issues aren't being seen by anyone that I don't actually quote. My colleague was going to check out my issue and he said he couldn't even see my replies.
new plugin version available: 1.0.5 Stripe payment method to Stripe Charge; Stripe Payment Intents and Stripe Checkout methods added. Thanks to Vojta Svoboda
1-13 of 13