Photo Prints APIWildhacks

Program Highlights

- Print photos to any of the 8,200+ Walgreens locations

- Join our family 175+ integrated applications

- Earn a revenue share of up to 20% on each order

- Tons of products, by default Standard and Square prints


There are two steps, 1) Upload Files, and 2) Open Checkout.

1) Upload Files:

IMPORTANT:Go Directly to Step 2 if your image files are already on your public server

Get the Storage Server Credentials:

POST https://services-qa.walgreens.com/api/util/mweb5url

HEADER:
"Content-Type: application/json"
BODY:
{
	"serviceType":"wagS3",
	"apiKey":"GzoSZccevkX9VAjUkEwmvAy4PGcFXBhq",
	"affId":"wildhacks",
	"act":"genCredV2",
	"view":"genCredV2JSON", 
	"devinf":"IE",
	"appver":"1.0" 
} 
		
RESPONSE:
{
	"secretKey":"SECRET_KEY",
	"accessKeyId":"ACCESS_KEY_ID",
	"sessionId":"SESSION_ID",
	"uploadUrl":"UPLOAD_URL",
	"err":""
} 
		
NOTICE: These is a sample response, please replace with the actual value referenced by the nomenclature of VALUE_NAME

Build the Authorization:

"PUT

image/jpg
CURRENT_DATE
x-amz-security-token:SESSION_ID
/UPLOAD_URL/NAME_OF_FILE.jpg"
		
NOTICE:

The UPLOAD_URL will need the "http://" removed from the string!

The CURRENT_DATE will be in the format like so: Sat, 21 Nov 2015 09:00:00 GMT!

HOW TO:

First do a hash_hmac(with sha1 format), of the above string, with the key being the SECRET_KEY.

Then base64_encode that to create the final AUTH_STRING.

Build the Auth string like so: "AWS ACCESS_KEY_ID:AUTH_STRING"

Upload the file:

PUT UPLOAD_URL/NAME_OF_FILE.jpg

HEADER:

"Date:CURRENT_DATE,

"Content-Type:image/jpg",

"Content-Length:SIZE_OF_FILE",

"x-amz-security-token:SESSION_ID",

"Authorization:AUTH_STRING"

BODY:
CONTENTS OF THE IMAGE FILE
		
RESPONSE:
200
		
NOTICE: The response will be the http status code of the request. 200 is what you are looking for here.

Final Image URL:

GET UPLOAD_URL/NAME_OF_FILE.jpg

?Expires=EXPIRY_TIME

&AWSAccessKeyId=ACCESS_KEY_ID

&x-amz-security-token=SESSION_ID

&Signature=AUTH_STRING

EXAMPLE URL:
http://pod-qa.walgreens.com/wag_logo.jpg?Expires=1447995231&AWSAccessKeyId=ASIAI3IY6IMRRP2E7A6A&x-amz-security-token=AQoDYXdzEJL%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEa8AGQcuGMdIGE6RFsuHO6vl8aP1c8VTrBe9jPphafOi9r6deJ09Tr80E963aRC23P76%2FPsQug4eg4KKRvds2LSsC8ksPyw3ncDrtRxmkAEB3V%2Br6qty9MamSk5pUTeKMFBhlaXdBtF2cP4%2FaikRoCao3m2MmJ8uARnnbd5CZBdj6nV83K4a7dmD7XDgqjvZZhjyxOxJ%2FZC%2BU1%2BXDW7T0EoSeFys7e91m6a6bTVzKvcK2sR%2Br8Tkpf6dlfVE89trE9uElN3SHx9FeISxiWWV6wUAy%2BsDeOwvIHT7lWhh9dI9CoCtOgS7iJArDjXoAuPrxPn4cgmtqysgU%3D&Signature=31VfSuqyDAr5H7H2Na6n%2FP3yWqk%3D
		
NOTICE: The EXPIRY_TIME will be the current unix timestamp plus 36 hours aka 129600.

NOTICE: Please url_encode the SESSION_ID and AUTH_STRING.

2) Open Checkout

Get the Landing URL:

POST https://services-qa.walgreens.com/api/util/mweb5url

HEADER:
"Content-Type: application/json"
BODY:
{
    "apiKey": "GzoSZccevkX9VAjUkEwmvAy4PGcFXBhq",
    "affId": "wildhacks",
    "publisherId": ""
    "transaction": "photoCheckoutv2",
    "act": "mweb5UrlV2",
    "view": "mweb5UrlV2JSON",
    "devinf": "Chrome,26.0.1410.65",
    "appver": "0.01",
    "affNotes": "Enter the name of your application!",
    "expiryTime": "EXPIRY_TIME",
    "images": [
    	"IMAGE_URL_1",
    	"IMAGE_URL_2",
    	...
    ],
    "lat": "USER_LATITUDE",
    "lng": "USER_LONGITUDE",
    "customer": {
        "firstName": "USER_FIRST_NAME",
        "lastName": "USER_LAST_NAME",
        "email": "USER_EMAIL",
        "phone": "USER_PHONE_NUMBER"
    },
    "channelInfo": "",
    "callBackLink": ""
}
		
RESPONSE:
{
	"landingUrl":"LANDING_URL",
	"template":"default",
	"uploadLimit":100,
	"token":"CHECKOUT_TOKEN",
	"err":""
}
		
NOTICE: The affNotes should be the unique name of your app!

NOTICE: If your integration is a website please add "web" for the value of channelInfo!

NOTICE: The images array has a maximum of 100 unique image urls!

NOTICE: Please enter the callback url you want us to send to for the callBackLink parameter!

NOTICE: The publisherId can be applied for at a different date, but it is used for the Revenue Share!

OPEN THE CHECKOUT URL:

GET LANDING_URL&token=CHECKOUT_TOKEN

EXAMPLE URL:
https://m5-qa.walgreens.com/mweb5/checkout/orderprints.jsp?cartId=262590&token=PHT-1p9UZj9c0gNrHnBhpze2B2g4LHrxHU1m
		
NOTICE: The checkout should only be visible in a modal/view no larger then 540px wide, and 620px high!

- Interested in building the checkout? Look at the Native JSON API