# Void Authorization

For credit cards and some alternative payment methods, the payment is completed in two steps:

  1. Authorization – The payment details of the shopper are verified, and the funds are reserved.
  2. Capture – The reserved funds are transferred from the shopper to your account.

When the payment has been authorised but not yet captured, you can cancel the authorisation hold on the payment.

You can utilize the authorization ID to void or cancel an authorization. It's important to note that you cannot void a fully captured authorization.

TIP

Cancelling a payment can either be done in the Merchant Dashboard or using the folloing API request.


    Request example
    • Shell
    • JavaScript
    curl -X POST \
     https://api.ompay.com/v1/merchants/w3z8dfhkzvfq0j9n/payment/W94Q5D31NWIRD90XYUI8/void \
      -H 'authorization: Basic ODZidWQ0Y2JremlxOXZmYzoweHI1ZDkwOHo2bmo4a2h6' \
      -H 'content-type: application/json' \
      -d '{
          "invoice_number":"123456",	
          "custom":{
            "field1":"field1"
          }
        }'
    
    
    Response example
    {
        "id": "95QU067XJ5N3VBH1D82C",
        "reference_id": "U1Y04VFRJ2V0W7XKJ6D8",
        "state": "voided",
        "result": {
            "code": "0000"
        },
        "transaction": {
            "amount": {
                "currency": "USD",
                "total": "300"
            },
            "mode": "1",
            "items": [
                {
                    "sku": "100299S",
                    "name": "Ultrawatch",
                    "description": "Smart watch",
                    "quantity": "1",
                    "price": "500.0000",
                    "shipping": "",
                    "url": "",
                    "tangible": false
                },
                {
                    "sku": "100269S",
                    "name": "Drone",
                    "description": "drone x",
                    "quantity": "1",
                    "price": "500.0000",
                    "shipping": "",
                    "url": "",
                    "tangible": false
                }
            ],
            "invoice_number": "12345"
        },
        "custom": {
            "field8": "::1",
            "field9": "Test Capture",
            "field10": "2"
        },
        "create_time": "2020-07-28T18:15:00Z"
    }
    

    # Request

    # Header parameters

    The request require a Basic authentication in the header. For more information about HTTP request headers, see HTTP request headers.

    # Request parameters

    Parameter Type Description
    merchant_id required string Encrypted Merchant account identifier for the Merchant
    reference_id required string Id of the initial transaction, usually this correspond to the authorisation ID.