Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
eeacfc6
added additional endpoints
Sep 7, 2019
882a18a
Delete .DS_Store
Sep 7, 2019
718ed55
Delete .DS_Store
Sep 7, 2019
4a48a40
added checkout endpoints
Sep 7, 2019
0db069b
added checkout endpoints
Sep 7, 2019
c180ae1
Merge branch 'master' of https://github.com/TuunStudio/php-shopify
Sep 7, 2019
da95575
added sales channel sdk endpoints
Sep 7, 2019
184894e
Delete .DS_Store
Sep 7, 2019
4a9ca6f
Delete .DS_Store
Sep 7, 2019
f470422
added sales channel sdk endpoints
Sep 7, 2019
6aeee19
Merge branch 'master' of https://github.com/TuunStudio/php-shopify
Sep 7, 2019
9b361f6
removed customer order
Sep 7, 2019
8560d2d
added support for cursor based pagination
Dec 21, 2019
91c0ad5
added additional endpoints
Sep 7, 2019
1417d23
Delete .DS_Store
Sep 7, 2019
79c1366
Delete .DS_Store
Sep 7, 2019
2d424c5
added checkout endpoints
Sep 7, 2019
928df36
added checkout endpoints
Sep 7, 2019
e577d9a
added sales channel sdk endpoints
Sep 7, 2019
d23e51b
Delete .DS_Store
Sep 7, 2019
da78ce9
Delete .DS_Store
Sep 7, 2019
65f27b8
added sales channel sdk endpoints
Sep 7, 2019
d332736
removed customer order
Sep 7, 2019
c5bfe0e
added support for cursor based pagination
Dec 21, 2019
4e13a2a
fixed get access token request
Jan 27, 2020
56925b0
Merge branch 'master' of ssh://github.com/TuunStudio/php-shopify
Jan 27, 2020
dd3b467
merge with upstream
Apr 15, 2020
8d3f529
Merge branch 'master' of https://github.com/TuunStudio/php-shopify
Apr 15, 2020
304761d
fixed conflicts
Apr 15, 2020
ddf9bce
fixed shopify resource
Apr 15, 2020
01ddc1b
added json_decode
Apr 15, 2020
5bdf347
paging
Apr 15, 2020
c512120
remove extra Parentheses
saifulapm Apr 16, 2020
e71baca
fixed auth helper
Apr 21, 2020
eebe407
updated to current version
Apr 23, 2020
bac953f
Merge pull request #154 from saifulapm/patch-1
tareqtms Apr 25, 2020
6eaa205
price rule endpoint supports count
n3o77 May 5, 2020
37ff9aa
Merge pull request #158 from n3o77/master
tareqtms May 5, 2020
989d7b3
Update ShopifySDK.php
victorlap May 14, 2020
d66b266
Merge pull request #159 from victorlap/patch-1
tareqtms May 15, 2020
270b7dd
added ShopifyPayment Dispute resource
vkislichenko Jun 1, 2020
a233b8d
Merge pull request #162 from vkislichenko/feature/payments-disputes
tareqtms Jun 2, 2020
d4c9467
Add Shopify API headers as a config to the SDK
wissem Jun 17, 2020
764fa9d
added discount code location
Jul 3, 2020
e49925f
added discount code location
Jul 3, 2020
dfeee2b
Initial Commit
MCriggerXroadz Jul 14, 2020
6c464e3
Update ShopifyPayment.php
MCriggerXroadz Jul 17, 2020
6a114af
Author and Links
MCriggerXroadz Jul 17, 2020
279d521
Update Customer.php
Erdou Aug 23, 2020
d0e7fe7
Created function to generate account_activation_link
saumil122 Aug 24, 2020
da9cc98
Fix bug introduced by #143 by lowercasing key in getHeader
andyexeter Oct 12, 2020
f6fb339
Use Retry-After header as value to sleep for before retrying request
andyexeter Oct 12, 2020
32e6782
added application credit endpoint
Oct 14, 2020
473a3fc
Support DiscountCode batch Action
n3o77 Oct 25, 2020
478382a
Fix Issue No. 189
ratzkeeper Nov 17, 2020
9f47fb1
calculate() takes an optional array as a parameter.
Nov 19, 2020
75c0f4f
Merge pull request #191 from TonyDeStefano/patch-1
tareqtms Dec 5, 2020
da955a9
Merge branch 'master' into fix-issue-number-189
tareqtms Dec 5, 2020
b1b162b
Merge pull request #190 from howard-mintus/fix-issue-number-189
tareqtms Dec 5, 2020
979965a
Merge pull request #165 from wissem/shopify-api-features-header
tareqtms Dec 5, 2020
71f49b3
Merge pull request #171 from MCriggerXroadz/dev-shopifypayments
tareqtms Dec 5, 2020
d83f6d7
Merge pull request #176 from Erdou/patch-1
tareqtms Dec 5, 2020
24ff4e4
Merge branch 'master' into master
tareqtms Dec 5, 2020
1c554af
Merge pull request #178 from saumil122/master
tareqtms Dec 5, 2020
cdcb8dc
Merge pull request #184 from andyexeter/dynamic-retry-after
tareqtms Dec 5, 2020
d06cb86
Merge pull request #183 from andyexeter/fix-143
tareqtms Dec 5, 2020
79df85f
Merge pull request #188 from n3o77/master
tareqtms Dec 5, 2020
b182f7a
Resolves #198, Missing TenderTransaction endpoint
lhilton Dec 17, 2020
1d1c3e8
Merge pull request #199 from ComplYantCo/master
tareqtms Dec 17, 2020
a421436
Added the Cart Resource
whobutsb Jan 19, 2021
b81b405
Update Default API Version
tareqtms Mar 21, 2021
05eb123
Update CountryTest.php
tareqtms Mar 21, 2021
90c329d
Throw an exception if the request failed (bad auth code, invalid shop)
liamjcooper Apr 14, 2021
c70bd52
Slight change in vocabulary
liamjcooper Apr 14, 2021
fe7e971
Follow string quote convention
liamjcooper Apr 14, 2021
c2e1441
Return location header as array if response is 303
liamjcooper Apr 20, 2021
6ecbaf9
updated generate url to support numeric indexed arrays
May 5, 2021
96cfdc3
Remove query params from current url
waleev May 13, 2021
ccbe6e7
Adding Fulfillment Order
marxolly May 21, 2021
27ccacf
Merge pull request #204 from whobutsb/master
tareqtms Jun 15, 2021
b7dc4b7
Merge pull request #219 from liamjcooper/fix/access-token-exception
tareqtms Jun 15, 2021
0d86fc5
Merge pull request #221 from liamjcooper/fix/discount-lookup
tareqtms Jun 15, 2021
cdcd5c4
Merge pull request #227 from waleev/patch-1
tareqtms Jun 15, 2021
6c80502
Merge pull request #228 from marxolly/add-get-fulfillment-orders
tareqtms Jun 15, 2021
19693b0
Add additional curl configuration
npabisz Aug 27, 2021
00b6142
Merge pull request #238 from Yorkii/feature/curl-config
tareqtms Sep 13, 2021
9ae8623
Merge pull request #1 from phpclassic/master
fabio-sassi-spotview Sep 14, 2021
74ec175
add retry request callback
fabio-sassi-spotview Sep 14, 2021
ae81bdf
FulfillmentOrder hold and relase_hold methods
npabisz Oct 12, 2021
0f42110
feat: AccessScope resource
seka19 Oct 17, 2021
921d83d
added http code to shopify resource
Nov 1, 2021
4ef5170
Merge pull request #246 from automit2021/access-scope-resource
tareqtms Dec 18, 2021
1729aa0
Merge pull request #245 from Yorkii/feature/fulfillment-order
tareqtms Dec 18, 2021
32ec82a
[Fixes #251] Update Default API Version to 2021-10
tareqtms Dec 18, 2021
7233f96
$config updated(added AccessToken for running graphql test)
anikghosh256 Dec 21, 2021
65f64f1
test case added for GraphQL Query
anikghosh256 Dec 21, 2021
fa79086
config array updated - for private api
anikghosh256 Jan 3, 2022
a6b22e4
Merge pull request #254 from anikghosh256/master
tareqtms Feb 23, 2022
3609f49
Merge pull request #240 from fabio-sassi-spotview/fault_tollerant_req
tareqtms Feb 23, 2022
034a88d
Update README.md
tareqtms Feb 23, 2022
59e6f8c
Update API Version
tareqtms Feb 23, 2022
75cdc9c
Migrating from value_type to type
anikghosh256 Feb 23, 2022
6f56675
Merge pull request #255 from anikghosh256/master
tareqtms Jul 14, 2022
5bc3d3a
Update API Version
tareqtms Jul 14, 2022
5e63d97
Add Metafield property and method to docblock
ricog Jul 18, 2022
2f1595a
Merge pull request #259 from ricog/patch-1
tareqtms Jul 19, 2022
9c5a528
Rollback API Version (Breaking changes)
tareqtms Sep 29, 2022
81e6cc8
Update API Version to 2022-07
tareqtms Sep 29, 2022
3b6b023
Custom API Version in $config
tareqtms Sep 29, 2022
1816de4
Metafield as a child resource of Collection & DraftOrder
Oct 3, 2022
f931765
Merge pull request #267 from nVuln/master
tareqtms Oct 3, 2022
8b2c2a0
added fulfillment update_tracking action
Oct 6, 2022
4d49e3b
make fulfillment api as parent resource
Oct 6, 2022
f2e1428
Merge pull request #269 from nVuln/fulfillment-api
tareqtms Oct 9, 2022
44dadde
#266 - PHP Deprecated: explode(): Passing null to parameter #2 ($stri…
itsrexb Oct 21, 2022
b815f08
Merge pull request #273 from itsrexb/master
tareqtms Oct 24, 2022
aa35f44
add support for Order()->FulfillmentOrder and FulfillmentRequests
jeroendelau Nov 17, 2022
30bb0f9
combined resources from upstream, and removed url option from post re…
Dec 7, 2022
34066f6
fixed response array issues
Dec 7, 2022
98b357d
added httpcode to resource
Dec 8, 2022
958c35c
Removed the CurlCallback feature from the the API Deprecations Query
whobutsb Dec 13, 2022
676aaaf
Added API Deprecations documentation to README
whobutsb Dec 13, 2022
38b31fc
Merge pull request #282 from whobutsb/feature/api-deprecations-query
tareqtms Dec 14, 2022
b2c298d
add Fulfillment as child resource of FulfillmentOrder
jeroendelau Jan 11, 2023
69b3057
updated README.md
jeroendelau Jan 11, 2023
d5759b3
Merge pull request #278 from jeroendelau/master
tareqtms Feb 13, 2023
6df9453
Update Default API Version Number
tareqtms Feb 13, 2023
1d05bc9
Update README.md
tareqtms Feb 13, 2023
f266b2e
Added gift card adjustment functionality
justin-gist-apps Feb 28, 2023
7d8f464
Add total time spent in sleep during multiple requests
Mar 15, 2023
99a0b13
Merge pull request #1 from RobertoRomolini/feature/add-total-retry-sl…
RobertoRomolini Mar 16, 2023
b25533d
Add support the AssignedFulfillmentOrder resource
Spotnyk May 29, 2023
d8b2c2b
Fix: Typo in readme
Spotnyk May 29, 2023
9e885b7
Merge pull request #295 from Spotnyk/master
tareqtms May 29, 2023
eb26e68
Merge pull request #292 from RobertoRomolini/master
tareqtms May 29, 2023
b33ceb1
Add "FulfillmentOrder" and alfabetize properties
victorlap Jun 1, 2023
a9c22b1
added last httpCode
tuun Jun 8, 2023
e12905e
Added the Gift Card Adjustment Resource
whobutsb Jun 27, 2023
7a52f6a
Update README.md
whobutsb Jun 27, 2023
589ebb8
added usage to the GiftCardAdjustment class
whobutsb Jun 27, 2023
c0103f9
Merge pull request #299 from whobutsb/feature/giftcard-adjustments
tareqtms Jun 28, 2023
ac59e48
Update API Version Number
tareqtms Jun 28, 2023
75e8bd2
Added the Metafield to the Location Resource
whobutsb Aug 30, 2023
13dfcb4
Updated the readme
whobutsb Aug 31, 2023
b9a35f8
rename in comments
whobutsb Sep 12, 2023
809aed5
Merge pull request #305 from whobutsb/feature/add-location-metafields
tareqtms Sep 15, 2023
c2f3447
Merge pull request #297 from victorlap/update-php-docs-with-fulfillme…
tareqtms Sep 16, 2023
284d7c8
Update Shopify API Version
tareqtms Sep 16, 2023
82c0406
feat: add getEmbeddedAppUrl method
anikghosh256 Sep 25, 2023
6259d8b
Merge pull request #307 from anikghosh256/master
tareqtms Sep 25, 2023
2d4f380
fixed http code
tuun Dec 8, 2023
bf36ab2
fixed content type header
tuun Dec 8, 2023
010a085
Update Default Api Version
tareqtms Jul 2, 2024
628b137
Update Api Version Number
tareqtms Oct 19, 2024
0b858ac
API Version Update 2025-01
tareqtms Feb 11, 2025
ffce666
Merge pull request #341 from phpclassic/tareqtms-patch-1
tareqtms Feb 11, 2025
0a2e1a8
Content type application/graphql is deprecated
tareqtms Feb 12, 2025
2989d36
Merge pull request #342 from phpclassic/tareqtms-patch-2
tareqtms Feb 12, 2025
49deba8
fix: 400 bad request api issue with graphql when variables are not pa…
svishalgarg Feb 18, 2025
0f08bf8
Merge pull request #343 from svishalgarg/master
tareqtms Feb 18, 2025
c6eb4e2
Content-Length Header
tareqtms Jul 19, 2025
e18f92e
Merge pull request #349 from phpclassic/Content-Length-header
tareqtms Jul 20, 2025
50ce343
updated branch
tuun Sep 24, 2025
6152fce
updated master branch with upstream
tuun Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendor
/nbproject/private/
.idea/
.idea/
.DS_Store
80 changes: 74 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,26 @@ composer require phpclassic/php-shopify
PHPShopify uses curl extension for handling http calls. So you need to have the curl extension installed and enabled with PHP.
>However if you prefer to use any other available package library for handling HTTP calls, you can easily do so by modifying 1 line in each of the `get()`, `post()`, `put()`, `delete()` methods in `PHPShopify\HttpRequestJson` class.

You can pass additional curl configuration to `ShopifySDK`
```php
$config = array(
'ShopUrl' => 'yourshop.myshopify.com',
'ApiKey' => '***YOUR-PRIVATE-API-KEY***',
'Password' => '***YOUR-PRIVATE-API-PASSWORD***',
'Curl' => array(
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true
)
);

PHPShopify\ShopifySDK::config($config);
```
## Usage

You can use PHPShopify in a pretty simple object oriented way.

#### Configure ShopifySDK
If you are using your own private API, provide the ApiKey and Password.
If you are using your own private API (except GraphQL), provide the ApiKey and Password.

```php
$config = array(
Expand All @@ -31,14 +45,26 @@ $config = array(
PHPShopify\ShopifySDK::config($config);
```

For Third party apps, use the permanent access token.
For Third party apps, use the permanent access token.
> For GraphQL, AccessToken is required. If you are using private API for GraphQL, use your password as AccessToken here.

```php
$config = array(
'ShopUrl' => 'yourshop.myshopify.com',
'AccessToken' => '***ACCESS-TOKEN-FOR-THIRD-PARTY-APP***',
);

PHPShopify\ShopifySDK::config($config);
```
You can use specific Shopify API Version by adding in the config array

```php
$config = array(
'ShopUrl' => 'yourshop.myshopify.com',
'AccessToken' => '***ACCESS-TOKEN-FOR-THIRD-PARTY-APP***',
'ApiVersion' => '2022-07',
);

PHPShopify\ShopifySDK::config($config);
```
##### How to get the permanent access token for a shop?
Expand Down Expand Up @@ -171,7 +197,7 @@ $shopify->Order($orderID)->put($updateInfo);
```php
$webHookID = 453487303;

$shopify->Webhook($webHookID)->delete());
$shopify->Webhook($webHookID)->delete();
```


Expand Down Expand Up @@ -295,14 +321,17 @@ Some resources are available directly, some resources are only available through
> Use the resources only by listed resource map. Trying to get a resource directly which is only available through parent resource may end up with errors.

- [AbandonedCheckout](https://help.shopify.com/api/reference/abandoned_checkouts)
- [ApiDeprecations](https://shopify.dev/api/admin-rest/2022-04/resources/deprecated-api-calls#get-deprecated-api-calls)
- [ApplicationCharge](https://help.shopify.com/api/reference/applicationcharge)
- [AssignedFulfillmentOrder](https://shopify.dev/docs/api/admin-rest/2023-04/resources/assignedfulfillmentorder)
- [Blog](https://help.shopify.com/api/reference/blog/)
- Blog -> [Article](https://help.shopify.com/api/reference/article/)
- Blog -> Article -> [Event](https://help.shopify.com/api/reference/event/)
- Blog -> Article -> [Metafield](https://help.shopify.com/api/reference/metafield)
- Blog -> [Event](https://help.shopify.com/api/reference/event/)
- Blog -> [Metafield](https://help.shopify.com/api/reference/metafield)
- [CarrierService](https://help.shopify.com/api/reference/carrierservice/)
- [CarrierService](https://help.shopify.com/api/reference/carrierservice/)-
- [Cart](https://shopify.dev/docs/themes/ajax-api/reference/cart) (read only)
- [Collect](https://help.shopify.com/api/reference/collect/)
- [Comment](https://help.shopify.com/api/reference/comment/)
- Comment -> [Event](https://help.shopify.com/api/reference/event/)
Expand All @@ -323,16 +352,21 @@ Some resources are available directly, some resources are only available through
- [DiscountCode](https://help.shopify.com/en/api/reference/discounts/discountcode)
- [Event](https://help.shopify.com/api/reference/event/)
- [FulfillmentService](https://help.shopify.com/api/reference/fulfillmentservice)
- [Fulfillment](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillment)
- [FulfillmentOrder](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentorder)
- FulfillmentOrder -> [FulfillmentRequest](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentrequest)
- FulfillmentOrder -> [Fulfillment](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillment)
- [GiftCard](https://help.shopify.com/api/reference/gift_card) _(Shopify Plus Only)_
- GiftCard -> [Adjustment](https://shopify.dev/docs/api/admin-rest/2023-01/resources/gift-card-adjustment) _(Shopify Plus Only)_
- [InventoryItem](https://help.shopify.com/api/reference/inventoryitem)
- [InventoryLevel](https://help.shopify.com/api/reference/inventorylevel)
- [Location](https://help.shopify.com/api/reference/location/) _(read only)_
- Location -> [InventoryLevel](https://help.shopify.com/api/reference/inventorylevel)
- Location -> [Metafield](https://help.shopify.com/api/reference/metafield)
- [Metafield](https://help.shopify.com/api/reference/metafield)
- [Multipass](https://help.shopify.com/api/reference/multipass) _(Shopify Plus Only, API not available yet)_
- [Order](https://help.shopify.com/api/reference/order)
- Order -> [Fulfillment](https://help.shopify.com/api/reference/fulfillment)
- Order -> Fulfillment -> [Event](https://help.shopify.com/api/reference/fulfillmentevent)
- Order -> [FulfillmentOrder](https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentorder)
- Order -> [Risk](https://help.shopify.com/api/reference/order_risks)
- Order -> [Refund](https://help.shopify.com/api/reference/refund)
- Order -> [Transaction](https://help.shopify.com/api/reference/transaction)
Expand All @@ -359,6 +393,8 @@ Some resources are available directly, some resources are only available through
- [Shop](https://help.shopify.com/api/reference/shop) _(read only)_
- [SmartCollection](https://help.shopify.com/api/reference/smartcollection)
- SmartCollection -> [Event](https://help.shopify.com/api/reference/event/)
- [ShopifyPayment](https://shopify.dev/docs/admin-api/rest/reference/shopify_payments/)
- ShopifyPayment -> [Dispute](https://shopify.dev/docs/admin-api/rest/reference/shopify_payments/dispute/) _(read only)_
- [Theme](https://help.shopify.com/api/reference/theme)
- Theme -> [Asset](https://help.shopify.com/api/reference/asset/)
- [User](https://help.shopify.com/api/reference/user) _(read only, Shopify Plus Only)_
Expand Down Expand Up @@ -482,6 +518,38 @@ The custom methods are specific to some resources which may not be available for
- User ->
- [current()](https://help.shopify.com/api/reference/user#current)
Get the current logged-in user

### FulfillmentRequest Resource - including actions
- Mapped FulfillmentOrder->FulfillmentRequest
- Mapped Order(id)->FulfillmentOrder

```php
// Requesting the FulfilmentOrder for a given order
$fo = $client->Order("1234567890")->FulfillmentOrder()->get();

// Requesting assigned fulfillment orders (with status fulfillment_requested)
$shopify->AssignedFulfillmentOrder()->get(["assignment_status" => "fulfillment_requested"]);

// Creating a FulfilmentRequest
// Follow instructions to get partial fulfilments
$fr = $client->FulfillmentOrder('0987654321')->FulfillmentRequest->post([]);

// Accepting \ Rejecting a FulfilmentRequest
$fr = $client->FulfillmentOrder('0987654321')->FulfillmentRequest->accept();
$fr = $client->FulfillmentOrder('0987654321')->FulfillmentRequest->reject();

// Communicating fulfillment
$client->Fulfillment->post($body)
```

### Shopify API features headers
To send `X-Shopify-Api-Features` headers while using the SDK, you can use the following:

```
$config['ShopifyApiFeatures'] = ['include-presentment-prices'];
$shopify = new PHPShopify\ShopifySDK($config);
```


## Reference
- [Shopify API Reference](https://help.shopify.com/api/reference/)
Expand Down
36 changes: 36 additions & 0 deletions lib/AccessScope.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace PHPShopify;

/**
* Class AccessScope
* @package PHPShopify
* @author Alexey Sinkevich
*/
class AccessScope extends ShopifyResource
{
/**
* @inheritDoc
*/
protected $resourceKey = 'access_scope';

/**
* @inheritDoc
*/
public $countEnabled = true;

/**
* @inheritDoc
*/
public $readOnly = true;

/**
* @param array $urlParams
* @param null $customAction
* @return string
*/
public function generateUrl($urlParams = array(), $customAction = null)
{
return ShopifySDK::$config['AdminUrl'] . 'oauth/' . $this->getResourcePath() . '.json';
}
}
39 changes: 39 additions & 0 deletions lib/ApiDeprecations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* Created by PhpStorm.
* @author Tareq Mahmood <tareqtms@yahoo.com>
* @author Steve Barbera <whobutsb@gmail.com>
* Created at 8/18/16 3:39 PM UTC+06:00
*
* @see https://shopify.dev/api/admin-rest/2022-04/resources/deprecated-api-calls#get-deprecated-api-calls Shopify API Reference for API Deprecations
*/

namespace PHPShopify;


class ApiDeprecations extends ShopifyResource
{
/**
* @inheritDoc
*/
protected $resourceKey = 'deprecated_api_calls';

/**
* @inheritDoc
*/
public $readOnly = true;

/**
* @inheritDoc
*/
public $countEnabled = false;

/**
* @inheritDoc
*/
public function pluralizeKey()
{
//Only api deprecations, so no pluralize
return 'deprecated_api_calls';
}
}
26 changes: 26 additions & 0 deletions lib/ApplicationCredit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Created by PhpStorm.
* @author Tareq Mahmood <tareqtms@yahoo.com>
* Created at 8/18/16 9:50 AM UTC+06:00
*
* @see https://help.shopify.com/api/reference/applicationcharge Shopify API Reference for ApplicationCharge
*/

namespace PHPShopify;


class ApplicationCredit extends ShopifyResource
{
/**
* @inheritDoc
*/
protected $resourceKey = 'application_credit';

/**
* @inheritDoc
*/
public $countEnabled = false;


}
16 changes: 16 additions & 0 deletions lib/AssignedFulfillmentOrder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
*
* @see https://shopify.dev/docs/api/admin-rest/2023-04/resources/assignedfulfillmentorder Shopify API Reference for Assigned Fulfillment Order
*/

namespace PHPShopify;


class AssignedFulfillmentOrder extends ShopifyResource
{
/**
* @inheritDoc
*/
protected $resourceKey = 'assigned_fulfillment_order';
}
9 changes: 8 additions & 1 deletion lib/AuthHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ public static function getCurrentUrl()
$protocol = 'http';
}

return "$protocol://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url = $protocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$url = false !== ($qsPos = strpos($url, '?')) ? substr($url, 0, $qsPos) : $url; // remove query params

return $url;
}

/**
Expand Down Expand Up @@ -170,6 +173,10 @@ public static function getAccessToken()

$response = HttpRequestJson::post($config['AdminUrl'] . 'oauth/access_token', $data);

if (CurlRequest::$lastHttpCode >= 400) {
throw new SdkException("The shop is invalid or the authorization code has already been used.");
}

return isset($response['access_token']) ? $response['access_token'] : null;
} else {
throw new SdkException("This request is not initiated from a valid shopify shop!");
Expand Down
51 changes: 51 additions & 0 deletions lib/Balance.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
* Created by PhpStorm.
* @author Robert Jacobson <rjacobson@thexroadz.com>
* @author Matthew Crigger <mcrigger@thexroadz.com>
*
* @see https://help.shopify.com/en/api/reference/shopify_payments/balance Shopify API Reference for Shopify Payment Balance
*/

namespace PHPShopify;

/**
* --------------------------------------------------------------------------
* ShopifyPayment -> Child Resources
* --------------------------------------------------------------------------
*
*
*/
class Balance extends ShopifyResource
{
/**
* @inheritDoc
*/
protected $resourceKey = 'balance';

/**
* Get the pluralized version of the resource key
*
* Normally its the same as $resourceKey appended with 's', when it's different, the specific resource class will override this function
*
* @return string
*/
protected function pluralizeKey()
{
return $this->resourceKey;
}

/**
* If the resource is read only. (No POST / PUT / DELETE actions)
*
* @var boolean
*/
public $readOnly = true;

/**
* @inheritDoc
*/
protected $childResource = array(
'Transactions'
);
}
33 changes: 33 additions & 0 deletions lib/Batch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* @see https://help.shopify.com/api/reference/discounts/discountcode Shopify API Reference for PriceRule
*/

namespace PHPShopify;


/**
* --------------------------------------------------------------------------
* DiscountCode -> Batch action
* --------------------------------------------------------------------------
*
*/

class Batch extends ShopifyResource
{
/**
* @inheritDoc
*/
protected $resourceKey = 'batch';

protected function getResourcePath()
{
return $this->resourceKey;
}

protected function wrapData($dataArray, $dataKey = null)
{
return ['discount_codes' => $dataArray];
}

}
Loading