Fungies.io Help Center
  • 🙌Getting Started
  • Customize your online store
    • General Settings
    • Header
    • Footer
    • Add New Page
    • Add Page Section
    • Text Section
    • Image Section
    • Video Section
    • Gallery Section
    • Points Section
    • Slider Section
    • Recent Products Section
    • Custom Style
  • Add Subscription Product
  • Add Digital Downloads
  • Add Game Keys
  • Add Mobile Game Assets
  • Variants of the product
  • 🛠️Workspace Settings
    • Connect your Stripe account
    • Sandbox Mode
    • Team Management
  • 🧮Store Settings
    • Publish your store
    • Previewing The Store
    • Edit Explore / Search Page (Built-in)
    • Edit Product Page (Built-in)
      • Customize Review Categories
    • Set up Custom Domain
      • Migrating your domain to Cloudflare
  • Tax-inclusive Pricing
  • 🤑Getting Paid
    • Test Payments
    • Checkout Choice
      • Hosted Checkout
      • Overlay Checkout
      • Embedded Checkout
    • Global Availability
    • Customer Payment Methods
      • PayPal Settings
    • Billing Details
    • Payouts
    • Editing Statement Descriptor
    • Transactions Reports
    • Example React checkout
  • 👨‍💻FOR SAAS DEVELOPERS
    • Hosted Checkout (more payment methods)
    • Editing and Pausing Subscriptions
      • Downgrading / Upgrading Subscriptions
    • Creating Plans
    • Free Trials and Custom Intervals
    • Redirecting After Purchase
    • Using Webhooks
    • Types of Webhooks
      • Payment Success
      • Payment Refunded
      • Payment Failed
      • Subscription Created
      • Subscription Interval
      • Subscription Updated
      • Subscription Cancelled
    • Getting Started with the API
    • Orders APIs
      • Managing Orders through API
      • Orders List
      • Cancel Order
      • Update Order
    • Managing Subscriptions through API
    • Managing and Creating Users through API
    • Customizing Subscription Confirmation Page
    • Using CustomFields to parse data from your Software / App
      • Parse e-mails from your Software directly to checkout URL
  • Additional charges on top of Subscriptions
  • Upgrading or Downgrading Plans with API
  • Using Fungies.js npm package
    • Next.js 15 integration guide
  • 🎮For Game Developers
    • Orders
    • Platform Fees
    • Users list
    • Integrating with Game's Back-end
    • Customizing Purchase Confirmation Page
    • Webhooks
  • 💲Selling
    • Payment history
    • Selling FREE products
    • Managing Game Keys
    • Managing Game Assets
    • Pricing
    • Fulfillment of Orders
    • Prohibited Business and Products
    • Invoices and Receipts
    • Google Merchant Center XML Feed
    • SEO Sitemap
  • 🚀Marketing
    • Integrations
      • Google Tag Manager
      • Google Merchant Center
      • Trustpilot
      • Google Analytics (via Google Tag Manager)
    • SEO
    • Discount Codes
    • Pricing Localization
    • Language Localization
    • E-mail Marketing
  • 💰Billing
    • Plans and Usage
    • Invoices
    • Payment Methods
  • 🤩For End-Users
    • How to manage your Subscription?
    • How to buy a Game Key?
    • How to buy a Mobile Game Asset?
    • Getting your product
    • Steam key activation
    • Searching for games
    • Product details page
    • Order details
    • Refunds and chargebacks
  • 🗃️Other
    • FAQ
    • Roadmap
    • Product Changelog
  • 📃Legal
    • General Terms of Use
    • SaaS Terms of Use
    • Privacy Policy
    • Cookies and Tracking
Powered by GitBook
On this page
  • PATCH/orders/{orderIdOrNumber}/cancel
  • Path Parameters
  • Request Body
  • Responses Body
  • Example of Endpoint Usage
  • Example of a Successful Response (200)
  • Example of Error Response (400)
  1. FOR SAAS DEVELOPERS
  2. Orders APIs

Cancel Order

PreviousOrders ListNextUpdate Order

Last updated 2 months ago

PATCH/orders/{orderIdOrNumber}/cancel

The PATCH /orders/{orderIdOrNumber}/cancel endpoint is used to cancel a specific order by updating its status to CANCELLED. This endpoint is typically used when an order needs to be stopped before it is fulfilled or processed. Write access is required to use this endpoint.

Request Method: PATCH

Endpoint URL: https://api.fungies.io/v0/orders/{orderIdOrNumber}/cancel

Headers:

x-fngs-public-key: <api-key>

