Void and Refund

When you need to return funds or cancel an operation, you can refund a completed transaction or void one that hasn’t been finalized yet.

Voiding an Authorization

Voiding an authorization allows you to cancel an authorization that has not yet been captured, by using the original payment_id. If you imported our Postman Collection, you can follow-along with the example by invoking the requests in the Void folder.

Void an authorization by calling the Create a Void endpoint:

Copy
    var request = new XMLHttpRequest();
    request.open('POST', 'https://api.paymentsos.com/payments/{payment_id}/voids');
    request.setRequestHeader('Content-Type', 'application/json');
    request.setRequestHeader('api-version', '1.3.0');
    request.setRequestHeader('x-payments-os-env', 'test');
    request.setRequestHeader('app-id', 'com.zooz.docapp');
    request.setRequestHeader('private-key', '0047c4ef-f658-4e6d-a040-5882e2285f34');
    request.setRequestHeader('idempotency-key', 'cust-34532-trans-001356-c');
    request.send();
  
Copy
    curl --compressed -X POST \
      https://api.paymentsos.com/payments/{payment_id}/voids \
      -H 'Content-Type: application/json' \
      -H 'api-version: 1.3.0' \
      -H 'x-payments-os-env: test' \
      -H 'app-id: com.zooz.docapp' \
      -H 'private-key: bede7ee5-eaaq-4c9a-bc1f-617ba28256ae' \
      -H 'idempotency-key: cust-34532-trans-001356-p' \  
      -d {}
  

Refunding the Customer

Refunds should be used when a payment has already been captured and settled.

Let’s proceed to create a refund. If you imported our Postman Collection, you can follow-along with the example by invoking the requests in the Refund folder.

Refund the customer by calling the Create a Refund endpoint:

Copy
    var request = new XMLHttpRequest();
    request.open('POST', 'https://api.paymentsos.com/payments/{payment_id}/refunds');
    request.setRequestHeader('Content-Type', 'application/json');
    request.setRequestHeader('api-version', '1.3.0');
    request.setRequestHeader('x-payments-os-env', 'test');
    request.setRequestHeader('app-id', 'com.zooz.docapp');
    request.setRequestHeader('private-key', '0047c4ef-f658-4e6d-a040-5882e2285f34');
    request.setRequestHeader('idempotency-key', 'cust-34532-trans-001356-c');
    request.send();
  
Copy
    curl --compressed -X POST \
      https://api.paymentsos.com/payments/{payment_id}/refunds \
      -H 'Content-Type: application/json' \
      -H 'api-version: 1.3.0' \
      -H 'x-payments-os-env: test' \
      -H 'app-id: com.zooz.docapp' \
      -H 'private-key: bede7ee5-eaaq-4c9a-bc1f-617ba28256ae' \
      -H 'idempotency-key: cust-34532-trans-001356-p' \  
      -d {}
  
Last modified July 17, 2025