hash_key field. Use your merchant app_secret as the HMAC-SHA256 key. Join the request values with | in this order: sum_of_amount_column|first_row_iban|first_row_amount|first_row_currency|first_row_gsm. Sign the values exactly as sent. Keep an empty position for a signed field that may be empty. The pipe character is reserved for separating signed values. Sipay sums all row amounts. Format that sum with exactly two decimal places. Sign the first row values as sent, including the leading + in its GSM number when present.#!/usr/bin/env bash
set -euo pipefail
# Example values. Load your merchant app_secret on your server.
# Format the sum of all row amounts with two decimal places. Use the first row values as sent.
parts=(
"100.00" # sum_of_amount_column
"TR000000000000000000000000" # first_row_iban
"100.00" # first_row_amount
"TRY" # first_row_currency
"+905550000000" # first_row_gsm
)
app_secret="example_app_secret"
message=$(IFS='|'; printf '%s' "${parts[*]}")
printf '%s' "$message" | openssl dgst -sha256 -hmac "$app_secret" -r | awk '{print $1}'
{
"app_id": "xxx",
"app_secret": "xxx",
"merchant_key": "xxx",
"pf_id": 39048,
"name": "John Doe",
"vkn": 7483494730,
"tckn": 83593451321,
"city": "Istanbul",
"address": "Sokak ABC, Istanbul, Turkey",
"iso_country_code": 742,
"post_code": 48400,
"site_url": "https://site.com",
"hash_key": "xx:xx=="
}