Skip to content

Cancel an order

Cancel an order that has not yet been completed, with optional refund execution for already-captured payments.

Orders that haven’t reached Inttegro.OrderStatuses.Completed status can be canceled at any point in the lifecycle—whether the customer changed their mind before paying, an item went out of stock, or a suspected fraudulent transaction needs to be voided immediately. This guide shows you when cancellation is appropriate, how to trigger it, and what to expect from the order and payment objects afterward.

Prerequisites

When to cancel

Cancellation is the right action when the order should never complete. Common cases:

What cancellation does not cover: If the order has already reached Inttegro.OrderStatuses.Completed status, you need a refund flow, not a cancellation. Cancellation is pre-completion only.

Cancel an order without refund

When the order has no captured payment—typically orders still in Inttegro.OrderStatuses.RequiresPayment before the customer confirms the OTP, or orders in Inttegro.OrderStatuses.Preparing that were never paid—cancel without triggering a refund. Set executeRefund to false or omit it entirely.

Cancel order

POST/orders/cancel
cURLbash
curl https://api.inttegro.com/orders/cancel \
  -H "Authorization: Bearer $INTTEGRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "order_id": "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi",
  "reason": "customer_request"
}'
TypeScripttypescript
import { InttegroClient } from '@inttegro/inttegro-sdk'

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

const result = await inttegro.orders.cancel({
  orderId: "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi",
  reason: "customer_request",
})
Gogo
package main

import (
  "context"
  "log"
  "os"

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

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

  result, err := client.Orders.Cancel(ctx, "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi")
  if err != nil {
    log.Fatal(err)
  }
  _ = result
}
Pythonpython
import os

from inttegro import InttegroClient

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

result = client.orders.cancel(
    "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi"
)
PHPphp
<?php

use Inttegro\Client;

$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->orders->cancel("or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi");
Rubyruby
require "inttegro"

client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.orders.cancel(
  order_id: "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi"
)
Javajava
import com.inttegro.Client;

public class Example {
  public static void main(String[] args) throws Exception {
    var client = new Client(System.getenv("INTTEGRO_API_KEY"));
    var result = client.orders().cancel("or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi");
  }
}
C#csharp
using Inttegro;

using var inttegro = new InttegroClient(
    Environment.GetEnvironmentVariable("INTTEGRO_API_KEY")!
);
var result = await inttegro.Orders.CancelAsync("or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi");

After a successful cancellation the order’s status field becomes Inttegro.OrderStatuses.Canceled and the payment (if one exists) transitions to Inttegro.PaymentStatuses.Canceled as well. The canceledAt timestamp is set on the payment object for your audit trail.

Cancel an order and refund the customer

If the customer’s mobile money payment was already charged before you cancel, pass executeRefund: true. Inttegro voids or reverses the payment in the same call—you don’t need a separate refund API call.

Cancel with refund

POST/orders/cancel
cURLbash
curl https://api.inttegro.com/orders/cancel \
  -H "Authorization: Bearer $INTTEGRO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "order_id": "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi",
  "reason": "inventory_unavailable",
  "execute_refund": true
}'
TypeScripttypescript
import { InttegroClient } from '@inttegro/inttegro-sdk'

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

const result = await inttegro.orders.cancel({
  orderId: "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi",
  reason: "inventory_unavailable",
  executeRefund: true,
})
Gogo
package main

import (
  "context"
  "log"
  "os"

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

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

  result, err := client.Orders.Cancel(ctx, "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi")
  if err != nil {
    log.Fatal(err)
  }
  _ = result
}
Pythonpython
import os

from inttegro import InttegroClient

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

result = client.orders.cancel(
    "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi"
)
PHPphp
<?php

use Inttegro\Client;

$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->orders->cancel("or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi");
Rubyruby
require "inttegro"

client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.orders.cancel(
  order_id: "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi"
)
Javajava
import com.inttegro.Client;

public class Example {
  public static void main(String[] args) throws Exception {
    var client = new Client(System.getenv("INTTEGRO_API_KEY"));
    var result = client.orders().cancel("or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi");
  }
}
C#csharp
using Inttegro;

using var inttegro = new InttegroClient(
    Environment.GetEnvironmentVariable("INTTEGRO_API_KEY")!
);
var result = await inttegro.Orders.CancelAsync("or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi");

Refund timing depends on the payment method. Mobile money reversals typically settle within minutes.

What happens after cancellation

Once canceled, an order cannot be reopened or modified. The cancellation is permanent. If the customer still wants to buy, create a new order.

The canceled order remains accessible via Lookup an order and Page through orders. It appears in your order history with status: Inttegro.OrderStatuses.Canceled indefinitely—useful for customer service, auditing, and financial reconciliation.

Your balance is not affected by a cancellation unless a payment was already captured and you set executeRefund: true. In that case, a negative balance transaction is created for the refund amount, reducing your available balance by the refunded sum.

Type to search…

↑↓ navigate↵ selectEsc close