Skip to main content

Documentación

Update an Order

Change or modify an order.

You can make the following changes:

  • When status is created: coupon, metadata or tax_percent fields.

  • When status is pending, paid, or fulfilled: metadata or status fields.

When the customer completes a payment, the merchant must change the status from pending to paid.

This method triggers the Order Updated Webhook. This webhook contains the same information as the response.

    • order

    • ID of the order.

Code Samples
    • .NET

      • using System;
        using System.Text.Json;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        string order = "order_20bdf9df5841e57ba80e0a68085871ea";
        
                        var metadata = new
                        {
                            merchant_defined = true
                        };
        
                        var requestObj = new
                        {
                            metadata,
                            tax_percent = 13.5,
                        };
        
                        string request = JsonSerializer.Serialize(requestObj);
        
                        string result = RapydApiRequestSample.Utilities.MakeRequest("POST", $"/v1/orders/{order}", request);
        
                        Console.WriteLine(result);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error completing request: " + e.Message);
                    }
                }
            }
        }
        
    • JavaScript

      • const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;
        
        async function main() {
          try {
            const body = {
              metadata: {
                number: 1
              }
            };
            const result = await makeRequest(
              'POST',
              '/v1/orders/order_20bdf9df5841e57ba80e0a68085871ea',
              body
            );
        
            console.log(result);
          } catch (error) {
            console.error('Error completing request', error);
          }
        }
        
    • PHP

      • <?php
        $path = $_SERVER['DOCUMENT_ROOT'];
        $path .= "/<path-to-your-utility-file>/utilities.php";
        include($path);
        
        $body = [
            "tax_percent" => 13.5
        ];
        
        try {
            $object = make_request('post', '/v1/orders/order_20bdf9df5841e57ba80e0a68085871ea', $body);
            var_dump($object);
        } catch(Exception $e) {
            echo "Error: $e";
        }
        ?>
    • Python

      • from pprint import pprint
        
        from utilities import make_request
        
        order = {
            "metadata": {
                "merchant_defined": True
            },
            "tax_percent": 13.5
        }
        result = make_request(method='post', path='/v1/orders/order_20bdf9df5841e57ba80e0a68085871ea', body=order)
        pprint(result)
        
  • /v1/orders/:order

  • Tax Percent

  • curl -X post 'https://sandboxapi.rapyd.net/v1/orders/order_87b78d2923633ab410654749e8817895' \
    -H 'access_key: your-access-key-here' \
    -H 'Content-Type: application/json' \
    -H 'idempotency: your-idempotency-parameter-here' \
    -H 'salt: your-random-string-here' \
    -H 'signature: your-calculated-signature-here' \
    -H 'timestamp: your-unix-timestamp-here' \
    --data-raw '{
        "tax_percent": 11.5
    }'
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "969eb097-1428-41fb-bbdf-f77228c5ff11"
        },
        "data": {
            "id": "order_87b78d2923633ab410654749e8817895",
            "amount": 410,
            "amount_returned": 0,
            "payment": null,
            "created": 1763477605,
            "customer": "cus_4e25112ac20e144ad073a614dc46934b",
            "currency": "USD",
            "email": "johndoe@rapyd.net",
            "external_coupon_code": "",
            "items": [
                {
                    "amount": 200,
                    "currency": "USD",
                    "description": "Deluxe Gamer's Chair",
                    "parent": "sku_6eb43887fd478baaf9223ec7ec17da21",
                    "quantity": 2,
                    "type": "sku"
                },
                {
                    "amount": 10,
                    "currency": "USD",
                    "description": "Shipping",
                    "parent": "",
                    "quantity": 1,
                    "type": "shipping"
                },
                {
                    "amount": 47.15,
                    "currency": "USD",
                    "description": "11.5% tax on total order",
                    "parent": "",
                    "quantity": 0,
                    "type": "tax"
                }
            ],
            "metadata": {},
            "returns": [],
            "shipping_address": {
                "id": "address_a2472851af98bf84b818e4ffdfed6b01",
                "name": "John Doe",
                "line_1": "123 First Street",
                "line_2": "",
                "line_3": "",
                "city": "Anytown",
                "state": "NY",
                "country": "US",
                "zip": "12345",
                "phone_number": "12125559999",
                "metadata": {},
                "canton": "",
                "district": "",
                "created_at": 1763477606
            },
            "status": "created",
            "status_transitions": {
                "canceled": 0,
                "fulfilled": 0,
                "paid": 0,
                "returned": 0,
                "pending": 0,
                "partial": 0
            },
            "updated": 1763477992,
            "upstream_id": "2025-11-18a",
            "tax_percent": 11.5
        }
    }
  • Status

  • curl -X post  -H 'access_key: your-access-key-here' \
    -H 'Content-Type: application/json' \
    -H 'idempotency: your-idempotency-parameter-here' \
    -H 'salt: your-random-string-here' \
    -H 'signature: your-calculated-signature-here' \
    -H 'timestamp: your-unix-timestamp-here' \
    --data-raw '{
    	"status": "partial"
    }'
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "cdac3445-3568-45bb-89bf-cd616d74482c"
        },
        "data": {
            "id": "order_87b78d2923633ab410654749e8817895",
            "amount": 410,
            "amount_returned": 0,
            "payment": null,
            "created": 1763477605,
            "customer": "cus_4e25112ac20e144ad073a614dc46934b",
            "currency": "USD",
            "email": "johndoe@rapyd.net",
            "external_coupon_code": "",
            "items": [
                {
                    "amount": 200,
                    "currency": "USD",
                    "description": "Deluxe Gamer's Chair",
                    "parent": "sku_6eb43887fd478baaf9223ec7ec17da21",
                    "quantity": 2,
                    "type": "sku"
                },
                {
                    "amount": 10,
                    "currency": "USD",
                    "description": "Shipping",
                    "parent": "",
                    "quantity": 1,
                    "type": "shipping"
                },
                {
                    "amount": 47.15,
                    "currency": "USD",
                    "description": "11.5% tax on total order",
                    "parent": "",
                    "quantity": 0,
                    "type": "tax"
                }
            ],
            "metadata": {},
            "returns": [],
            "shipping_address": {
                "id": "address_a2472851af98bf84b818e4ffdfed6b01",
                "name": "John Doe",
                "line_1": "123 First Street",
                "line_2": "",
                "line_3": "",
                "city": "Anytown",
                "state": "NY",
                "country": "US",
                "zip": "12345",
                "phone_number": "12125559999",
                "metadata": {},
                "canton": "",
                "district": "",
                "created_at": 1763477606
            },
            "status": "partial",
            "status_transitions": {
                "canceled": 0,
                "fulfilled": 0,
                "paid": 0,
                "returned": 0,
                "pending": 0,
                "partial": 0
            },
            "updated": 1763478219,
            "upstream_id": "2025-11-18a",
            "tax_percent": 11.5
        }
    }