This API is to look for the enabled retailer’s store information by zipcode or location for the customers of POB partner. Green Dot has implemented it, the POB partners just call it if they need to return store list back to customers.

Authentication

Header Information

  • The services will be hosted in an environment which is IP restricted. Only the authorized partners will have access to these services
  • The payload will be encrypted in the SSL environment
  • A secret keywill be shared between GD and the partner. Please contact Green Dot development team for the secret key
FieldRequired?Description
x-gd-timestampYesTimestamp in http header is using the pattern [YYYY]-[MM]-[DD]T[hh]:[mm]:[ss][time zone] that preserves time zone information and complies with ISO 8601.The time zone component is an offset from UTC (for example, +01:00, -07:00). The time zone component uses ‘Z’ (which stands for zero offset) to represent UTC.Timestamp string without time zone component is assumed to be UTC. Examples of the timestamp string are 202005-22T03:07:53Z
x-gd-signatureYessignature of the message (see the signature calculationbelow)
x-gd-encryptiontypeYes0-none, 1-Digital Signature
x-gd-requestidYesunique id of the request
x-gd-channeltypeYes1-mobile, 2–web, 0-other
x-gd-deviceidNodevice id of the client making the API call (for future use)
x-gd-devicetypeYes0-other, 1-mobile, 2-desktop
x-gd-ipaddressYesIP Address of the client making the API call
x-gd-programcodeYesProgramcode assigned by Green Dot

GD will issue the Partner a secret key that will be used for the signature calculation

Signature calculation

Sort the headers (except the Signature header). Remove extra spaces around the fields.

  1. sort the fields by alphabetical and concatenate the headers using a delimiter &
  2. ASCII encode secret key
  3. UTF8 encode concatenated header string
  4. Hash it using SHA-256 (use the key as secret key). Secret key is shared between GD and Partner

The following is the code snippet in C# to generate signature:

//sortvardict=requestHeaderDictionary.OrderBy(t=>t.Key).ToList();//concatenatevarpairs=dict.Where(p=>(p.Key!=“x-gd-signature”)&&(!string.IsNullOrWhiteSpace(p.Value))).Select(x=>string.Format("{0}{1}{2}",x.Key,":",x.Value));varconcatnatedString=string.Join("&",pairs).ToLower();varencoding=newASCIIEncoding();byte[]secretKeyBytes=encoding.GetBytes(secret);byte[]signature=Encoding.UTF8.GetBytes(concatnatedString);using(varhmac=newHMACSHA256(secretKeyBytes)){byte[]signatureBytes=hmac.ComputeHash(signature);returnstring.Concat(signatureBytes.Select(b=>b.ToString("X2")).ToArray());}Eg:input:Header:{"x-gd-timestamp":"2020-05-22T03:07:53Z","x-gd-encryptiontype":"1","x-gd-requestid":"61aa6e58-b442-4839-8432-948af2fad3c5","x-gd-channeltype":"1","x-gd-devicetype":"2","x-gd-ipaddress":"192.168.1.1","x-gd-programcode":"OneUnited",x-gd-signature:183A5D41B676865305EC8F807F4BCEDCB03B7F13BC0EAFCB9B24ED7A8BB67BAC}

Sorted/Concatenated data:

📘

Before doing the concatenation/hashing, make sure all the characters are converted to lower case and the strings are trimmed (left/right) for the extra white spaces. Do not include headers that have null/empty values.

“x-gd-channeltype:1&x-gd-devicetype:2&x-gd-encryptiontype:1&x-gd-ipaddress:192.168.1.1&x-gd-programcode:oneunited&x-gd-requestid:61aa6e58-b442-4839-8432-948af2fad3c5&x-gd-timestamp:2020-05-22t03:07:53z”

signature using the sample secret key 'OneUnitedTestSecret':

183A5D41B676865305EC8F807F4BCEDCB03B7F13BC0EAFCB9B24ED7A8BB67BAC

Get stores by zip code

Method: GETURL:~/programs/{programCode}/stores/zipcode/{zipCode}/service-type/{serviceType}~/programs/{programCode}/stores/zipcode/{zipCode}/service-type/{serviceType}/page/{page?}~/programs/{programCode}/stores/zipcode/{zipCode}/service-type/{serviceType}/page/{page}/count/{count?}

Request

ParameterData TypeRequiredDescription
programCodestringYesThe same with header, programcode assigned by Green Dot
zipCodestringYesZip code to search
pageintOptionalPage number,default value '1'
countintOptionalRecords count per page, default value '50'
serviceTypeintYesDefault value '1' for POB (IsCashReload = 1)

Response

ParameterData TypeDescription
totalCountinttotal store count that returned by the search
pageintpage count, default value '1'
countintrecordscount per page, default value '50'
storeListliststore entity list
store:retailerNamestringretailer name
store:addressstringstore address
store:phonestringstore phone number
store:latitudedecimalstore location latitude
store:longitudedecimalstore location longitude
store:idstringstore name + store number
store:citystringstore location city
store:zipCodestringstore location zip code
store:statestringstore location state
store:distancedecimalstore location distance(The value is 0.0 when search stores by zip code)
store:customerFeedecimalCustomerFee for each retailer

Get stores by latitude and longitude

Method: GET

URL:

  • /programs/{programCode}/stores/latitude/{latitude}/longitude/{longitude}/service-type/{serviceType}
  • /programs/{programCode}/stores/latitude/{latitude}/longitude/{longitude}/service-type/{serviceType}/page/{page?}
  • /programs/{programCode}/stores/latitude/{latitude}/longitude/{longitude}/service-type/{serviceType}/page/{page}/count/{count?}

