Integration Guide
Türkçe
v3.1

EsPay API

Integration guide for starting credit card deposits and receiving transaction results via callback.

General Information

Base URL
https://api.espaycash.io/api
Start Payment
https://api.espaycash.io/api/creditcard/deposit
Our IP Address
148.113.221.44
IP WhitelistPlease whitelist our IP address 148.113.221.44 to receive our callback requests.
Sharing your IP addressesPlease send us the IP addresses of the servers that will call our API, so that we can whitelist them, only through the communication channel we have established with you. Requests from IP addresses that are not whitelisted will not be processed.

Integration Flow

Request

Start the transaction with /creditcard/deposit

Redirect

Redirect the user to the url in the response

Callback

The result is sent to your callBackUrl

Verify

Verify the hash and return a response

Credit Card

Deposit transaction with credit card.

Request

POSThttps://api.espaycash.io/api/creditcard/deposit

Headers

x-apikeystringrequired

[apikey]

Content-Typestringrequired

application/json

Request Parameters

amountdecimal(18,2)required

Transaction amount (format: 100.00)

Example: 100.00
userNamestring(100)required

Username to be displayed in reports and transaction records.

Example: userjohn1
ownerstring(100)required

Player's first and last name

Example: John Doe
identityNumberstring(11)required

Cardholder's Turkish ID number

Example: 12345678912
emailstring(150)required

Cardholder's email address

Example: string@test.com
phonestring(50)required

Cardholder's phone number

Example: 5555555555
ipAddressstring(100)required

Cardholder's IP address

Example: 17.0.0.1
transactionIdstring(600)required

ID to be sent back to you in the callback. Must be unique per transaction; a second transaction with the same transactionId is rejected.

callBackUrlstring(1000)required

API endpoint to which the transaction result will be sent. Must be a full URL starting with http:// or https://.

Example: https://www.apidomain.com/endpoint
notificationUrlstring(1000)required

URL the user is redirected to after the payment result is shown. Must be a static link.

custom1string(300)optional

Optional additional information field.

custom2string(200)optional

Optional additional information field.

custom3string(100)optional

Optional additional information field.

Response Parameters

statusboolrequired

Whether the request was successful

urlstringrequired

URL to be shown to the user

errorstringoptional

Reason of the error, if any

POST/api/creditcard/deposit
x-apikey     : [apikey]
Content-Type : application/json

{
  "amount": 100.00,
  "userName": "userjohn1",
  "owner": "John Doe",
  "identityNumber": "12345678912",
  "email": "string@test.com",
  "phone": "5555555555",
  "ipAddress": "17.0.0.1",
  "transactionId": "6ffeb400117b250d51bcb26d4b9318...",
  "callBackUrl": "https://www.apidomain.com/endpoint",
  "notificationUrl": "https://www.yourdomain.com",
  "custom1": "f0b6696c68b09a01777...", // optional
  "custom2": "96c68b09a01777...", // optional
  "custom3": "a01777..." // optional
}
200 OKResponse
{
  "status": true,
  "error": "error message" // null if there is no error
}

Callback

Request sent to your endpoint with the result of the created transactions.

Request

POST[Your Endpoint Url]

Headers

Content-Typestring

application/json

Request Parameters

amountdecimal(18,2)required

Transaction amount (format: 100.00)

Example: 100.00
receivedAmountdecimal(18,2)required

If the user pays a different amount after creating the transaction, the paid amount is sent in this field. For failed transactions (success: false) it is sent as 0.

Example: 150.00
transactionIdstring(600)required

ID you sent when creating the transaction

userNamestring(100)required

The player's first and last name you sent in the owner field when creating the transaction. Not the userName (username) from the request; the owner value is sent exactly as received.

Example: John Doe
hashstring(100)required

Security code hashed with MD5. See Hash Calculation

successboolrequired

Whether the transaction was successful

sessionstring(200)required

Unique ID generated by our system for tracking transfer logs

custom1string(300)optional

Transaction type. Sent as deposit for deposit transactions.

Example: deposit
custom2string(200)optional

Sent empty.

custom3string(100)optional

Sent empty.

POST[Your Endpoint Url]
Content-Type : application/json

{
  "amount": 100.00,
  "receivedAmount": 150.00,
  "transactionId": "14133b8059961712116501f3dc89f8f10a7b",
  "userName": "John Doe",
  "success": true,
  "session": "5d6050f674a01a3d87c9aea6c535c7e5ee8cbd4aa75f14272b6ae42824ea75e9",
  "hash": "f8486d095dd4ae12aea67c9d6a4b261b",
  "custom1": "deposit",
  "custom2": "",
  "custom3": ""
}
200 OKResponse (returned by you)
{
  "session": "5d6050f674a01a3d87c9aea6c535c7e5ee8cbd4aa75f14272b6ae42824ea75e9",
  "status": true,
  "message": "your system message"
}

Hash Calculation

To verify that the callback comes from us, calculate the hash with the rule below and compare it with the received hash. Do not add separators (dots etc.) between fields. The hash is sent as a 32-character lowercase hex string.

Successful transaction success: true

MD5(transactionId + userName + receivedAmount + SECRETKEY)
Raw string
14133b8059961712116501f3dc89f8f10a7bJohn Doe150.00testSecret
Hash
f8486d095dd4ae12aea67c9d6a4b261b

Failed transaction success: false

MD5(transactionId + userName + amount + SECRETKEY)
Raw string
14133b8059961712116501f3dc89f8f10a7bJohn Doe100.00testSecret
Hash
f3a7c8dbd21363e164ab718c634b2f9b
userName in the callback is the owner value from the requestThe hash is calculated with the userName received in the callback, i.e. the owner value you sent when creating the transaction (exactly, including spaces and letter case). Non-ASCII characters are hashed as UTF-8. Use transactionId to match the transaction in your system; do not compare the callback userName with the player's username.
Failed transactions use amountFor failed transactions receivedAmount is sent as 0, and the hash is calculated with the transaction's amount.

Response Parameters

statusboolrequired

Whether the request was successful

sessionstring(200)required

The sessionId we sent to you

messagestring(200)optional

Message generated by your system

errorMessagestring(500)optional

Error message. Sent only when success: false (failed callback). Example: "3DS Entered Wrong"