Quickstart
Create a finalized order, read the hosted invoice URL from the response, and send your customer into the Inttegro checkout flow. This guide uses the official SDKs so your integration goes through the same typed resource methods used throughout Studio.
Prerequisites
- An Inttegro application
Install an SDK
Install the SDK for your server-side runtime before creating requests:
SDK installation
- TypeScript
- Go
- Python
- PHP
- Ruby
- Java
- C#
npm install @inttegro/inttegro-sdk
go get github.com/zebodotdev/inttegro-sdk-go
pip install inttegro
composer require inttegro/sdk
bundle add inttegro
<dependency>
<groupId>com.inttegro</groupId>
<artifactId>inttegro-sdk-java</artifactId>
<version>2.0.0</version>
</dependency>
dotnet add package Inttegro
Create a finalized order
Send finalize: true to create and seal the order in one request. A finalized order includes an invoice object whose web URL opens the hosted checkout. The raw HTTP response uses an { "order": { ... } } envelope; the official SDKs unwrap that envelope and return the order domain object directly.
Create an order
- cURL
- TypeScript
- Go
- Python
- PHP
- Ruby
- Java
- C#
response=$(curl https://api.inttegro.com/orders/create \
-H "Authorization: Bearer $INTTEGRO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: checkout-order-123" \
-d '{
"customer_data": {
"name": "Akua Mensah",
"email_address": "[email protected]",
"phone_number": "+233544998605"
},
"finalize": true,
"line_items": [{
"product": {
"name": "Monthly Subscription",
"price": { "currency": "ghs", "value": 5000 },
"quantity": 1,
"type": "service"
},
"type": "product"
}]
}')
invoice_url=$(jq -er '.order.invoice.format.web.url' <<< "$response")
printf '%s\n' "$invoice_url"
import * as Inttegro from '@inttegro/inttegro-sdk'
const inttegro = new Inttegro.InttegroClient({
apiKey: process.env.INTTEGRO_API_KEY!,
})
const result = await inttegro.orders.create({
requestMeta: {
idempotencyKey: "checkout-order-123",
},
customerData: {
name: "Akua Mensah",
phoneNumber: "+233544998605",
},
finalize: true,
lineItems: [
{
product: {
name: "Monthly Subscription",
price: {
currency: "ghs",
value: 5000,
},
quantity: 1,
type: Inttegro.ProductTypes.Service,
},
type: Inttegro.LineItemTypes.Product,
},
],
})
package main
import (
"context"
"log"
"os"
inttegro "github.com/zebodotdev/inttegro-sdk-go/v4"
"github.com/zebodotdev/inttegro-sdk-go/v4/money"
)
func main() {
ctx := context.Background()
client := inttegro.NewClient(os.Getenv("INTTEGRO_API_KEY"))
params := inttegro.OrderCreateParams{
RequestMeta: &inttegro.RequestMeta{
IdempotencyKey: "checkout-order-123",
},
CustomerData: &inttegro.CustomerData{
Name: "Akua Mensah",
PhoneNumber: "+233544998605",
},
Finalize: inttegro.Bool(true),
LineItems: []inttegro.OrderLineItemParams{
{
Product: &inttegro.ProductLineItemParams{
Name: "Monthly Subscription",
Price: inttegro.PriceParams{
AmountParams: money.AmountParams{
Currency: money.GHS,
Value: 5000,
},
},
Quantity: 1,
Type: inttegro.ProductTypeService,
},
Type: inttegro.LineItemTypeProduct,
},
},
}
result, err := client.Orders.Create(ctx, params)
if err != nil {
log.Fatal(err)
}
_ = result
}
import os
import inttegro
client = inttegro.InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])
result = client.orders.create(inttegro.orders.CreateRequest(
request_meta=inttegro.orders.RequestMeta(
idempotency_key="checkout-order-123",
),
customer_data=inttegro.orders.Customer(
name="Akua Mensah",
phone_number="+233544998605",
),
finalize=True,
line_items=[
inttegro.orders.ProductLineItem(
product=inttegro.orders.Product(
name="Monthly Subscription",
price=inttegro.orders.PriceParams(
currency=inttegro.Currency.GHS,
value=5000,
),
quantity=1,
type=inttegro.ProductType.SERVICE,
),
type=inttegro.LineItemType.PRODUCT,
),
],
))
<?php
use Inttegro\Client;
$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->orders->create([
'request_meta' => [
'idempotency_key' => 'checkout-order-123',
],
'customer_data' => [
'name' => 'Akua Mensah',
'phone_number' => '+233544998605',
],
'finalize' => true,
'line_items' => [
[
'product' => [
'name' => 'Monthly Subscription',
'price' => [
'currency' => 'ghs',
'value' => 5000,
],
'quantity' => 1,
'type' => \Inttegro\ProductType::Service,
],
'type' => \Inttegro\LineItemType::Product,
],
],
]);
require "inttegro"
client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.orders.create(
request_meta: {
idempotency_key: "checkout-order-123",
},
customer_data: {
name: "Akua Mensah",
phone_number: "+233544998605",
},
finalize: true,
line_items: [
{
product: {
name: "Monthly Subscription",
price: {
currency: "ghs",
value: 5000,
},
quantity: 1,
type: Inttegro::ProductType::SERVICE,
},
type: Inttegro::LineItemType::PRODUCT,
},
]
)
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("checkout-order-123")
.build())
.customerData(CustomerData.builder()
.name("Akua Mensah")
.phoneNumber("+233544998605")
.build())
.finalizeOrder(true)
.lineItem(OrderLineItemParams.product(ProductLineItemParams.builder()
.name("Monthly Subscription")
.price(PriceParams.of(Currency.GHS, 5000))
.quantity(1L)
.type(ProductType.SERVICE)
.build()))
.build();
var result = client.orders().create(params);
}
}
using Inttegro;
using var inttegro = new InttegroClient(
Environment.GetEnvironmentVariable("INTTEGRO_API_KEY")!
);
var result = await inttegro.Orders.CreateAsync(new {
request_meta = new {
idempotency_key = "checkout-order-123",
},
customer_data = new {
name = "Akua Mensah",
phone_number = "+233544998605",
},
finalize = true,
line_items = new[] {
new {
product = new {
name = "Monthly Subscription",
price = new {
currency = "ghs",
value = 5000,
},
quantity = 1,
type = Inttegro.ProductType.Service,
},
type = Inttegro.LineItemType.Product,
},
},
});
Open the invoice URL in the customer's browser. Treat a missing invoice as an incomplete finalization rather than guessing a checkout URL.
Related resources
- Create an order - Complete request and response contract
- Finalize an order - Seal a draft order later
- Accept payment with Inttegro Checkout - Complete hosted checkout workflow