Add

This method will add a new pf record for a specific merchant. The merchant has to be authorized to initiate the request with a unique merchant key. Also every request has to provide unique pf id which can be used later to initiate a payment. If pf id is already registered in the system, the registration procedure will be terminated. The function mentioned below should be used to generate the proper hash to go with the request.

Method URL Content-Type
POST Test: https://provisioning.sipay.com.tr/ccpayment/api/addSubMerchantPF application/json
POST Production: https://app.sipay.com.tr/ccpayment/api/addSubMerchantPF application/json


Parameters Values Condition
Header/Authorization Bearer/string Mandatory
merchant_key string Mandatory
pf_id digits:5 Mandatory
name string Mandatory
vkn digits:10 Mandatory
tckn digits:11 Mandatory
city string Mandatory
address string Mandatory
iso_country_code digits:3 Mandatory
post_code digits:5 Mandatory
site_url url Mandatory
hash_key string Mandatory


Authorization

Authorization is a header key which defines verification that the connection attempt is allowed. The method should be “Bearer”

hash_key

function generateSubMerchantPFHashKey($merchant_key, $pf_id, $app_secret) {
    $data = $merchant_key.'|'.$pf_id;
    $iv = substr(sha1(mt_rand()), 0, 16);
    $password = sha1($app_secret);
    $salt = substr(sha1(mt_rand()), 0, 4);
    $saltWithPassword = hash('sha256', $password . $salt);
    $encrypted = openssl_encrypt(
        "$data", 'aes-256-cbc', "$saltWithPassword", null, $iv
    );
    $msg_encrypted_bundle = "$iv:$salt:$encrypted";
    $hash_key = str_replace('/', '__', $msg_encrypted_bundle);

    return $hash_key;
}

Request

{
    "merchant_key" : "$2y$10$w/ODdbTmfubcbUCUq/ia3OoJFMUmkM1UVNBiIQIuLfUlPmaLUT1he",
    "pf_id": "10299",
    "hash_key":"944357f199c09d70:1481:6ssfvYiTGF2iU3fYFI5F3A==",
    "name": "Bruce Wayne",
    "vkn":"0845486082",
    "tckn":"67890456734",
    "city":"Istanbul",
    "address": "Altunizade, Kuşbakışı Cd. No17/2, 34662 Üsküdar/İstanbul, Turkey",
    "iso_country_code" : "792",
    "post_code": "34107",
    "site_url" : "https://wayne.enterprise.com"
}

Fail Response

{
    "status_code": 30,
    "status_description": "An entry with this pf id 10294 is already exist but inactive. Please contact support.",
    "data": {
        "id": 35,
        "merchant_id": 98950,
        "pf_id": "10294",
        "name": "Bruce Wayne",
        "vkn": "0845486082",
        "tckn": "67890456734",
        "post_code": "34107",
        "city": "Istanbul",
        "address": "Altunizade, Kuşbakışı Cd. No17/2, 34662 Üsküdar/İstanbul, Turkey",
        "iso_country_code": "792",
        "url": "https://wayne.enterprise.com",
        "status": 0,
        "source": 3,
        "created_at": "2021-10-01T14:24:11.000000Z",
        "updated_at": "2021-10-01T14:24:11.000000Z"
    }
}

Success Response

Successful
{
    "status_code": 100,
    "status_description": "PF records is successfully added. To activate the pf record please contact support.",
    "data": {
        "merchant_id": 98950,
        "pf_id": "10299",
        "name": "Bruce Wayne",
        "vkn": "0845486082",
        "tckn": "67890456734",
          "city": "Istanbul",
        "address": "Altunizade, Kuşbakışı Cd. No17/2, 34662 Üsküdar/İstanbul, Turkey",
        "iso_country_code": "792",
        "post_code": "34107",
        "url": "https://wayne.enterprise.com",
        "status": 0,
        "source": 3,
        "updated_at": "2021-10-01T14:26:52.000000Z",
        "created_at": "2021-10-01T14:26:52.000000Z",
        "id": 36
    }
}