Void and Refund

When you need to return funds to a customer or cancel an operation, you have two options:

  • Refund: a refund allows you to cancel or undo a sale and return the charged amount to the customer.
  • Void: a void cancels an operation (such as an authorization or capture), before it has been finalized. The most common procedure is to void an authorization.

Voiding an Authorization

Voiding an authorization allows you to cancel an authorization that has not yet been captured, by using the original payment_id.

Let’s proceed to void an authorization. If you imported our Postman Collection, you can follow-along with the example by invoking the requests in the Void folder.

You void an authorization by invoking the Create a Void API:

    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();
  
    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 in the case where 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.

To refund the customer, make a request to the Create a Refund API:

    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();
  
    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 January 4, 2022