confirm_payment endpoint is used to confirm the payment.confirm endpoint must be triggered when the payment_completed_by parameter is sent to the merchant.The parameters and their order to be used for the hash algorithmare as follows.merchant_key invoice_id status app_secret
#!/usr/bin/env bash
generate_hash_key() {
local merchant_key="$1"
local invoice_id="$2"
local status="$3"
local app_secret="$4"
local data="${merchant_key}|${invoice_id}|${status}"
local iv
iv=$(openssl rand -hex 16 | openssl sha1 | awk '{print $2}' | cut -c1-16)
local password
password=$(printf "%s" "$app_secret" | openssl sha1 | awk '{print $2}')
local salt
salt=$(openssl rand -hex 16 | openssl sha1 | awk '{print $2}' | cut -c1-4)
local salt_with_password
salt_with_password=$(printf "%s" "${password}${salt}" | openssl sha256 | awk '{print $2}' | cut -c1-32)
local key_hex
key_hex=$(printf "%s" "$salt_with_password" | xxd -p -c 256)
local iv_hex
iv_hex=$(printf "%s" "$iv" | xxd -p -c 256)
local encrypted_base64
encrypted_base64=$(printf "%s" "$data" | openssl enc -aes-256-cbc -K "$key_hex" -iv "$iv_hex" -base64)
local msg="${iv}:${salt}:${encrypted_base64}"
msg="${msg//\//__}"
echo "$msg"
}
merchant_key="test_merchant_123"
invoice_id="INV-2026-0001"
status="1"
app_secret="my_secret_key_456"
result=$(generate_hash_key "$merchant_key" "$invoice_id" "$status" "$app_secret")
echo "Hash Key: $result"{
"status_code": 100,
"status_description": "The transaction has been Approved",
"transaction_status": "Completed",
"order_id": "VP17697652077026116",
"invoice_id": "VUONVW35PWK2TDY-1769765203"
}