I'm currently developing a site using payeezy/firstdata for payments. It has been quite a hassle integrating because their API docs are kind of weak.
I'm using ColdFusion and a cfhttp request. I've been following this to calculate my content digest and hmac hash: https://support.payeezy.com/hc/en-us/articles/203731149-API-Security-HMAC-Hash
I finally got the hashs to match the calculated hashs in the demo terminal but my problem is: I'm getting a strange error when sending the request. I get the error:
"Invalid signature received 'Fgx/lR############'."
where the first few characters change every time. Here's my code for the request:
postAction = https://api.demo.globalgatewaye4.firstdata.com/transaction/v19 key_id,hmac_value, content_digest have all been tested and are correct x_time = getIsoTimeString( now() )
<cfhttp url="#postAction#" method="POST">
<cfhttpparam name="Authorization" type="header" value="CGGE4_API #key_id#:#hmac_value#">
<cfhttpparam name="x-gge4-date" type="header" value="#x_time#">
<cfhttpparam name="x-gge4-content-sha1" type="header" value="#LCase(content_digest)#">
<cfhttpparam name="content-type" type="header" value="text/xml">
<cfhttpparam name="accept" type="header" value="text/xml">
<cfhttpparam name="transaction_body" type="xml" value="#exact_xml#" />
</cfhttp>
<cfdump var="#cfhttp.fileContent#"><cfabort>
The submitted xml (without spaces or new lines)
<Transaction>
<ExactID>#exact_id#</ExactID>
<Password>#password#</Password>
<Card_Number>#FORM.x_card_num#</Card_Number>
<CardHoldersName>#FORM.x_first_name# #FORM.x_last_name#</CardHoldersName>
<Transaction_Type>00</Transaction_Type>
<Expiry_Date>#FORM.x_exp_date#</Expiry_Date>
<DollarAmount>#amount#</DollarAmount>
<Address>
<Address1>#FORM.x_address#</Address1>
<City>#FORM.x_city#</City>
<Zip>#FORM.x_zip#</Zip>
</Address>
</Transaction>
I've changed the authorization header to "Payeezy_Gateway_API #key_id#:#hmac_value#" and I get the error "Bad Authorization Header" when the hmac value and key id being used have been tested on the payeezy terminal many times.
Please, any help is much appreciated!
Both CGGE4_API and GGE4_API work for me when testing with their sample Python code on that support page you linked, but I called their support number and they told me I should be using GGE4_API.
Apparently the support page is outdated, and using Payeezy_Gateway_API does not work at all. Here is how the sample Python code on that page should look like:
In my application, I was also receiving the Invalid signature received. It turned out that I was adding
charset=utf-8to myContent-Typeheader, (credit to Leigh's comment). Removing that made my requests get accepted.