Update Order

PATCH/orders/{orderIdOrNumber}/update

The PATCH /orders/{orderIdOrNumber}/update endpoint updates an existing order's details, including status, fees, and taxes. It requires write access with x-fngs-public-key and x-fngs-secret-key. Updates are sent in JSON format.

Request Method: PATCH

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

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 this guide to generate your API key.

Path Parameters

The path parameter is required for the Update Order API endpoint and is used to specify the order that needs to be updated.

  • orderIdOrNumber (string) required: Identifies the specific order to update. This parameter accepts either the unique order ID (Option 1) or the order number (Option 2) to modify order details.

Request Body

The request body for the PATCH /orders/{orderIdOrNumber}/update endpoint allows updating specific attributes of an order.

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

  • value (number | null): Represents the monetary value of the order. Range: -1.7976931348623157e+308 <= x <= 1.7976931348623157e+308

  • fee (number | null): Indicates any applicable fees associated with the order. Range: -1.7976931348623157e+308 <= x <= 1.7976931348623157e+308

  • tax (number | null): Specifies the tax amount applied to the order. Range: -1.7976931348623157e+308 <= x <= 1.7976931348623157e+308

  • currency (enum | null): Defines the currency type associated with the order. The accepted values are ISO 4217 currency codes. 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).

Responses Body

Response (200) - Success

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

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

  2. data (object) required: The data object contains the details of the updated order. It includes the following children:

— data.order (object) required: This object holds the details of the order, including its ID, status, payment information, and associated customer details. It includes the following child attributes:

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

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

  • data.order.status (enum) required: 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 user identifier associated with the order.

  • data.order.orderNumber (string) required: The unique order number assigned to the transaction.

  • data.order.object (enum): Defines the object type. The default value is order. Available options: order

  • data.order.value (integer | null) default: 0: The total value of the order. Required range: -9007199254740991 ≤ x ≤ 9007199254740991

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

  • data.order.fee (integer | null) default: 0: The fee amount associated with the order. 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.

  • data.order.currency (enum | null): The currency in which the order is processed. 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): The number of decimal places used for the currency in the order. Required range: -9007199254740991 ≤ x ≤ 9007199254740991

  • data.order.user (object | null): This object contains details about the user associated with the order. It includes the following child attributes:

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

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

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

Response (400) - Error

  1. status (string) required: Represents the status of the response. The allowed value is an error.

  2. error (object) required: This object 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}/update \
  --header 'Content-Type: application/json' \
  --header 'x-fngs-public-key: <api-key>' \
  --header 'x-fngs-secret-key: <api-key>' \
  --data '{
  "status": "PENDING",
  "value": 0,
  "fee": 0,
  "tax": 0,
  "currency": "AFN"
}'
  1. Python

import requests

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

payload = {
    "status": "PENDING",
    "value": 0,
    "fee": 0,
    "tax": 0,
    "currency": "AFN"
}
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: '{"status":"PENDING","value":0,"fee":0,"tax":0,"currency":"AFN"}'
};

fetch('https://api.fungies.io/v0/orders/{orderIdOrNumber}/update', 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}/update",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_POSTFIELDS => "{\n  \"status\": \"PENDING\",\n  \"value\": 0,\n  \"fee\": 0,\n  \"tax\": 0,\n  \"currency\": \"AFN\"\n}",
  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}/update"

	payload := strings.NewReader("{\n  \"status\": \"PENDING\",\n  \"value\": 0,\n  \"fee\": 0,\n  \"tax\": 0,\n  \"currency\": \"AFN\"\n}")

	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}/update")
  .header("x-fngs-public-key", "<api-key>")
  .header("x-fngs-secret-key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"status\": \"PENDING\",\n  \"value\": 0,\n  \"fee\": 0,\n  \"tax\": 0,\n  \"currency\": \"AFN\"\n}")
  .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)

{
  "status": "error",
  "error": {
    "message": "Sample error message"
  }
}

Last updated