Voucher History
Returns voucher history for user
This endpoint will return voucher history and details for a user
const CryptoJS = require('crypto-js');
const decryptMerchantVouchers = async ({ encryptedVouchers, apiKey, apiSecret }) => {
// Create the same combined key used for encryption
const combinedKey = CryptoJS.SHA256(apiKey + apiSecret).toString();
// Decrypt using the combined key
const bytes = CryptoJS.AES.decrypt(encryptedVouchers, combinedKey);
const decryptedVouchers = bytes.toString(CryptoJS.enc.Utf8);
return decryptedVouchers;
}import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.MessageDigest;
import java.util.Base64;
public class VoucherDecryptor {
public static String decryptMerchantVouchers(String encryptedVouchers, String apiKey, String apiSecret) throws Exception {
// Create the combined key using SHA-256
String combined = apiKey + apiSecret;
MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
byte[] combinedKey = sha256.digest(combined.getBytes("UTF-8"));
// Decode the base64-encoded encrypted string
byte[] encryptedData = Base64.getDecoder().decode(encryptedVouchers);
// Extract IV (first 16 bytes) and ciphertext
byte[] iv = new byte[16];
byte[] ciphertext = new byte[encryptedData.length - 16];
System.arraycopy(encryptedData, 0, iv, 0, 16);
System.arraycopy(encryptedData, 16, ciphertext, 0, ciphertext.length);
// Set up AES cipher
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
SecretKeySpec keySpec = new SecretKeySpec(combinedKey, "AES");
IvParameterSpec ivSpec = new IvParameterSpec(iv);
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
// Decrypt the ciphertext
byte[] decryptedBytes = cipher.doFinal(ciphertext);
return new String(decryptedBytes, "UTF-8");
}
}
Get Status of Gift Card transaction
POST https://api.onramp.money/onramp/api/v2/whiteLabel/giftCard/voucherHistory
Request Body
Name
Type
Description
email*
String
Mail address of the user that created the order
orderId
Integer
Id associated with the transaction
name: Name of the gift-card
imageUrl: url of the image associated with the gift-card
vouchers: encrytped details of vouchers
Last updated