x-fngs-secret-key: <api-key>

Example:

Authorization: x-fngs-public-key: <api-key>
Authorization: x-fngs-secret-key: <api-key>

Note: This endpoint requires an API key for authentication. Refer to guide to generate your API key.

Path Parameters

The Path Parameters are required to specify the order that needs to be canceled.

  • orderIdOrNumber (string) required: Identifies the specific order to cancel. This parameter accepts either the unique order ID (Option 1) or the order number (Option 2) to process the cancellation request.

Request Body

The request body for the Cancel Order API is of type object. This body structure allows the system to process the order cancellation request, ensuring the specified order is updated accordingly.

Responses Body

Response (200) - Success

The response confirms that the order cancellation request was successfully processed.

  1. status (string) required: Indicates the outcome of the API request. The allowed value is success, confirming that the cancellation was applied.

  2. data (object) required: The data object contains details related to the canceled order. It includes the following children:

— data.order (object) required: This object holds the details of the order and other relevant information. It includes the following children:

  • data.order.id (string) required: A unique identifier assigned to the order.

  • data.order.number (string) required: The order number is used for reference and tracking.

  • data.order.status (enum) required: Represents the current status of the order. Available options: PENDING, PAID, FAILED, UNPAID, CANCELLED, REFUNDED, PARTIALLY_REFUNDED, EXPIRED.

  • data.order.createdAt (integer) required: The timestamp represents when the order was created. Required range: 0 <= x <= 9007199254740991

  • data.order.userId (string) required: The unique identifier of the user associated with the order.

  • data.order.orderNumber (string) required: The reference number assigned to the order for tracking purposes.

  • data.order.object (enum) default: order: Represents the type of object. Available options: order

  • data.order.value (integer | null) default: 0: Represents the monetary value of the order. Required range: -9007199254740991 <= x <= 9007199254740991

  • data.order.tax (integer | null) default: 0: The amount of tax applied to the order. Required range: -9007199254740991 <= x <= 9007199254740991

  • data.order.fee (integer | null) default: 0: The additional fee associated with the order, such as processing or service fees. Required range: -9007199254740991 <= x <= 9007199254740991

  • data.order.totalItems (integer | null) default: 0: The total number of items included in the order. Required range: 0 <= x <= 9007199254740991

  • data.order.country (string | null): The country associated with the order, typically where it was placed or where it will be delivered.

  • data.order.currency (enum | null): The currency used for the order transaction. Available options: AFN (Afghanistan), ALL (Albania), DZD (Algeria), AOA (Angola), ARS (Argentina), AMD (Armenia), AWG (Aruba), AUD (Australia), AZN (Azerbaijan), BSD (Bahamas), BDT (Bangladesh), BBD (Barbados), BZD (Belize), BMD (Bermuda), BOB (Bolivia), BAM (Bosnia and Herzegovina), BWP (Botswana), BRL (Brazil), BHD (Bahrain), GBP (United Kingdom), BND (Brunei), BGN (Bulgaria), BIF (Burundi), BYN (Belarus), KHR (Cambodia), CAD (Canada), CVE (Cape Verde), KYD (Cayman Islands), KWD (Kuwait), XAF (Central African CFA), XPF (CFP Franc), CLP (Chile), CNY (China), COP (Colombia), KMF (Comoros), CDF (Congo - Kinshasa), CRC (Costa Rica), HRK (Croatia), CZK (Czech Republic), DKK (Denmark), DJF (Djibouti), DOP (Dominican Republic), XCD (East Caribbean Dollar), EGP (Egypt), ETB (Ethiopia), EUR (Eurozone), FKP (Falkland Islands), FJD (Fiji), GMD (Gambia), GEL (Georgia), GIP (Gibraltar), GTQ (Guatemala), GNF (Guinea), GYD (Guyana), HTG (Haiti), HNL (Honduras), HKD (Hong Kong), HUF (Hungary), ISK (Iceland), INR (India), IDR (Indonesia), ILS (Israel), JMD (Jamaica), JPY (Japan), JOD (Jordan), KZT (Kazakhstan), KES (Kenya), KGS (Kyrgyzstan), LAK (Laos), LBP ( Lebanon), LSL (Lesotho), LRD (Liberia), MOP (Macau), MKD (North Macedonia), MGA (Madagascar), MWK (Malawi), MYR (Malaysia), MVR (Maldives), MRO (Mauritania), MUR (Mauritius), MXN (Mexico), MDL (Moldova), MNT (Mongolia), MAD (Morocco), MZN (Mozambique), MMK (Myanmar), NAD (Namibia), NPR (Nepal), ANG (Netherlands Antilles), TWD (Taiwan), NZD (New Zealand), NIO (Nicaragua), NGN (Nigeria), NOK (Norway), OMR (Oman), PKR (Pakistan), PAB (Panama), PGK (Papua New Guinea), PYG (Paraguay), PEN (Peru), PHP (Philippines), PLN (Poland), QAR (Qatar), RON (Romania), RUB (Russia), RWF (Rwanda), SHP (Saint Helena), SVC (El Salvador), WST (Samoa), STD (São Tomé and Príncipe), SAR (Saudi Arabia), RSD (Serbia), SCR (Seychelles), SLL (Sierra Leone), SGD (Singapore), SBD (Solomon Islands), SOS (Somalia), ZAR (South Africa), KRW (South Korea), LKR (Sri Lanka), SRD (Suriname), SZL (Eswatini), SEK (Sweden), CHF (Switzerland), TJS (Tajikistan), TZS ( Tanzania), THB( Thailand), TND (Tunisia), TOP (Tonga), TTD (Trinidad and Tobago), TRY (Turkey), UGX (Uganda), UAH (Ukraine), AED (United Arab Emirates), UYU (Uruguay), USD (United States), UZS (Uzbekistan), VUV (Vanuatu), VEF (Venezuela), VND (Vietnam), XOF (West African CFA), YER (Yemen), ZMW (Zambia), SLE (Sierra Leone).

  • data.order.currencyDecimals (integer | null): Specifies the number of decimal places used in the currency format for the order. Required range: -9007199254740991 <= x <= 9007199254740991

  • data.order.user (object | null): Contains user-related details associated with the order. It includes the following children:

    • data.order.user.id (string) required: A unique identifier is assigned to the user.

    • data.order.user.object (enum) default: user: Specifies the type of object. The available option is user

    • data.order.user.username (string | null): The username of the user associated with the order.

