Skip to content

Authentication

Authenticate Inttegro API requests with an opaque bearer key.

Inttegro authenticates API requests with an opaque secret key. Keep the key in server-side secret storage and pass it to the official SDK client. The client authenticates every request it sends.

Prerequisites

  • An Inttegro application
  • An API key generated from the dashboard
  • A server-side runtime that can read secrets from its environment

Construct the client

Pass the unmodified secret key to the official SDK client once, when your server process starts. The client formats the bearer credential and sends it with every API request, so do not add an Authorization header or prefix the key with Bearer yourself.

Client setup

cURLbash
# cURL calls the HTTP API directly, so there is no SDK client to construct.
export INTTEGRO_API_KEY='<SECRET_KEY_TOKEN>'
TypeScripttypescript
import { InttegroClient } from '@inttegro/inttegro-sdk'

const inttegro = new InttegroClient({
  apiKey: process.env.INTTEGRO_API_KEY!,
})
Gogo
import (
  "os"

  inttegro "github.com/inttegro/inttegro-sdk-go/v14"
)

client := inttegro.NewClient(os.Getenv("INTTEGRO_API_KEY"))
Pythonpython
import os

from inttegro import InttegroClient

client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])
PHPphp
<?php

use Inttegro\Client;

$client = new Client(getenv('INTTEGRO_API_KEY'));
Rubyruby
require "inttegro"

client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
Javajava
import com.inttegro.Client;

Client inttegro = new Client(System.getenv("INTTEGRO_API_KEY"));
C#csharp
using Inttegro;

using var inttegro = new InttegroClient(
    Environment.GetEnvironmentVariable("INTTEGRO_API_KEY")!
);

Do not parse the key, infer an environment from its characters, embed it in browser or mobile code, commit it to source control, or log it. A missing, malformed, or invalid credential returns 401 Unauthorized. If you call the HTTP API directly instead of using an SDK, the cURL example below shows the one place where you construct the Authorization: Bearer ... header yourself.

Make an authenticated request

This example creates a finalized order through the official SDKs. The raw HTTP response uses an { "order": { ... } } envelope; the SDKs return the order domain object directly.

Authenticated request

POST/orders/create
cURLbash
response=$(curl https://api.inttegro.com/orders/create \
  -H "Authorization: Bearer $INTTEGRO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: auth-example-order-123" \
  -d '{
    "finalize": true,
    "customer_data": {
      "name": "Akua Mensah",
      "email_address": "akua@example.com",
      "phone_number": "+233544998605"
    },
    "line_items": [{
      "product": {
        "name": "Premium Subscription",
        "price": { "currency": "ghs", "value": 5000 },
        "quantity": 1,
        "type": "service"
      },
      "type": "product"
    }]
  }')

invoice_url=$(jq -er '.order.invoice.format.web.url' <<< "$response")
TypeScripttypescript
import { InttegroClient, ProductTypes, LineItemTypes } from '@inttegro/inttegro-sdk'

const inttegro = new InttegroClient({
  apiKey: process.env.INTTEGRO_API_KEY!,
})

const result = await inttegro.orders.create({
  requestMeta: {
    idempotencyKey: "auth-example-order-123",
  },
  finalize: true,
  customerData: {
    name: "Akua Mensah",
    emailAddress: "akua@example.com",
    phoneNumber: "+233544998605",
  },
  lineItems: [
    {
      product: {
        name: "Premium Subscription",
        price: {
          currency: "ghs",
          value: 5000,
        },
        quantity: 1,
        type: ProductTypes.Service,
      },
      type: LineItemTypes.Product,
    },
  ],
})
Gogo
package main

import (
  "context"
  "log"
  "os"

  inttegro "github.com/inttegro/inttegro-sdk-go/v14"
  "github.com/inttegro/inttegro-sdk-go/v14/customer"
  "github.com/inttegro/inttegro-sdk-go/v14/money"
  "github.com/inttegro/inttegro-sdk-go/v14/order"
  "github.com/inttegro/inttegro-sdk-go/v14/price"
  "github.com/inttegro/inttegro-sdk-go/v14/product"
  "github.com/inttegro/inttegro-sdk-go/v14/request"
)

