Flexepin Merchant API

Everything you need to accept Flexepin vouchers: validate a PIN, redeem it, and handle the responses correctly.

1. What Flexepin Is

The Flexepin voucher is essentially a 16-digit code (the "PIN") that a customer enters at the merchant's checkout to deposit funds, or pay for a product or service. Each PIN is unique, single-use, and has its own fixed monetary value. Once a voucher is redeemed, the transaction is final and cannot be reversed.

A voucher's PIN can reach you one of two ways:

2. General Info

Environments

EnvironmentBase URL
Testhttps://testrest.flexepin.com
Productionhttps://rest.flexepin.com

Credentials

The API key & secret, and Back Office (Merchant Portal) credentials, are provided by the Flexepin support team.

Important

Use your API Key as your Terminal ID as well. They are the same value — there is no separate, distinct Terminal ID to obtain.

The production credentials will be shared after the integration has been completed and a commercial agreement has been put in place.

Support

If you need your credentials reset or for any other help, contact support@flexepin.com.

3. Integration at a Glance

1
User submits their Flexepin voucher PIN into a field on your checkout and accepts the Flexepin Terms & Conditions.
2
You call the Validate API to check the voucher's status. Optional, but most merchants use it.
3
You call the Redeem API to finalise the transaction and unlock the funds.

4. Try It Live

Before writing any code, you can generate real test vouchers and submit them for validation and redemption through the interactive demo site — it shows you the actual request and response for every API call.

https://demo.staging.flexepin.com/

Prefer to test in Postman?

Download the collection below and import it — it includes Validate, Redeem, and the transaction lookup requests, all with the HMAC signature computed for you automatically before each send. Just set your API Key, Merchant Secret, and a test PIN in the collection's Variables tab.

⬇ flexepin_merchant_api.postman_collection.json

5. Validate & Redeem APIs, Side by Side

ValidateRedeem
MethodGETPUT
Changes anything?NoYes — marks the voucher as Used, transaction is final
Request bodyNever — GET has no bodyOptional — customer_id / customer_ip / customer_ip_data
Mandatory step?No — explicitly optionalYes — this is what completes the payment
Safe to retry?YesNo — can only succeed once

Confirmed: reusing the same current_transaction_id on repeated Validate calls does not cause any issue and does not affect redemption.

Validate — response example

See Section 7 for a complete, runnable Validate request.

{
  "result": "0",
  "result_description": "Success",
  "serial": "54040500000303719",
  "currency": "EUR",
  "description": "Flexepin EUR 100",
  "value": 100
}

Redeem — response example

See Section 7 for a complete, runnable Redeem request.

{
  "result": "0",
  "result_description": "Success",
  "transaction_id": "..."
}

6. Authentication (HMAC)

Every request must prove it genuinely came from you, but without ever sending your secret key over the network. Instead, each request carries a one-time "signature" — built from the request itself plus your secret key — that Flexepin recalculates on their end to confirm it matches. This applies to both the Validate and Redeem calls you just saw above.

The header

AUTHENTICATION: HMAC [api_key]:[signature]:[nonce]

Building the signature

Concatenate these four items with a newline (\n) between each, then compute a SHA-256 HMAC of the result, keyed with your Merchant Secret:

Request Method
URI Endpoint
nonce
Request body

If there's no body, leave it empty — but the newline before it must still be there.

Easy to mix up

The nonce (in the auth header) and the current_transaction_id (in the URL) are two separate values that both need to be unique per request — but they do different jobs. The nonce only affects the signature. Generate a unique one every time.

Worked example

This is a signed Redeem request, using the URL shape from Section 5:

MethodPUT
URI/voucher/redeem/1938475602918475/MERCHANTTESTKEY/58291
Nonce1735689421983
Body{ "customer_ip": "203.0.113.42", "customer_ip_data": {...} }
Merchant SecretTr7!qXpL9$mWzKv2 (placeholder test value — not a real credential)
✅ Verified against a real redemption on the test environment — not just recalculated on paper.
🔑 Try it yourself — live signature calculator

Pre-filled with the worked example above — click Compute and confirm it produces the same signature. Then try your own Method / URI / Nonce / Body. The Merchant Secret field is fixed to a test-only value and can't be edited — this tool is for checking your code's logic, not for use with your real secret.

Body is optional. Leave it empty for Validate (it never has one), or for Redeem if you're not sending fraud/risk data — just make sure whatever you actually send matches exactly what you sign here, including if that means leaving it blank.
Tr7!qXpL9$mWzKv2  (fixed test value — not editable)
Payload that gets signed
Computed signature
Compare against your own code's output

7. Starter Code

Complete, working functions for Validate and Redeem — not a template with a gap where the signature should go. Swap in your real PIN, API Key, and Merchant Secret before using it.

8. Flexepin Voucher Currencies & Types

The various Flexepin currencies fall into two types.

Voucher TypeCurrency
Closed LoopEUR, GBP, PLN, CHF
Open LoopCAD, USD, NZD, ZAR

Note: If you are not sure which currencies you should implement — confirm this with your team. Implementing EUR and CAD covers all scenarios from a technical point of view.

Voucher handling as per Voucher type

Closed Loop:

When EUR, GBP, PLN & CHF vouchers are submitted to the Validate API they come back as having the 'Quarantine' status — this is expected, not an error, proceed to redemption.

When a closed loop voucher is submitted to the Redeem API, it is automatically swapped in the background (by the Flexepin system) for an equivalent Active status voucher, and that one is redeemed toward the merchant instead. The redeemed voucher takes on the status of 'Used'.

What changes in the API response

Your original transaction ID is preserved, but the Serial number, Description, and EAN fields will reflect the new, swapped-to voucher. No action is required on your end — this happens automatically on Flexepin's side.

Open Loop:

When CAD, USD, NZD, ZAR vouchers are submitted to the Validate API they come back as having the 'Active' status — proceed to redemption.

When an open loop voucher is submitted to the Redeem API, the same voucher is redeemed towards the merchant and takes on the status of 'Used'.

9. Result Codes

Success / still valid

HTTPCodeMeaning
2000Success — voucher is Active, or transaction succeeded
20010251Quarantine — valid and fully redeemable, not an error. Applies to EUR, GBP, PLN and CHF (Closed Loop) Flexepin vouchers.

Errors

HTTPCodeMeaningCommonly caused by
20032No voucher stockThere is no stock available for a voucher product allocated to the merchant profile. This error is very rare. If it occurs, it is most likely when the merchant profile is first set up and its products are created. This is on the Flexepin side — please contact Flexepin support.
200503Maintenance modeScheduled downtime — retry later
2004019Voucher type/value not acceptedThe merchant has not been configured for this currency or denomination. Nothing has gone wrong on either side: the end user tried to redeem a voucher that isn't compatible with the merchant's account, for example a CAD voucher at a merchant that only accepts EUR.
2004071Voucher is lockedFlexpay only: the merchant has not yet responded to the webhook that delivered the voucher details with a success result (resultCode: 0).
2004072Voucher already usedVoucher has already been used.
2004073Voucher not activeThe merchant profile has not been set up to accept the specific voucher product that the end user tried to redeem. This error is rare and indicates a misconfiguration in the Flexepin system.
2004074Voucher expiredThe voucher is older than 12 months.
2004075Invalid voucher PINInvalid voucher PIN supplied.
2004080Voucher value insufficient—
403403Not authorised to access this resourceInvalid credentials or HMAC authentication. Use the HMAC signature calculator in Section 6 to check your signature logic.
401401Invalid Terminal IDThe merchant's API key was not used in the Terminal ID field. The Terminal ID is the same value as the API key.

10. Flexepin Terms & Conditions Acceptance by the User

Required on any screen where a customer enters or submits a Flexepin PIN:

Live example

Reference implementation

<div class="flexepin-tc">
  <input type="checkbox" id="tcdemo">
  <label for="tcdemo">
    I agree to the <a href="https://www.flexepin.com/flexepin-terms-and-conditions-eea/" target="_blank">Flexepin Terms &amp; Conditions</a>
  </label>
</div>

11. Reference Appendix

All endpoints

MethodPathPurpose
GET/statusCheck API is online
GET/voucher/validate/{pin}/{terminal_id}/{current_transaction_id}Check voucher status
PUT/voucher/redeem/{pin}/{terminal_id}/{current_transaction_id}Finalise redemption
GET/trans/trans_no/{trans_no}/{terminal_id}/{current_transaction_id}Look up a transaction by Flexepin trans_no
GET/trans/trans_id/{past_transaction_id}/{terminal_id}/{current_transaction_id}Look up a transaction by your own merchant transaction ID
GET/trans/between/{from_date}/{to_date}/{terminal_id}/{current_transaction_id}Look up transactions in a date range (yyyy-mm-dd)

Common parameters

ParameterTypeNotes
pinstringThe Flexepin 16-digit PIN
terminal_idstringSame as your API Key — see "General Info"
current_transaction_idstringUnique per request, max 32 characters — used for duplicate detection