### PayGaranti API Documentation

###

Deposit forms
Deposit with PayGaranti

PayGaranti investment process is as follows:

1. Customer enters the PayGaranti investment form on the merchant site.
2. Click on the “Start Processing” button and customer will be redirected to the following link:
   https://pay.garantipay.net/?sid=__SITE_KEY__&trx=__TRANSACTION_ID__&name=NAME_OF_CLIENT&middle_name=MIDDLE_NAME_OF_CLIENT&surname=SURNAME_OF_CLIENTplayer_id=ID_OF_CLIENT
3. The rest of the actions is done from PayGaranti website.
4. All GET parameters that can be used in this method are listed in the table below.

GET params:

Parameter | Necessity | Description
--- | --- | ---
sid | required | Site-specific by PayGaranti.
trx | required | The ID of the transaction in the Merchant system.
name | required | The Name of the client in the Merchant system.
middle_name | required | The Middle name of the client in the Merchant system.
surname | required | The Surname name of the client in the Merchant system.
player_id | required | The ID of the client in the Merchant system.

Callback Return API Services (Deposits)

Callback services we will use.

The services described under this heading must be added to the Merchant's service provider's system for the PayGaranti system to work.

PayGaranti will use these services to send callbacks to the service provider's system..

The IP address that the service provider should whitelist: 95.216.1.207

PayGaranti → Site Provider

POST: https://yoursystem.com/api/superhavale/

Header information:

Title | Value
--- | ---
Accept | application/json
Content-Type | application/json

Request params:

Parameter | Necessity | Type | Description
--- | --- | --- | ---
sid | required | string | Site-specific by PayGaranti
key | required | string | Site-specific by PayGaranti
amount | required | string | Deposit amount.
currency | required | string | Sent as a “TRY”.
transaction_id | required | string | Transaction ID on PayGaranti system.
status | required | number | It is sent as 1 or 2 depending on the transaction result. 1 : successfully completed 2 : failed
trx | required | string | At the beginning of the investment process, if you have sent this parameter to the customer while directing it to the PayGaranti page, we will pass back the data contained in this parameter when you callback to the info service.
hash | required | string | What you need calculate "hash" sid key amount transaction_id trx There is an API Secret Key. That’s our Private Key for creating hash value. (Note: We are using HMAC-SHA256 standard while creating hash value.) sid|key|amount|transaction_id|trx we need using this is string for building hmac with private key(API Secret Key) and finally convert to it base64 Nodejs: const crypto = require('crypto'); const secretData = `${data.sid}${data.key}${data.amount}${data.transaction_id}${data.trx}` const hmac = crypto.createHmac('sha256', data.key).update(Buffer.from(secretData, 'utf-8')).digest("hex"); let hash = Buffer.from(hmac).toString('base64')

Response params:

Parameter | Type | Description
--- | --- | ---
state | boolean | Status code.
message | string | Status message.

##### Example:

POST: https://yoursystem.com/api/superhavale/

Accept: application/json
Content-Type: application/json

Request:

{
"sid": "f27da0c07c094b0c88768eb5dac3dc80",
"key": "Fp2407kzXgHUrZB9LAuwD3S3N8c19EMabih254Ge1863YyxP5269",
"amount": "200",
"currency": "TRY",
"transaction_id": "7e49a9701ad5d2ebda5dcda7a2abf20c",
"trx": "19284",
"hash": "Y2ZhZTNiYmE1YjIwZTAzZWI2NjhjZTRlOTY0OWFhYzkxY2I5YjIxOWI3NjAyNjVlZTNlNjQ5OTFhMjdlZjliMg=="
}

Response (for successful operation)

{
"state": 200,
"message": "işlem başarılı"
}

Response (for failed operation)

{
"state": false,
"message": "ERROR MESSAGE YOU WILL DETERMINE"
}
Withdraw

Site Provider → PayGaranti

POST: https://api.garantipay.net/payment/withdraw

Request params:

Parameter | Necessity | Type | Description
--- | --- | --- | ---
sid | required | string | Site-specific by PayGaranti
key | required | string | Site-specific by PayGaranti
amount | required | number | Withdraw amount * 100 -> if you want 100 TRY please send 10000
currency | required | string | Sent as a “TRY”.
name | required | string | The customer's name, middle name and surname
iban | required | string | The bank account number of the customer
bank_name | required | string | The bank name of the customer
tc | required | string | Customer's turkey identity number
trx | required | string | if you have sent this parameter, we will pass back the data contained in this parameter
notify_url | required | string | We will send information about the withdrawal to this parameter when it is concluded
hash | required | string | What you need calculate "hash" sid key amount trx name iban There is an API Secret Key. That’s our Private Key for creating hash value. (Note: We are using HMAC-SHA256 standard while creating hash value.) sid|key|trx|amount|name|iban we need using this is string for building hmac with private key(API Secret Key) and finally convert to it base64 Nodejs: const crypto = require('crypto'); const secretData = `${sid}${key}${trx}${amount}${name}${iban}` const hmac = crypto.createHmac('sha256', data.key).update(Buffer.from(secretData, 'utf-8')).digest("hex"); let hash = Buffer.from(hmac).toString('base64')

Response params:

Parameter | Type | Description
--- | --- | ---
state | boolean | Status code.
message | string | Status message.
transaction_id | string | Transaction ID on PayGaranti system.

##### Example:

POST: https://api.garantipay.net/payment/withdraw

Accept: application/json
Content-Type: application/json

Request:

{
"amount": 10000, // 100 TRY
"iban": "TR199...",
"name": "Ali Rıza",
"bank_name": "Ziraat Bankası",
"key": "abc123..",
"sid": "abc123..",
"hash": "hF4ygZrZYl8umT3Q6s9kcHVvXDDM2MYfVqsnD4FAnIk=",
"notify_url": "https://api.garantipay.net/notify-test",
"trx": "1213" }

Response (for successful operation)

{
"state": true,
"error_code": 0,
"message": "Çekim talebi alındı.",
"transaction_id": "29" }

Response (for failed operation)

{
"state": false,
"error_code": 13,
"message": "This trx has been used." }
Callback Return API Services (Withdraw)

PayGaranti → Site Provider

POST: notify_url

Header information:

Title | Value
--- | ---
Accept | application/json
Content-Type | application/json

Request params:

Parameter | Necessity | Type | Description
--- | --- | --- | ---
sid | required | string | Site-specific by PayGaranti
key | required | string | Site-specific by PayGaranti
amount | required | number | Withdraw amount * 100
name | required | string | The customer's name and surname
iban | required | string | The bank account number of the customer
bank_name | required | string | The name of the bank used by the customer
trx | required | string | if you have sent this parameter, we will pass back the data contained in this parameter
transaction_id | required | string | Transaction ID on PayGaranti system.
message | required | string | System or PayGaranti message about this transaction.
status | required | number | It is sent as 1 or 2 depending on the transaction result. 1 : successfully completed 2 : failed
hash | required | string | What you need calculate "hash" sid key amount trx name iban There is an API Secret Key. That’s our Private Key for creating hash value. (Note: We are using HMAC-SHA256 standard while creating hash value.) sid|key|trx|amount|name|iban we need using this is string for building hmac with private key(API Secret Key) and finally convert to it base64 Nodejs: const crypto = require('crypto'); const secretData = `${sid}|${key}|${trx}|${amount}|${name}|${iban}` const hash = crypto.createHmac('sha256', data.key).update(secretData).digest('base64')

Response params:

Parameter | Type | Description
--- | --- | ---
state | boolean | Status code.
message | string | Status message.

Response (for successful operation)

{
"state": true,
"message": "işlem başarılı"
}

Response (for failed operation)

{
"state": false,
"message": "ERROR MESSAGE YOU WILL DETERMINE"
}
Logos of the payment