composer require shopgate/webcheckout-magento2
bin/magento module:enable Shopgate_WebCheckout
bib/magento setup:upgradeWe suggest updating the Services > Mage Web API > JWT Auth > Customer JWT Expires in to a longer timeframe,
otherwise the customer will be logged out every 60 minutes by default. This is not very user friendly.
Anonymous & Customer
###
GET http://localhost/rest/default/V1/sgwebcheckout/products?ids[]=44&ids[]=2034&ids[]=2040Result:
{
"products": [
{
"sku": "24-WG02",
"id": "44"
},
{
"parent_sku": "WSH12",
"sku": "WSH12-31-Green",
"id": "2034"
},
{
"sku": "WSH12",
"id": "2040"
}
]
}Anonymous & Customer
###
GET http://localhost/rest/default/V1/sgwebcheckout/productsBySku?skus[]=24-WG02&skus[]=MS-Champ-M&skus[]=MS-ChampResult:
{
"products": [
{
"sku": "24-WG02",
"id": "44"
},
{
"parent_sku": "WSH12",
"sku": "WSH12-31-Green",
"id": "2034"
},
{
"sku": "WSH12",
"id": "2040"
}
]
}Customer
###
POST http://localhost/rest/default/V1/sgwebcheckout/me/tokenGuest user (with cart)
###
POST http://localhost/rest/default/V1/sgwebcheckout/:cartId/tokenResult
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiration": 1722194685
}Anonymous user (guest without cart)
###
POST http://localhost/rest/default/V1/sgwebcheckout/anonymous/tokenResult
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiration": 1722194685
}Note that you will need to enable the logging in the Shopgate > WebCheckout configuration for it to stop throwing 500 errors.
Admin
###
GET http://localhost/rest/default/V1/sgwebcheckout/log?page=1&lines=20Result:
{
"log": [
"[2024-07-28T19:08:21.400242+00:00] shopgate_webc.ERROR: Could not find products by IDs: 99999 [] []\n",
""
]
}Admin User / Integration
###
GET http://localhost/rest/default/V1/sgwebcheckout/orders?searchCriteria[currentPage]=1&searchCriteria[pageSize]=10&searchCriteria[filter_groups][0][filters][0][field]=increment_id&searchCriteria[filter_groups][0][filters][0][value]=000000051&searchCriteria[filter_groups][0][filters][0][condition_type]=eqResult:
{
"items": [
{
"entity_id": 51,
"increment_id": "000000051",
"items": [
{
}
]
}
],
"search_criteria": {
"filter_groups": [
{
"filters": [
{
"field": "increment_id",
"value": "000000051",
"condition_type": "eq"
}
]
}
],
"page_size": 10,
"current_page": 1
},
"total_count": 1
}When working with the frontend and trying to mimic the inApp, just append ?sgWebView=1 and load the page. This will
allow you to work with CSS and see our JavaScript logic as if you loaded the page as inApp browser. Clear the cookie
by setting ?sgWebView=0.
Our logic, (at the time of writing only sgwebcheckout/account/login controller) has logging for easier debugging,
however, you will need to enable it in the Admin > Config > Shopgate WebCheckout area or with command line:
bin/magento config:set shopgate_webcheckout/development/enable_logging 1
bin/magento cache:clearAfterward, you can see the log in the var/log/shopgate/webcheckout_debug.log directory or use our API to query the
logs. See postman for an example of how to use it.
Token has an invalid structure.- this error can occur if there is a 302 redirect happening. Let's say you have a website test.com, but yourdefaultstoreCode references test.com/en, callingtest.com/sgwebcheckout/login?token=...will trigger a 302 redirect totest.com/en/sgwebcheckout/loginwithout forwarding the token or any other parameter. Token will be empty & you get this error message. Fix - make sure to usetest.com/enas your domain.The current user cannot perform operations on cart \"{MASKED_ID}\"- this is an error that can happen if you are trying to addProducts to cart as guest, but a customer session cookie is set, it is calledPHPSESSID. Fix - make sure the Cookie is not set before making API/GraphQL calls.