Stripe subscriptions
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Stripe subscriptions
Hey guys!
I need to use Stripe subscriptions. So I decided to install ai-payments. I faced problems.
1) There are no subscriptions, only single products for Stripe as I understood
2) There are no onepage checkout. I set onepage checkout:
It works fine, but if we check stripe payment, we will fill card data at another page. I need all in one page.
So I started to create my own extension and Payment Provider.
I added js and card form at /checkout page. When we click Buy Now it sending data to Stripe and taking token, then submit form. Now I want to use process() function to fetch all the data, and create an order.
Is it the right way to do full one page checkout?
p.s. After that i would create new order type- subscription
I need to use Stripe subscriptions. So I decided to install ai-payments. I faced problems.
1) There are no subscriptions, only single products for Stripe as I understood
2) There are no onepage checkout. I set onepage checkout:
Code: Select all
'checkout' => [
'standard' => [
'onepage' =>['address','delivery','payment','summary']
]
]
So I started to create my own extension and Payment Provider.
I added js and card form at /checkout page. When we click Buy Now it sending data to Stripe and taking token, then submit form. Now I want to use process() function to fetch all the data, and create an order.
Is it the right way to do full one page checkout?
p.s. After that i would create new order type- subscription
Last edited by Travin on 13 Jan 2018, 12:59, edited 1 time in total.
Laravel 6.18.19 | php 7.4.7 | Xubuntu | Aimeos Laravel 2019.10.5
Re: Stripe subscriptions
Yes, the default Stripe implementation asks for the payment data at the end and sends them to the Stripe server directly. By implementing your own payment service provider, you can do payment handling differently.
Embed the Stripe JS into the page (using the HTML client template for the checkout payment part) to get the token and store it as service attribute here: https://github.com/aimeos/ai-client-htm ... d.php#L227
After the order has been created by Aimeos, the process() method of your payment service provider is called where you can finish the payment based on your stored token.
Embed the Stripe JS into the page (using the HTML client template for the checkout payment part) to get the token and store it as service attribute here: https://github.com/aimeos/ai-client-htm ... d.php#L227
After the order has been created by Aimeos, the process() method of your payment service provider is called where you can finish the payment based on your stored token.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Stripe subscriptions
I am added some fields at my private $feConfig. So now it's new field at a payment form. Can you please tell me how can i take data from these fields at my process() function?
I tried
It does not work for me. My getConfigFE() is:
So is it possible to place fields with card data at the 1st checkout page, not at the second page how it is works at ai-payments Stripe, yes?
I tried
Code: Select all
print_r($feConfig = $this->feConfig);
print_r($this->getConfigFE($order));
Code: Select all
public function getConfigFE( \Aimeos\MShop\Order\Item\Base\Iface $basket )
{
$list = array();
foreach( $this->feConfig as $key => $config ) {
$list[$key] = new \Aimeos\MW\Criteria\Attribute\Standard( $config );
}
return $list;
}
Laravel 6.18.19 | php 7.4.7 | Xubuntu | Aimeos Laravel 2019.10.5
Re: Stripe subscriptions
The data is stored as order service attribute items:
https://github.com/aimeos/aimeos-core/b ... e.php#L560
You can retrieve them using something like (<code> is the code of the service payment option):
Here's are the interfaces:
https://aimeos.org/api/latest/class-Aim ... Attributes
https://aimeos.org/api/latest/class-Aim ... Iface.html
https://github.com/aimeos/aimeos-core/b ... e.php#L560
You can retrieve them using something like (<code> is the code of the service payment option):
Code: Select all
$orderBaseItem->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, '<code>' )->getAttributes();
https://aimeos.org/api/latest/class-Aim ... Attributes
https://aimeos.org/api/latest/class-Aim ... Iface.html
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Stripe subscriptions
I am creating my first Stripe payment integration. When i'm trying to use Omnipay without token, it responds me message from Stripe:aimeos wrote:Embed the Stripe JS into the page (using the HTML client template for the checkout payment part) to get the token
"Sending credit card numbers directly to the Stripe API is generally unsafe. We suggest you use test tokens that map to the test card you are using, see https://stripe.com/docs/testing.
Guys I don't understand how ai-payments works with Stripe without taking token
Anyway, I'm creating my solution with token and all-in-one page
First, I need to separate Stripe view and another Providers view. Because I need to show string for Stripe only: <script src="https://js.stripe.com/v3/"></script> and some other Stripe specific code.
So I decided to do something like that:
a) at my \client\html\templates\checkout\standard\payment-body-default.php http://joxi.ru/52anRkYUGRVK1A
b) at my config: http://joxi.ru/gmvY7qgfxV6kNr
Is it a good solution? How can I take Provider name instead of $id ?
Second, I need to handle purchase button click. By click on Purchase button I need to send request to Stripe first, then submit form. So I am creating something like
Code: Select all
$('body').on('click','#purchase-order-btn',function(e){
e.preventDefault();
// Some Stripe code before submit form
});
Here is my solution. Is it okay?
http://joxi.ru/YmEyNnDFZkdMPm
http://joxi.ru/xAeY510fY13bJA
Last edited by Travin on 23 Jan 2018, 20:48, edited 3 times in total.
Laravel 6.18.19 | php 7.4.7 | Xubuntu | Aimeos Laravel 2019.10.5
Re: Stripe subscriptions
The main idea is to separate html code from diferent Providers, and separate JS code from diferent Providers
Laravel 6.18.19 | php 7.4.7 | Xubuntu | Aimeos Laravel 2019.10.5
Re: Stripe subscriptions
My idea would be to add a method to the form helper object so providers can return specific HTML that is included into the template including JS code: https://github.com/aimeos/aimeos-core/b ... andard.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Stripe subscriptions
I want to explain this answer for Aimeos users here:aimeos wrote:The data is stored as order service attribute items:
https://github.com/aimeos/aimeos-core/b ... e.php#L560
You can retrieve them using something like (<code> is the code of the service payment option):Here's are the interfaces:Code: Select all
$orderBaseItem->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, '<code>' )->getAttributes();
https://aimeos.org/api/latest/class-Aim ... Attributes
https://aimeos.org/api/latest/class-Aim ... Iface.html
https://aimeos.org/docs/Developers/Libr ... figuration
Is it will be okay?
Laravel 6.18.19 | php 7.4.7 | Xubuntu | Aimeos Laravel 2019.10.5
Re: Stripe subscriptions
Sure, feel free to add more documentation. That's always welcome!
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Stripe subscriptions
Hey guys
I understood one thing about that row
The second parameter Code does not matter at my 2017.10. It always returns me Aimeos\MShop\Order\Item\Base\Service\Standard Object
But at 2018.1 if I don't pass Code, I'm recieving data from several relative Providers. It returns me an ARRAY of Aimeos\MShop\Order\Item\Base\Service\Standard Object
If I pass current Service Provider code, it returns me just one object (one element of the array). Like at 2017.10
I think it's somehow relative to a new feature of 2018.1 about having more than one service provider.
And now I know I can recieve a code of current provider by this expression
$code = $this->getServiceItem()->getCode();
I want to explain it at the docs
I understood one thing about that row
Code: Select all
$var = $orderBaseItem->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, '<code>' );
But at 2018.1 if I don't pass Code, I'm recieving data from several relative Providers. It returns me an ARRAY of Aimeos\MShop\Order\Item\Base\Service\Standard Object
If I pass current Service Provider code, it returns me just one object (one element of the array). Like at 2017.10
I think it's somehow relative to a new feature of 2018.1 about having more than one service provider.
And now I know I can recieve a code of current provider by this expression
$code = $this->getServiceItem()->getCode();
I want to explain it at the docs
Laravel 6.18.19 | php 7.4.7 | Xubuntu | Aimeos Laravel 2019.10.5