My problem is I get Invalid URI when I try to do a GET with commercepayments.PaymentsHttp in my class with implements commercepayments.PaymentGatewayAdapter

HttpRequest req = new HttpRequest();
req.setHeader('Content-Type', 'application/json');
commercepayments.PaymentsHttp http = new commercepayments.PaymentsHttp();
HttpResponse res = http.send(req)

1 Answer 1


I understand the issue. The issue is that PaymentsHttp is sort of a wrapper around the standard Http class which uses the named credential (merchantcredential) associated with the payment gateway adapter (apexadapter.name) for the endpoint (it prefixes the httprequest.endpoint uri with the named cred uri upon http send) Unfortunately there is not much flexibility here.

The doc is (or at least used to be) pretty weak on this.

The suggestion is to build the request assuming it's using this named cred uri as the endpoint. Happy SFCC :)

ie. SELECT Id, PaymentGatewayName, PaymentGatewayProvider.ApexAdapter.Name, MerchantCredential.DeveloperName,MerchantCreditial.Endpoint FROM PaymentGateway

at runtime.

   String additionalSuffix = "/whateverhere";
   String ep = additionalSuffix;

if debugging upon http send the endpoint ends up being [MerchantCredital.Endpoint]/whateverhere

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .