I am having an issue here...
I am trying to access a REST service for payment processing. The URL for the specific call I am trying to make is here:
https://developer.payeezy.com/payeezy-api/apis/post/transactions/tokens
You may not be able to see it unless you sign up to be a developer, not sure on that.
I have jumped through the hoops to create the 6 parameters that they say are required for the call. I made the call and got the following error: "Error querying headers: (87) the parameter is incorrect."
I have tried several ways of executing the command.
In each of the three methods (the first two require the clearing of parameters) the result is the same. None of the parameters is blank, yet tracing into the code it seems to be that it is looking for a parameter with no name. The call stack shows a call to TWinHTTPRequest.GetHeaders which calls ReadHeader (where the error is happening). The calls are in the unit System.Net.HttpClient.Win. The last method assumes that the parameters were already defined in the TRestRequest component while the first two clear the params and add them back. What am I doing wrong?
procedure TForm1.btnGenerateClick(Sender: TObject);
var
Payload : String;
PayeezyCall : IPayeezyCall;
begin
Payload := GetPayload;
PayeezyCall := NewPayeezyCall(Payload);
with RESTRequest1 do
begin
// Params.Clear;
// Params.AddUrlSegment('apikey', HTTPEncode(PayeezyCall.APIKey));
// Params.AddUrlSegment('token', HTTPEncode(PayeezyCall.Token));
// Params.AddUrlSegment('Content-type', HTTPEncode(PayeezyCall.ContentType));
// Params.AddUrlSegment('Authorization', HTTPEncode(PayeezyCall.Authorization));
// Params.AddUrlSegment('nonce', HTTPEncode(PayeezyCall.Nonce));
// Params.AddUrlSegment('timestamp', HTTPEncode(PayeezyCall.TimeStamp));
// Params.AddHeader('apikey', HTTPEncode(PayeezyCall.APIKey));
// Params.AddHeader('token', HTTPEncode(PayeezyCall.Token));
// Params.AddHeader('Content-type', HTTPEncode(PayeezyCall.ContentType));
// Params.AddHeader('Authorization', HTTPEncode(PayeezyCall.Authorization));
// Params.AddHeader('nonce', HTTPEncode(PayeezyCall.Nonce));
// Params.AddHeader('timestamp', HTTPEncode(PayeezyCall.TimeStamp));
Params.ParameterByName('apikey').Value := HTTPEncode(PayeezyCall.APIKey);
Params.ParameterByName('token').Value := HTTPEncode(PayeezyCall.Token);
Params.ParameterByName('Content-type').Value := HTTPEncode(PayeezyCall.ContentType);
Params.ParameterByName('Authorization').Value := HTTPEncode(PayeezyCall.Authorization);
Params.ParameterByName('nonce').Value := HTTPEncode(PayeezyCall.Nonce);
Params.ParameterByName('timestamp').Value := HTTPEncode(PayeezyCall.TimeStamp);
Resource := PayeezyCall.Payload;
try
Execute;
except
eGenerate.Lines.Text := RestResponse1.Content;
end;
end;
end;