gnikyt / laravel-shopify Goto Github PK
View Code? Open in Web Editor NEWA full-featured Laravel package for aiding in Shopify App development
License: MIT License
A full-featured Laravel package for aiding in Shopify App development
License: MIT License
I think migration file should be copied into migrations folder when php artisan vendor:publish
When trying to install my app to shopify, I am able to authenticate it but then it redirects back to the apps login with the error Invalid signature
. It shows it installed in the store but when I try to access the app it just redirects back to the login with the same Invalid signature
message.
I checked the Key and secret and I dont see much information about this error.
Hi thanks for awesome package
I want to overwrite the home route of package but not able to do
its always redirect to package page
can you tell me how to do that
Hi,
I hope this is not too broad of a question, but I'm having issues accepting an ajax post request in the laravel-shopify app.
I've excluded this particular path from the CSRF verification on VerifyCsrfToken class, and the request does come in. However, if I pass any data to the request I get a 401 Unauthorized error, with the following on the request response preview
exception: "Symfony\Component\HttpKernel\Exception\HttpException"
file : "app/vendor/laravel/framework/src/Illuminate/Foundation/Application.php"
line : 942
message : "Invalid proxy signature"
If I don't pass any data on the request, it does go through.
For a little more context, this request is coming from a react application that is running proxy app requests. I have several working just fine, it was just now that I needed a post request that I ran into problems.
Any help much appreciated. Thank you!
I'm building an app that exposes a frontend on the public that feeds from proxy routes to pull data from the store.
This is a product builder, which at the end of the process should make a proxy request, which in turn has a controller method to create a new product in Shopify using the REST API routes.
I've tried two approaches, both resulting in different server errors.
Using the examples from the documentation, I've tried to instantiate a ShopifyApp
object as follows:
$shop = ShopifyApp::shop();
$response = $shop->api()->request('post', '/admin/products.json', [
'product' => [
'title' => 'teste'
]
]);
$products = $response->body;
This results in the following error message:
FatalThrowableError: Call to a member function api() on null
With null referring to the $shop
instance.
So I've tried a different approach, where I would instantiate from the BasicShopifyAPI
class instead, passing the necessary credentials:
$api = new BasicShopifyAPI(true);
$api->setShop(env('SHOPIFY_SHOP_URL'));
$api->setApiKey(env('SHOPIFY_API_KEY'));
$api->setApiPassword(env('SHOPIFY_API_SECRET'));
$response = $api->request('post', '/admin/products.json', [
'product' => [
'title' => 'test2'
]
]);
$products = $response->body;
In this case I get a different error message:
GuzzleHttp\Exception\ClientException: Client error: `POST https://f155dfa1e833a841e33573e00fe3272d:***@storename.myshopify.com/admin/products.json` resulted in a `401 Unauthorized` response:
{"errors":"[API] Invalid API key or access token (unrecognized login or wrong password)"}
I've double checked the env credential variables and they are accurate.
My guess this is because the proxy routes do not use the auth.shop
middleware, so I wonder what could be done to get around this and make this request succeed.
Thanks so much for any help.
My Shopify app is getting redirected to the login screen if the session is expired. Redirect to login screen is used for websites. But here, it's an app installed in a store. So if the session is getting expired, either it should be auto logged in somehow or should be displayed some message of session expire a redirected to app list. I have tried to override AuthShop middleware. But not getting the idea about what to do in the handle.
Here is the screenshot when the user gets redirected to the login screen.
Hi,
I tried to insert a code using asset API of Shopify. but it returned a 406 error - Client error: PUT https://good-time-store.myshopify.com/admin/themes/14690353211/assets.json
resulted in a 406 Not Acceptable
response
This is my code
$api = $shop->api();
$asset = [
[
'key' => 'layout/theme.liquid',
'value' => 'hello'
]];
$result = $api->request(
'PUT',
'/admin/themes/14690353211/assets.json',
['asset' => $asset]
);
Hello guys,
first of all, thanks for this package! It saves me plenty of time.
Following scenario:
charge_id
is being filledcharge_id
fields, the merchant can now use the app for free?How to handle this situation?
What is the best way to enable free access for partners and Shopify employees?
My first idea:
GET /admin/shop.json
Partners
if ($shop->plan_name === 'affiliate') {
return $next($request);
}
Shopify employees
// @see https://help.shopify.com/en/api/app-store/being-successful-in-the-app-store/offering-employee-discounts
if ($shop->plan_name === 'staff_business') {
return $next($request);
}
So i would need a way to skip or extend the billable middleware and call the shop.json endpoint (and store the plan_name in session?) before the billable middleware.
Should i add my own billable middleware to App/Http/Kernel.php
?
Any ideas?
Just testing this and noticed that when you attempt to install the app I receive the following error. (store names and urls redacted to protect the guilty!!)
Oauth error invalid_request: The redirect_uri is not whitelisted
however https://xxx.ngrok.io/authenticate is listed. On digging deep, I see the full Uri returned by this package is
https://xxxx.myshopify.com/admin/oauth/authorize?client_id=4b6b4752c52433568d44fae5b68798d3&scope=read_products,read_orders&redirect_uri=http://xxxx.ngrok.io/authenticate
As you see the redirect_uri is only http.(redirect_uri=http://xxxx.ngrok.io/authenticate) I've poked around the src and also the config and can't see what I've missed (which is highly possible).
Thanks for making this plugin, certainly made the first part easy.
Hello, I like your package, but I can't get the shop name I read the documentation
and I used facade class
`
use OhMyBrew\ShopifyApp\Facades\ShopifyApp;
return var_dump(ShopifyApp::shop());
`
but shop not exists and if I use it without facades I can't call it statically and I have to pass parameter to constructor
there for I tried to get it from session directly
return var_dump(\Session::get('shopify_domain'));
I get null
so how can I get shop name ???
Also the documentation dose state how can I have more than one charges plan I hope you can improve it
I enabled billing in the config (after reinstalling on Laravel 5.5) but when I install the app, it does not take me to the billing page. It just goes straight to the app homepage. Is there anything else that needs to be done apart from setting the billing parameters in the the config file?
Hello, still enjoying the package. Do you have any plans of adding a means to provide a capped amount and terms in cases where there will be a recurring charge and a periodic usage charge?
Here's the documentation: https://help.shopify.com/api/reference/recurringapplicationcharge#create
Thanks.
how do I combine auth laravel with this plugin?
need auth()->user()->shopify_domain
instead of session('shopify_domain')
so its easy to use eloquent model later
Now that 5.5 is released as a LTS I think its good to move the package to 5.5
I am not sure if any breaking changes will happen, but thats what my tests will tell me. Hopefully, 5.4 and 5.5 can work together.
Thanks for a great package.
If a shop owner has installed the app, do you see any issue with checking the hmac and after confirming the request is from Shopify and that the shop exists in the database, to go ahead and set the shop in the session and continue as an authenticated shop?
Currently, after the shop is installed, it works fine with a current session but after the session expires, within the Shopify admin, the login page is displayed where the user would need to re-enter the shop domain to continue.
I've overwritten the home controller index method with my own and assigned my own web route to the method but it seems to match what ships with this package and includes the auth.shop and billable middleware. I don't think I'm overlooking anything.
Just making sure I'm not creating a security issue or doing something that may conflict later with this package. Thanks again.
*** Update ***
I checked back on my development store a few hours later, clicked the app and, this time, my app home page loaded. I can also see that authentication triggered based on jobs I have running after authentication.
The issue of the login page loading inside of Shopify may be related to something in my code but it's pretty straightforward and I can't see anything in my implementation that would cause it.
Hello @ohmybrew, Thank you for this package I am currently studing this package for shopify and after installing the app to a store error occurred below screenshot:
https://www.screencast.com/t/eLynlUD2jDs
And the response of the access_token was nulled there no value save to the shop table.
Please advise. Thank you.
Regards,
Ronard
Undefined index: signature.
My Error : signature is dereated.
MD5 signature is no longer supported since 1st June.Can u help me ?
$signature = $query['signature' in AuthProxy.php
Hi,
In the login screen, I enter the shop name which redirect to the shopify screen to install the app. Then, I go back to the login screen instead of seeing the charge screen.
When I enter my domain with the billing route manually, then I can accept the charge.
Is this a bug or something I'm doing wrong?
Thank you.
In the overriding documentation it mentions that:
If you're overriding routes, be sure to open config/app.php and move this package's provider to be after Laravel's provider. Example:
App\Providers\RouteServiceProvider::class,
\OhMyBrew\ShopifyApp\ShopifyAppProvider::class,
When I did this my overrides didn't seem to work but when I did the reverse of what this suggested (putting ShopifyAppProvider before the RouteServiceProvider) it did work. Am I misunderstanding this or could this be a problem with the documentation?
Hello, Thank you for this app. I successfully installed in my local.
But I can't find how to display the current store logged and the products of it.
Can you provide a sample?
Thank you,
Best Regards,
Ronard
Hi !
When I tried to activate the app on my store, I got a database error saying the value for "charge_id" column on "charges" table is over range (int range is -2147483648 to 2147483648 if I remember well).
My charge_id was something like 2917400000
I fixed it by setting (manually) the column as BIGINT.
In the documentation it shows using only one billing plan. How would I handle 2 plans? A free and a paid plan.
To mimic shopify_app
, I will code in an after authenticate job feature to work similar. It will support dispatching later or immediately.
Needed:
Docs instruct you to add this line to config/app
'ShopifyApp' => \OhMyBrew\ShopifyApp\Facades\ShopifyAppFacade::class,
but you should use this line
'ShopifyApp' => \OhMyBrew\ShopifyApp\Facades\ShopifyApp::class,
because ShopifyAppFacade does not exist.
Hi, thanks so much for this awesome library.
I'm exploring in order to explore how viable it would be to add extra functionality for my Shopify projects, and excited for the possibilities this opens.
Going through the install steps, I'm stuck at the App proxy configuration.
I've wen't through the steps for creating the app proxy:
Checked that the merchant proxy settings use the same defaults, added the route to the Laravel application:
Route::get('/proxy', function () {
return response('Hello, world!')->withHeaders(['Content-Type' => 'application/liquid']);
})->middleware('auth.proxy');
But then each time I try to open the app URL in my browser like https://merchant.com/apps/product-builder
it keeps redirecting as seen on the ngrok panel:
I most be missing some crucial step here, could you help?
Thanks!
Hey, do you know when you'll have the Homestead installation guide done?
I have everything setup with ngrok but when I go to the app in Shopify the page is blocked with the error:
The webpage at [homestead .test domain] might be temporarily down or it may have moved permanently to a new web address.
Cheers
I'm going to build in the ability to charge for apps. I've done this many times, and figure its good to bake in as an (optional) thing for this package.
I plan on making it a separate middleware which anyone can attach to their routes. All settings for the billing including app name, pricing, trial period, etc, will be configurable.
Essentially the flow will be:
I'll be working on this in a new branch, with tests, and merge in once I feel its OK. Timeline for this is a bit sparse as I'm a tad busy these days so hang tight :)
Hello
I have followed all the steps, my app, is under src/ShopifyApp i have created on psr-4 the namespace like this:
"src\ShopifyApp\": "src/ShopifyApp"
however when i try to see the site im getting object not found
Also i have added this and everything is ok:
$ php artisan vendor:publish --tag=config
Copied File [\src\ShopifyApp\resources\config\shopify-app.php] To [\config\shopify-app.php]
Publishing complete.
Any ideas? im missing something? using url: http://local.shopify-app.com/authenticate, the url is on my localhost because i can see the index.html with the title.
added to My composer.json:
"psr-4": {
"App\": "app/",
"src\ShopifyApp\": "src/ShopifyApp"
}
eSDK still not disabled when setting is SHOPIFY_ESDK_ENABLED=0 in env
any idea?
Sorry if this isn't appropriate as an issue.
I have a use case where I need to use a triple store (graph database such as Blazegraph or Amazon Neptune) rather than a relational database. From what I can tell laravel-shopify relies on eloquent for storing model information.
Would it be feasible to override parts of the module that use eloquent with my own read and write methods on a graph database?
Looking at the documentation on Overriding and Extending I couldn't quite understand that in a situation where we need extra models, how can we have those be in relation with the respective store.
That is, lets say I have a model "Accessories", which can be linked to products from the current store. I'm assuming that we need to have something in that model that for each row in the database we can relate to the relevant store so that we can query all "Accessories" from that store for example.
Thank you!
I have updated the package to 2.2.0 and my webhooks stopped working, my guess is that the domain token has changed.
Am I not able to call the shop domain from my webhook job using $shopDomain and the response from shopify with $data?
Hi,
I'm trying to setup webhooks and I'm experiencing problems.
Laravel 5.5
I used your command from the wiki : php artisan shopify-app:make:webhook ProductsUpdateJob products/update
and the file ProductsUpdateJob is there in the App/Jobs folder.
Also added the webhook in the shopify-app.php as mentioned.
'webhooks' => [
[
'topic' => 'products/update',
'address' => 'https://xxxxxxx/webhook/products-update'
],
],
If I make a get request on /admin/webhooks.json, the webhook is correctly installed.
If I update a product on Shopify, nothing happens. I put a log in my ProductsUpdateJob and it never executes.
I also tried to use Insomnia to make a POST request with shopify header and everything, but I only get an error 419 Unknown status with "The page has expired due to inactivity. Please refresh and try again."
It seems like the route doesn't work because nothing seems to get executed.
I might be doing something wrong. Can you help me debug this please? Can't figure it out.
Thanks
Readme says the package is compatible with Laravel 5.5-5.6 but I tried installing on 5.6 and it failed. Says it only requires 5.5. Any plan to make it compatible with 5.6?
I have Shopify app developed in my local system (https://myapp.local). Now I want to load it in Shopify (embedded mode). But it is throwing an error 'Refused to display 'https://myapp.local/embedded/forms?hmac=xxxxxxxxxxxxxxxx&locale=en&protocol=https%3A%2F%2F&shop=myshop.myshopify.com×tamp=1529929088' in a frame because it set 'X-Frame-Options' to 'deny'.' I have set SHOPIFY_ESDK_ENABLED = 1
as well as required settings in partners.shopify also. When I have installed this package 3 months ago, it was getting loaded. But now it's not getting loaded. After debugging, I come to know that $response->headers->remove('X-Frame-Options');
of OhMyBrew\ShopifyApp\Middleware\AuthShop
should remove the header while SHOPIFY_ESDK_ENABLED is set to 1. But it's not removing. I don't know either it's a bug or something related to laravel or apache2. So can anyone look into this?
Here is my virtual host file
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster
ServerName myapp.local
ServerAlias www.myapp.local
DocumentRoot /var/www/myapp/public
<Directory /var/www/myapp/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
</IfModule>
How to post data from store's front to APP?
Hi there, is it possible to make the app not embedded in the Shopify admin? I tried disabling the Embed in Shopify admin setting but when I load the app the following occurs:
Below is the URI generated:
https://pasartap-dev.myshopify.com/admin/apps/e1ef58708fea1eee57e4b47ba6635a05/?hmac=b79e691545e56d13d4273f50f4a20cee2bb8ff414314fae465292a95d0058fc1&shop=pasartap-dev.myshopify.com×tamp=1520584470
Appreciate any help, thanks.
Razaly
Shopify recently added information about additional webhooks that are going to be required by all apps: https://help.shopify.com/api/guides/gdpr-resources
They are shop/redact
& customers/redact
and the urls for them will be set in the app info panel.
Should we include sensible defaults for these in the package?
Are there any plans to make the OAuth system in this package also work with the Laravel Socialite? I can give it a try and send a PR if it's wanted
Hello, I Have Installed The App And Now Want To Add Few Products From App API.
I Am unable TO Find POST Method How Exactly It Will Be Done Both POST And Get Please Add At least 1 Example of Both.
Thanks
Hi,
What would be the best way to update the package using composer when you make a new release?
I have "ohmybrew/laravel-shopify": "^2.0"
in my composer.json, but when I run composer update ohmybrew/laravel-shopify
, nothing happens.
Also, will this update your ohmybrew/basic-shopify-api
package at the same time?
Thanks
Sorry for all the questions.
I'm still a bit puzzled with the site communication with the app via proxy.
I have the app proxy setup as follows:
When i visit the store URL that is linked to this proxy, I see the activity showing up in the ngrok log, however it seems to return an HTML with a redirect in it:
On the frontend the network activity shows the following:
Any idea what would cause this?
Thanks so much for any help you may provide.
Hi @ohmybrew or any who know this can advise me on how to add your javascript to a store?
Thank you.
Can anyone please help me to find a solution for this?
Why this is happening? I am getting a lot of emails like this.
Your webhook for orders/cancelled at //url is failing to return a successful response. This webhook has been attempted 2 times. If your webhook continues to fail, it will be removed and your application will not receive any more notifications. | Your webhook for orders/cancelled at //url is failing to return a successful response. | This webhook has been attempted 2 times. If your webhook continues to fail, it will be removed and your application will not receive any more notifications. |
---|---|---|
Your webhook for orders/cancelled at //url cancelled is failing to return a successful response. | ||
This webhook has been attempted 2 times. If your webhook continues to fail, it will be removed and your application will not receive any more notifications. |
I tried to post form data from shopify to my laravel app using jquery ajax. but it is showing 419 status.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.