Request

ParameterData TypeRequiredDescription
programCodestringYesThe same with header, programcode assigned by Green Dot
latitudedecimalYesinput latitude
longitudedecimalYesinput longitude
pageintoptionalpage number,default value '1'
countintoptionalrecords count per page,default value '50'
serviceTypeintYesdefault value '1' for POB (IsCashReload = 1)

Response

ParameterData TypeDescription
totalCountinttotal store count that returned by the search
pageintpage count, default value '1'
countintrecordscount per page, default value '50'
storeListliststore entity list
store:retailerNamestringretailer name
store:addressstringstore address
store:phonestringstore phone number
store:latitudedecimalstore location latitude
store:longitudedecimalstore location longitude
store:idstringstore name + store number
store:citystringstore location city
store:zipCodestringstore location zip code
store:statestringstore location state
store:distancedecimalstore location distance(The value is 0.0 when search stores by zip code)
store:customerFeedecimalCustomerFee for each retailer

Common Response Fields

ParameterDataTypeDescription
responseDetailsListresponsedetails including errorcodeand descriptions
responseDetail:codeIntRefer to Response error Codes below
responseDetail:subCodeIntRefer to Response error Codes below
responseDetail:descriptionStringRefer to Response error Codes below

Response Error Code

HttpStatus

Http Status CodeDescription
200OK
403Forbidden
400BadRequest
500InternalServerError

Response Details Code

CodeDescription
0Success
950Operation Failed
951Invalid Request
952Rejected

Response Details Sub Code

SubCodeDescription
0Success
601System Error
602Missing or Invalid Parameter

Sample

URL: ~/programs/OneUnited/stores/zipcode/91107/service-type/1

Request

Header:{x-gd-timestamp:2022-04-13T01:51:10.1374788Zx-gd-encryptiontype:1x-gd-requestid:61aa6e58-b442-4839-8432-948af2fad3c5x-gd-channeltype:1x-gd-devicetype:1x-gd-ipaddress:127.0.0.1x-gd-programcode:OneUnitedx-gd-signature:52581B4386597112751A1ACC3C28A01B70E4E2F7A381BEAB49F30B2D7ECE708F}

Response

{"responseDetails":[{"code":0,"subCode":0,"description":"Success"}],"page":1,"count":50,"totalCount":11,"storeList":[{"retailerName":"7-Eleven","id":"20269","address":"2717EColoradoBlvd","phone":"6267930102","city":"Pasadena","state":"CA","zipCode":"91107","latitude":34.14654300,"longitude":-118.09427400,"distance":0.674053246297448,"customerFee":4.9500},{"retailerName":"Vons","id":"2858","address":"2355EColoradoBlvd","phone":"0000000000","city":"Pasadena","state":"CA","zipCode":"91107","latitude":34.14762500,"longitude":-118.10210200,"distance":0.955936510607474,"customerFee":4.9500},{"retailerName":"Walgreens","id":"10764","address":"2376EColoradoBlvd","phone":"6267684040","city":"Pasadena","state":"CA","zipCode":"91107","latitude":34.14574900,"longitude":-118.10131300,"distance":1.01134131039383,"customerFee":4.9500},{"retailerName":"Ralphs","id":"37030730","address":"3601EFoothillBlvd","phone":"6263518806","city":"Pasadena","state":"CA","zipCode":"91107","latitude":34.15114900,"longitude":-118.07584600,"distance":1.05210307806477,"customerFee":4.9500},{"retailerName":"RiteAid","id":"5535","address":"3745EFoothillBlvd","phone":"6263510515","city":"Pasadena","state":"CA","zipCode":"91107","latitude":34.15120600,"longitude":-118.07264900,"distance":1.26748696662016,"customerFee":4.9500},{"retailerName":"7-Eleven","id":"39613","address":"3689EColoradoBlvd","phone":"6265684992","city":"Pasadena","state":"CA","zipCode":"91107","latitude":34.14669800,"longitude":-118.07362300,"distance":1.32781775995329,"customerFee":4.9500},{"retailerName":"7-Eleven","id":"25293","address":"1319NAltadenaDr","phone":"6267910279","city":"Pasadena","state":"CA","zipCode":"91107","latitude":34.16893300,"longitude":-118.09878300,"distance":1.36687911465109,"customerFee":4.9500},{"retailerName":"DollarTree","id":"5302","address":"181SRosemeadBlvd","phone":"6264630613","city":"Pasadena","state":"CA","zipCode":"91107","latitude":34.14320900,"longitude":-118.07375500,"distance":1.47787260954905,"customerFee":1.0000},{"retailerName":"7-Eleven","id":"20297","address":"227SRosemeadBlvd","phone":"6267934744","city":"Pasadena","state":"CA","zipCode":"91107","latitude":34.14249500,"longitude":-118.07391100,"distance":1.50681790100164,"customerFee":4.9500},{"retailerName":"CVS","id":"9688","address":"451SSierraMadreBlvd","phone":"6265648681","city":"Pasadena","state":"CA","zipCode":"91107","latitude":34.13814600,"longitude":-118.10204900,"distance":1.54396992288177,"customerFee":4.9500},{"retailerName":"CVS","id":"1778","address":"3883EFoothillBlvd","phone":"6263510589","city":"Pasadena","state":"CA","zipCode":"91107","latitude":34.15050800,"longitude":-118.06835500,"distance":1.57017700258762,"customerFee":4.9500}]}

Environments