I need to create a HTTP end-point for receiving transaction notifications from a payment gateway.

How would I create a HTTP end-point which accepts POST requests with a variable set of parameters.

POST Request Body


I don't think I can use a REST end-point, because the request body is not JSON or XML.


You still set up an ApexRest endpoint. There's nothing magic about it that requires JSON nor XML.

You can whip up a simple demo to prove ApexRest is sufficient for your needs:

global class Demo
    global static void doStuff()
        String body = RestContext.request.requestBody.toString();
        Map<String, String> params = new Map<String, String>();
        for (String param : body.split('&'))
            if (param.contains('='))
                params.put(param.substringBefore('=').trim(), param.substringAfter('=').trim());

Then post your payload to that endpoint. I used workbench and got exactly the expected results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.