Response (400) - Error

  1. status (string) required: Represents the outcome of the API request. The allowed value is an error, indicating that the request was unsuccessful.

  2. error (object) required: Contains details about the error encountered during the request. It includes the following child attributes:

    1. error.message (string) required: A descriptive message explaining the reason for the error.

Example of Endpoint Usage

Examples of how to use the endpoint across different programming languages.

  1. cURL

curl --request PATCH \
  --url https://api.fungies.io/v0/orders/{orderIdOrNumber}/cancel \
  --header 'Content-Type: application/json' \
  --header 'x-fngs-public-key: <api-key>' \
  --header 'x-fngs-secret-key: <api-key>' \
  --data '{}'
  1. Python

import requests

url = "https://api.fungies.io/v0/orders/{orderIdOrNumber}/cancel"

payload = {}
headers = {
    "x-fngs-public-key": "<api-key>",
    "x-fngs-secret-key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.request("PATCH", url, json=payload, headers=headers)

print(response.text)
  1. JavaScript

const options = {
  method: 'PATCH',
  headers: {
    'x-fngs-public-key': '<api-key>',
    'x-fngs-secret-key': '<api-key>',
    'Content-Type': 'application/json'
  },
  body: '{}'
};

fetch('https://api.fungies.io/v0/orders/{orderIdOrNumber}/cancel', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
  1. PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.fungies.io/v0/orders/{orderIdOrNumber}/cancel",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_POSTFIELDS => "{}",
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json",
    "x-fngs-public-key: <api-key>",
    "x-fngs-secret-key: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
  1. Go

package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.fungies.io/v0/orders/{orderIdOrNumber}/cancel"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("x-fngs-public-key", "<api-key>")
	req.Header.Add("x-fngs-secret-key", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
  1. Java

HttpResponse<String> response = Unirest.patch("https://api.fungies.io/v0/orders/{orderIdOrNumber}/cancel")
  .header("x-fngs-public-key", "<api-key>")
  .header("x-fngs-secret-key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();

Example of a Successful Response (200)

200 OK – The list of orders is successfully retrieved.

{
  "status": "<string>",
  "data": {
    "order": {
      "object": "order",
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "number": "<string>",
      "status": "PENDING",
      "value": 0,
      "tax": 0,
      "fee": 0,
      "totalItems": 0,
      "country": null,
      "currency": null,
      "currencyDecimals": null,
      "createdAt": 4503599627370495,
      "userId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "user": null,
      "orderNumber": "<string>"
    }
  }
}

Example of Error Response (400)

400 Bad Request – Invalid query parameters.

{
  "status": "error",
  "error": {
    "message": "Sample error message"
  }
}
👨‍💻
this