Getting started
Welcome to the Love2shop API Sandbox! You’re almost ready to start trying out our API functions, but there’s a couple of things you need to do to complete your set-up, which should only take a few minutes.
First of all, the Love2shop API Sandbox is NOT the live API site. The sandbox is where you can try things out, see how it all works and there’s no risk - if something goes wrong or doesn’t work as you hope don’t worry, you’ve can’t break anything important.
Once you’ve tried out the sandbox and you understand how our API integrates and works, you can request your live Client ID & secret – but before we explain that…
Setting up your Love2shop API Sandbox
The Love2shop API Sandbox has been built in an independent, enclosed domain – so you can try it out with no risk. You’ll be able to create functionality featuring the Love2shop partner brands you want and explore white-label integrations.
When you’re ready to access the Sandbox, you’ll need to use the below details, which can be found on your welcome email.
Client ID
Subscription Key
Secret
When calling any of our APIs, your request will need to contain an Ocp-Apim-Subscription-Key header. We’ll contact you to let you know your unique subscription key value to use. This value will be different between sandbox and production.
Requesting a token
For most APIs, you’ll also need to set an Authorization header with a value in the format: Bearer token_vaule. Use the OAuth2 API to get the token value to use in place of token_value. Again, we’ll contact you to let you know your unique ClientId and ClientSecret and this will be different between sandbox and production.
Example:
curl --location --request POST 'https://api.sandbox.love2shoptest.services/l2s/oauth2/v1/token' \
--header 'Ocp-Apim-Subscription-Key: your_subscription_key' \
--header 'Content-Type: application/json' \
--data-raw '{
"ClientId": "your_client_id",
"ClientSecret": "your_client_secret"
}
The bearer token is returned in the ‘access_token’ JSON property of the response and is valid for one hour from request.
Further information on the bearer token can be found HERE
You do need to be aware though, your profile and anything you do in the Love2shop API Sandbox cannot be transferred over to the live API domain.
Technical information/guidance
Physical Order
curl --location --request POST 'https://api.sandbox.love2shoptest.services/l2s/orders/v1/physical' \
--header 'Content-Type: application/json' \
--header 'Ocp-Apim-Subscription-Key: 7e0c5de5804a4481ba3fa7b73ffab17e' \
--header 'Authorization: Bearer eyJ...' \
--data-raw '{
"Account": {
"AccountId": "20000641"
},
"Order": {
"Reference": "O-123456"
},
"OrderLine": {
"ProductCode": "5203",
"Price": 1000
},
"Delivery": {
"Title": "Mrs",
"FirstName": "Successful",
"LastName": "Order",
"AddressLine1": "123 Test Street",
"TownCity": "Faketon",
"County": "Fakeshire",
"Country": "United Kingdom",
"PostCode": "WA129WA"
},
"DeliveryNotification": {
"Email": "successful.order@parktest.co.uk",
"Mobile": "07784539740"
}
}'
Further information can be found HERE
Errors and actions (Physical Order)
Digital Order
Further information can be found HERE
To place a digital order, send a HTTP request to <<digital order endpoint>>.
The following headers must be included:
Content-Type: application/json
Ocp-Apim-Subscription-Key: <<Ocp-Apim-Subscription-Key>>
Authorization: Bearer: <<bearer token>>
The body of the request should be JSON and be of the format:
{
"Account": {
"AccountId": "20000641"
},
"Order": {
"Reference": "O-123457",
"Source": "website",
"SourceName": "eCommerce"
},
"OrderLine": {
"ProductCode": "5315",
"Price": 1000
}
}
Errors and actions (Digital Order)
Ready to go live?
Once you’ve finished exploring the possibilities in the sandbox you’ll want to bring Love2shop integration to your real-world systems – that’s where the fun starts.
When you are ready contact your account manager will provide you with a link to the live environment and your credentials. This will be the same process as with the sandbox and will require a client ID, subscription key & secret and off you go.
We recommend you register for Live using a generic email, e.g. Support@CompanyName.co.uk.
Don’t worry though, our team are on-hand to support you if needed. You can also request tech team support if you need it via APITeam@Love2shop.co.uk who will respond during office hours.
That’s it, you’re ready to create orders and launch your integrated Love2shop API. Pass on the love through rewards and incentives people can spend with hundreds of top brands online and in-store.