func main() {
  ctx := context.Background()
  client := inttegro.NewClient(os.Getenv("INTTEGRO_API_KEY"))

  params := order.CreateParams{
    RequestMeta: &request.Meta{
      IdempotencyKey: "auth-example-order-123",
    },
    Finalize: inttegro.Bool(true),
    CustomerData: &customer.Data{
      Name: "Akua Mensah",
      Email: "akua@example.com",
      PhoneNumber: "+233544998605",
    },
    LineItems: []order.LineItemParams{
      {
        Product: &order.ProductLineItemParams{
          Name: "Premium Subscription",
          Price: price.InlineParams{
            AmountParams: money.AmountParams{
              Currency: money.GHS,
              Value: 5000,
            },
          },
          Quantity: 1,
          Type: product.TypeService,
        },
        Type: order.LineItemTypeProduct,
      },
    },
  }
  result, err := client.Orders.Create(ctx, params)
  if err != nil {
    log.Fatal(err)
  }
  _ = result
}
Pythonpython
import os

import inttegro
from inttegro import InttegroClient

client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])

result = client.orders.create(inttegro.order.CreateNewCustomerInput(
  request_meta=inttegro.order.CreateNewCustomerInputRequestMeta(
    idempotency_key="auth-example-order-123",
  ),
  finalize=True,
  customer_data=inttegro.customer.DataInput(
    name="Akua Mensah",
    email_address="akua@example.com",
    phone_number="+233544998605",
  ),
  line_items=[
    inttegro.product.LineItemInput(
      product=inttegro.product.InlineDetailsInput(
        name="Premium Subscription",
        price=inttegro.price.InlineParams(
          currency=inttegro.money.Currency.GHS,
          value=5000,
        ),
        quantity=1,
        type=inttegro.product.Type.SERVICE,
      ),
      type=inttegro.order.LineItemType.PRODUCT,
    ),
  ],
))
PHPphp
<?php

use Inttegro\Client;

$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->orders->create([
  'request_meta' => new \Inttegro\Request\Meta(
    idempotencyKey: 'auth-example-order-123',
  ),
  'finalize' => true,
  'customer_data' => [
    'name' => 'Akua Mensah',
    'email_address' => 'akua@example.com',
    'phone_number' => '+233544998605',
  ],
  'line_items' => [
    [
      'product' => [
        'name' => 'Premium Subscription',
        'price' => [
          'currency' => 'ghs',
          'value' => 5000,
        ],
        'quantity' => 1,
        'type' => \Inttegro\ProductType::Service,
      ],
      'type' => \Inttegro\LineItemType::Product,
    ],
  ],
]);
Rubyruby
require "inttegro"

client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.orders.create(
  request_meta: Inttegro::Order::CreateNewCustomerRequestMeta.new(
    idempotency_key: "auth-example-order-123",
  ),
  finalize: true,
  customer_data: {
    name: "Akua Mensah",
    email_address: "akua@example.com",
    phone_number: "+233544998605",
  },
  line_items: [
    {
      product: {
        name: "Premium Subscription",
        price: {
          currency: "ghs",
          value: 5000,
        },
        quantity: 1,
        type: Inttegro::ProductType::SERVICE,
      },
      type: Inttegro::LineItemType::PRODUCT,
    },
  ]
)
Javajava
import com.inttegro.Client;
import com.inttegro.orders.OrderCreateParams;
import com.inttegro.RequestMeta;
import com.inttegro.customers.CustomerData;
import com.inttegro.orders.OrderLineItemParams;
import com.inttegro.orders.ProductLineItemParams;
import com.inttegro.prices.PriceParams;
import com.inttegro.money.Currency;
import com.inttegro.products.ProductType;

public class Example {
  public static void main(String[] args) throws Exception {
    var client = new Client(System.getenv("INTTEGRO_API_KEY"));
    var params = OrderCreateParams.builder()
      .requestMeta(RequestMeta.builder()
          .idempotencyKey("auth-example-order-123")
          .build())
      .finalizeOrder(true)
      .customerData(CustomerData.builder()
          .name("Akua Mensah")
          .email("akua@example.com")
          .phoneNumber("+233544998605")
          .build())
      .lineItem(OrderLineItemParams.product(ProductLineItemParams.builder()
            .name("Premium Subscription")
            .price(PriceParams.of(Currency.GHS, 5000))
            .quantity(1L)
            .type(ProductType.SERVICE)
            .build()))
      .build();
    var result = client.orders().create(params);
  }
}
C#csharp
using Inttegro;

