We are having a hard time pushing transaction data via the datafeed feature to Amazon's API Gateway product. No matter how we configure it, the API gateway keeps returning an error: "Unsupported media type." After some research, I'm not entirely sure if the AWS API Gateway is compatible with the Foxycart datafeed feature. It appears the AWS API Gateway favors JSON.
We modified your PHP test script to send an encrypted transaction as part of a JSON object:
$XMLOutput_encrypted = rc4crypt::encrypt($myKey,$XMLOutput);
$XMLOutput_encrypted = base64_encode($XMLOutput_encrypted);
$ch = curl_init($myURL);
$jsonData = array('FoxyData' => $XMLOutput_encrypted );
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($jsonData));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
$result = curl_exec($ch);
These minor modifications allow us to use the API Gateway in conjuction with Lambda and SQS. Encrypted transactions are safely stored in an SQS queue so we can easily consume them in a controled fasion. This approach costs very little to run and offers a lot of value. We believe other FoxyCart clients that are using Amazon AWS would greatly benefit from this.
Would it be possible to add an option for the datafeed that could send application/json instead of text/plain so that it is compatible with the AWS API Gateway? If not, can you tell us how the API Gateway can be configured to accept the datafeed POST?