Shopify in Dot Net
Shopify in Dot Net
ShopifySharp should work out of the box with your private Shopify application, all
you need to do is replace the shopAccessToken with your private app's password when
initializing a ShopifyService:
ShopifySharp will call the given URL and check for an X-ShopId header in the
response. That header is present on all Shopify shops and it's existence signals
that the URL is indeed a Shopify URL.
Note, however, that this feature is undocumented by Shopify and may break at any
time. Use at your own discretion. In addition, it's possible for a malicious site
to fake the X-ShopId header which would make this method return true.
//An array of the Shopify access scopes your application needs to run.
var scopes = new List<AuthorizationScope>()
{
AuthorizationScope.ReadCustomers,
AuthorizationScope.WriteCustomers
};
The access token you receive after authorizing should be stored in your database.
You'll need it to access the shop's resources (e.g. orders, customers,
fulfillments, etc.)
//The querystring will have several parameters you need for authorization.
string code = Request.QueryString["code"];
string myShopifyUrl = Request.QueryString["shop"];