using var inttegro = new InttegroClient(
    Environment.GetEnvironmentVariable("INTTEGRO_API_KEY")!
);
var result = await inttegro.Orders.CreateAsync(new OrderCreateRequest {
  RequestMeta = new RequestMeta {
    IdempotencyKey = "auth-example-order-123",
  },
  Finalize = true,
  CustomerData = new CustomerData {
    Name = "Akua Mensah",
    EmailAddress = "akua@example.com",
    PhoneNumber = "+233544998605",
  },
  LineItems = new List<LineItemParams> {
    new LineItemParams {
      Product = new ProductDetailsParams {
        Name = "Premium Subscription",
        Price = new Inttegro.PriceParams {
          Currency = Inttegro.Money.Currency.GHS,
          Value = 5000,
        },
        Quantity = 1,
        Type = Inttegro.ProductType.Service,
      },
      Type = Inttegro.LineItemType.Product,
    },
  },
});

Store credentials safely

For production, use a managed secret store as the source of truth for the Inttegro key. Do not keep a production key in a .env file or manage it as an ordinary environment variable in deployment configuration. Grant the workload identity access to only the secret it needs, then retrieve or inject the value at deploy time or runtime.

Your host or secret manager may expose the retrieved value to the process as INTTEGRO_API_KEY. That is an appropriate runtime delivery mechanism: the secret remains governed by the store’s encryption, access controls, audit trail, and rotation workflow rather than by ordinary application configuration.

Prefer the secret manager native to the cloud where the application runs:

  • On Google Cloud, store the key in Secret Manager and grant the Cloud Run, GKE, or Compute workload’s service account access to that secret—not broad project-wide secret access.
  • On AWS, store it in AWS Secrets Manager and let the application’s IAM role retrieve it at runtime. Do not place the plaintext key in an image, task definition, Lambda configuration, or infrastructure template.
  • On Cloudflare Workers, use an application-specific Worker secret or use Cloudflare Secrets Store when the same centrally managed secret must be reusable across the account.

If you need a provider-independent store, choose one that matches how your team operates:

  • Doppler or Infisical work well when you want one application-focused source of truth across local development, CI, and deployments.
  • 1Password Environments is a good fit when developer credentials already live in 1Password and local commands should receive secrets without writing plaintext .env files.
  • Azure Key Vault is the corresponding managed option for applications running on Azure.
  • HashiCorp Vault makes sense when your infrastructure team already operates Vault or needs centralized policy, dynamic credentials, and explicit lease management.

At the deployment boundary, prefer the secret feature provided by your host. These platforms commonly expose the value to your application as an environment variable, but store and protect it differently from ordinary configuration:

For local development, a temporary environment variable is acceptable. Prefer having your secret manager populate it for the command or shell session instead of copying the production value into a persistent .env file:

Local developmentbash
export INTTEGRO_API_KEY='<DEVELOPMENT_SECRET_KEY_TOKEN>'

Use separate credentials for development, staging, and production, and restrict access to the deployment identities that actually make Inttegro requests. Avoid client-exposed prefixes such as NEXT_PUBLIC_, VITE_, or EXPO_PUBLIC_; an Inttegro API key must only be loaded by server-side code. If a key may have been disclosed, generate a replacement, deploy it, verify requests with the new credential, and retire the old key.

Handle authentication failures

A 401 Unauthorized response means Inttegro could not authenticate the request. For an SDK integration, verify that the client received the complete active key from the intended environment. For direct HTTP, also verify that the request uses the exact Authorization: Bearer <token> header. Do not print the key while diagnosing the failure.

Authentication proves which application made the request. It does not by itself prove a customer’s identity or authorize a payment; keep those decisions in the corresponding checkout or verification flow.

Type to search…

↑↓ navigate↵ selectEsc close