Orders that haven’t reached Inttegro.OrderStatus.Completed"completed""completed""completed"'completed''completed'Inttegro::Order::Status::COMPLETEDInttegro.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
- An order ID (
or_…) that you want to cancel - Familiarity with the order lifecycle
When to cancel
Cancellation is the right action when the order should never complete. Common cases:
- Customer request before payment — The customer abandoned the checkout or called in to withdraw. The order is in
Inttegro.OrderStatus.RequiresPayment"requires_payment""requires_payment""requires_payment"'requires_payment''requires_payment'Inttegro::Order::Status::REQUIRES_PAYMENTInttegro.OrderStatuses.RequiresPaymentand no money has moved yet. - Out-of-stock after order creation — You accepted the order but can’t fulfill it. Cancel immediately to avoid the customer waiting on a payment that will never ship.
- Duplicate or fraudulent order — Your fraud detection flagged the transaction before it completed. Cancel with reason
"fraud"for your audit trail. - Timeout or expiry — You want to programmatically clean up stale orders that sat in
Inttegro.OrderStatus.RequiresPayment"requires_payment""requires_payment""requires_payment"'requires_payment''requires_payment'Inttegro::Order::Status::REQUIRES_PAYMENTInttegro.OrderStatuses.RequiresPaymentpast your SLA.
What cancellation does not cover: If the order has already reached Inttegro.OrderStatus.Completed"completed""completed""completed"'completed''completed'Inttegro::Order::Status::COMPLETEDInttegro.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.OrderStatus.RequiresPayment"requires_payment""requires_payment""requires_payment"'requires_payment''requires_payment'Inttegro::Order::Status::REQUIRES_PAYMENTInttegro.OrderStatuses.RequiresPayment before the customer confirms the OTP, or orders in Inttegro.OrderStatus.Preparing"preparing""preparing""preparing"'preparing''preparing'Inttegro::Order::Status::PREPARINGInttegro.OrderStatuses.Preparing that were never paid—cancel without triggering a refund. Set ExecuteRefundexecute_refundExecuteRefundexecuteRefundexecute_refundexecute_refundexecute_refundexecuteRefund to falsefalsefalsefalsefalseFalsefalsefalse or omit it entirely.
Cancel order
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"
}'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",
})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
}import os
from inttegro import InttegroClient
client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])
result = client.orders.cancel(
"or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi"
)<?php
use Inttegro\Client;
$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->orders->cancel("or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi");require "inttegro"
client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.orders.cancel(
order_id: "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi"
)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");
}
}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 Statusorder.statusStatusstatusstatusstatusstatusstatus field becomes Inttegro.OrderStatus.Canceled"canceled""canceled""canceled"'canceled''canceled'Inttegro::Order::Status::CANCELEDInttegro.OrderStatuses.Canceled and the payment (if one exists) transitions to Inttegro.PaymentStatus.Canceled"canceled""canceled""canceled"'canceled''canceled'Inttegro::Payment::Status::CANCELEDInttegro.PaymentStatuses.Canceled as well. The CanceledAtcanceled_atCanceledAtcanceledAtcanceledAtcanceled_atcanceled_atcanceledAt 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 ExecuteRefundexecute_refundExecuteRefundexecuteRefundexecute_refundexecute_refundexecute_refundexecuteRefund: truetruetruetruetrueTruetruetrue. Inttegro voids or reverses the payment in the same call—you don’t need a separate refund API call.
Cancel with refund
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
}'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,
})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
}import os
from inttegro import InttegroClient
client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])
result = client.orders.cancel(
"or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi"
)<?php
use Inttegro\Client;
$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->orders->cancel("or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi");require "inttegro"
client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.orders.cancel(
order_id: "or_kAVwBsk6EhQVv2YBUhYAqMf0lktEoQ0S7ZR8y2xi"
)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");
}
}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 StatusstatusStatusstatusstatusstatusstatusstatus: Inttegro.OrderStatus.Canceled"canceled""canceled""canceled"'canceled''canceled'Inttegro::Order::Status::CANCELEDInttegro.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 ExecuteRefundexecute_refundExecuteRefundexecuteRefundexecute_refundexecute_refundexecute_refundexecuteRefund: truetruetruetruetrueTruetruetrue. In that case, a negative balance transaction is created for the refund amount, reducing your available balance by the refunded sum.
Related resources
- Cancel an order — API reference with all parameters
- The order lifecycle — Understand which statuses allow cancellation
- Lookup an order — Verify the order status after cancellation