> For the complete documentation index, see [llms.txt](https://specs.govstack.global/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://specs.govstack.global/payments/8-service-apis/8.2-voucher-management-apis.md).

# 8.2 Voucher Management APIs

The first API in the section below is used to request for a voucher with a specific value, currency, and purpose. The server responds with a voucher number, serial number, and expiry date. The second call activates the pre-activated voucher. The third call processes voucher redemption, crediting the merchant if valid. The fourth APIs allow for voucher status checks.

### 8.2.1 VoucherPreActivation

#### a) VoucherPreActivation()

The VoucherPreActivation API is used by non-Payment Building Blocks in the GovStack Framework to request for a voucher to be used. This call reserves the voucher (for a period, which is to be implemented). This API requests a single voucher from the voucher server that can be used for a future redemption process. The caller sends an amount, a voucher group (depending on the use case), the currency, and the name of the calling GovStack Building Block. If the API call is successful, the Payment Building Block will respond with a voucher number, a voucher serial number, and an expiry date.

{% openapi src="/files/akKaWsoHkYroeiiaezPy" path="/vouchers" method="post" %}
[VoucherPreactivationRequest.yml](https://content.gitbook.com/content/xHCzUyMiFANDxPl3gSMn/blobs/5DAjkyEGbHIR2ib2AOI8/VoucherPreactivationRequest.yml)
{% endopenapi %}

**b) Create\_Vouchers\_Response()**

Description This is the API called by the Voucher Engine to return Voucher Details once vouchers have been created in the Voucher Engine.

{% openapi src="/files/kymL9dFqJRQwqj2ZbVnb" path="/voucher-details-return" method="post" %}
[VoucherCreationResponse.yml](https://content.gitbook.com/content/xHCzUyMiFANDxPl3gSMn/blobs/hCypOGDDDJDof6D3XKTf/VoucherCreationResponse.yml)
{% endopenapi %}

### 8.2.2 VoucherActivation <a href="#docs-internal-guid-53943e9f-7fff-ee8a-93a6-10bc57857bd7" id="docs-internal-guid-53943e9f-7fff-ee8a-93a6-10bc57857bd7"></a>

#### a) Voucher\_Activation()

The VoucherActivation API is used by non-Payments Building Blocks in the GovStack Framework to activate a pre-activated voucher. This second function call is intended to ensure that the voucher is only activated when it is disbursed. This API requests for the activation of a voucher when the caller sends the voucher number to be activated. If the API call is successful, the activation is confirmed, and the voucher can now be used by the beneficiary.

{% openapi src="/files/hNbVGyfbAq5Qp2treCMB" path="/vouchers" method="put" %}
[VoucherActivate.yml](https://content.gitbook.com/content/xHCzUyMiFANDxPl3gSMn/blobs/eEWF9MTBXOr65Nd87Fc8/VoucherActivate.yml)
{% endopenapi %}

For Batch voucher activation, the voucher activation APIS is used by calling Building Block to activate vouchers in bulk. This may be used for bulk social cash transfers where the recipients receive benefits by vouchers. The calling Building Block is responsible for generating the beneficiary file as well as dispensing the vouchers. The Payments Building Block is responsible for generating and redeeming the voucher codes. Both BBs will have had to have exchanged encryption keys during the implementation phase.

The file provided by the calling Building Block will typically contain a unique identifier, the amount of the voucher required, the currency of the voucher, and the voucher group. While the file format may vary, the recommended file format is an encrypted JSON file.

If the file is properly formatted, the Payments Building Block will respond with a file that contains the unique ID that was sent, the status, the voucher number, the voucher serial number, and the expiry date of the voucher. The response file will also be an encrypted file to ensure the appropriate security of the voucher number.

The calling building block will dispense the vouchers as needed using an appropriate delivery mechanism. The calling Building Block will also be responsible for any verification of the beneficiary during the redemption process. The description of the dispensing of the vouchers once the calling block has received it is outside the scope of the Payments Building Block.

**b) Voucher\_Activate\_Response()**

Description This is the response API called by the Voucher Engine to confirm the status of batch activation back to the calling BB.

{% openapi src="/files/gTJTFvsyMuUlN5puMwsg" path="/callback-url" method="post" %}
[VoucherActivateResponse.yml](https://content.gitbook.com/content/xHCzUyMiFANDxPl3gSMn/blobs/sdEtWfMvtR9cQElV5rYg/VoucherActivateResponse.yml)
{% endopenapi %}

### 8.2.3 VoucherRedemption <a href="#docs-internal-guid-df8c2024-7fff-e374-7456-23db45c11b57" id="docs-internal-guid-df8c2024-7fff-e374-7456-23db45c11b57"></a>

The VoucherRedemption API is used by non-Payment Building Blocks in the GovStack Framework to redeem a voucher. The calling Building Block will capture the voucher number and the voucher serial number from the merchant point. The external Building Block will also acquire the merchant name and payment details from the merchant registry. The calling Building Block will then send the voucher number, the voucher serial number, the merchant’s name, and payment details. The Payment Building Block will verify that the voucher has been activated and has not been used or blocked or canceled. If so, the Payment Building Block will then send a payment request to the funding agency/Financial Services Provider. The Payment Gateway of the Payments Building Block will facilitate the debit of the funding account, and the credit of the merchant as well as handle any intermediary fees. Once the payment has been successfully done the Payment Building Block will mark the voucher as consumed and notify the merchant (and beneficiary if possible).

{% openapi src="/files/GUlYJ2URXiIPyTpg7MNa" path="/vouchers" method="post" %}
[VoucherRedemption.yml](https://content.gitbook.com/content/xHCzUyMiFANDxPl3gSMn/blobs/rZcIndekG37qvvxVTBZN/VoucherRedemption.yml)
{% endopenapi %}

### 8.2.4 VoucherStatus <a href="#docs-internal-guid-14288f23-7fff-3b24-f10e-6fb6e3200147" id="docs-internal-guid-14288f23-7fff-3b24-f10e-6fb6e3200147"></a>

The VoucherStatus API is used by non-Payment Building Blocks in the GovStack Framework to check the status of a voucher. The calling Building Block will capture the voucher number and send it to the Payments Building Block to determine the status of a voucher. The Payments Building Block will respond with one of the statuses of Pre-Activated, Activated, Suspended, Blocked, or Not Existing.

{% openapi src="/files/0B9qQSLnxFgYZKwvlVfd" path="/vouchers/{serialNumber}" method="get" %}
[VoucherStatus.yml](https://content.gitbook.com/content/xHCzUyMiFANDxPl3gSMn/blobs/7t89zWEt8KImDWxj7P1z/VoucherStatus.yml)
{% endopenapi %}

### 8.2.5 VoucherCancellation <a href="#docs-internal-guid-ceb6fd44-7fff-a34f-207b-6fc5be1638fa" id="docs-internal-guid-ceb6fd44-7fff-a34f-207b-6fc5be1638fa"></a>

**Voucher\_Cancellation()**

Description This API will be called by the Source-BB to update the status of the voucher(s), in the case of cancellation, the status code 03 is sent to the relevant field of the instruction array.

The VoucherCancellation API is used by non-Payments Building Blocks in the GovStack Framework to cancel a voucher. The calling Building Block will capture the voucher number and send it to the Payments Building Block to cancel the voucher.

{% openapi src="/files/IUXMve3eLkypdGI3B2vz" path="/vouchers" method="post" %}
[VoucherCancellation.yml](https://content.gitbook.com/content/xHCzUyMiFANDxPl3gSMn/blobs/6zjVWFIFCCTjSfILpyHz/VoucherCancellation.yml)
{% endopenapi %}

***

**Voucher\_ Cancellation\_Response()**

Description Response API called by the Voucher Engine to confirm the cancellation of the voucher. The Payments Building Block will respond with a status of Cancelled, Already Cancelled, or Not Existing. The Voucher Cancellation will override the Blocked status and render the voucher permanently unusable.

{% openapi src="/files/eUVlXuWlhJvRaWpK2Spg" path="/vouchers/cancellation/confirmation" method="post" %}
[VoucherCancellationResponse.yml](https://content.gitbook.com/content/xHCzUyMiFANDxPl3gSMn/blobs/XfcZugQAg2bTJUet4kYu/VoucherCancellationResponse.yml)
{% endopenapi %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://specs.govstack.global/payments/8-service-apis/8.2-voucher-management-apis.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
