Skip to main content

Authentication

Authentication to the Kody API is accomplished using a Store ID and an API key. These credentials are provided during your technical integration onboarding or by your Kody contact.

During development, you'll use a test Store and API key. When you're ready for live access, production credentials will be shared securely and linked with your live store. The API endpoints for test and live environments are compatible; only the credentials and service hostname differ.


Hostnames

⚠️ Migrate to a regional endpoint. The global endpoints (grpc-staging.kodypay.com and grpc.kodypay.com) are being retired. Switching to the regional endpoint closest to your users gives you more stable connectivity, and global endpoint support may be discontinued in the future. Please migrate as soon as possible.

  • Development and Test:

    • For Asia-specific region: https://grpc-staging-ap.kodypay.com
    • For Europe-specific region: https://grpc-staging-eu.kodypay.com
  • Live:

    • For Asia-specific region: https://grpc-ap.kodypay.com
    • For Europe-specific region: https://grpc-eu.kodypay.com

Note to Developers: Please set the region based on the user's location. This will route traffic to the closest datacenter, thereby improving connection performance.


Examples

Authentication Code Samples

Below are examples in multiple programming languages demonstrating how to set up authentication when calling Kody API services.

import io.grpc.ManagedChannelBuilder;
import io.grpc.Metadata;
import io.grpc.stub.MetadataUtils;
import com.kodypay.ecom.v1.GetPaymentsRequest;
import com.kodypay.ecom.v1.GetPaymentsResponse;
import com.kodypay.ecom.v1.KodyEcomPaymentsServiceGrpc;

class Main {
public static void main(String[] args) {
// Setup channel and client with authentication
Metadata metadata = new Metadata();
metadata.put(Metadata.Key.of("X-API-Key", Metadata.ASCII_STRING_MARSHALLER), "API_KEY");

var channel = ManagedChannelBuilder.forAddress("HOSTNAME", 443)
.useTransportSecurity()
.build();
var client = KodyEcomPaymentsServiceGrpc.newBlockingStub(channel)
.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(metadata));

// Create GetPayments request
var request = GetPaymentsRequest.newBuilder()
.setStoreId("STORE_ID")
.setPageCursor(GetPaymentsRequest.PageCursor.newBuilder()
.setPageSize(10)
.build())
.build();

// Fetch payments
GetPaymentsResponse response = client.getPayments(request);

// Print payment details
response.getResponse().getPaymentsList().forEach(payment -> {
System.out.println("Payment ID: " + payment.getPaymentId());
System.out.println("Status: " + payment.getStatus());
});
}
}

Remember to replace the following placeholders with your actual values:

  • HOSTNAME: Use the regional endpoint for your environment — e.g. grpc-staging-eu.kodypay.com or grpc-staging-ap.kodypay.com for development and test, or grpc-eu.kodypay.com or grpc-ap.kodypay.com for live. Global endpoints are deprecated — see the note above.
  • API_KEY: Your API key
  • STORE_ID: Your store identifier

For further support or more detailed information, please contact our support team.