Skip to content

Instantly share code, notes, and snippets.

@ertugrulozcan
Last active September 12, 2021 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ertugrulozcan/2c6b684a58547bd6293eedcbc99734f0 to your computer and use it in GitHub Desktop.
Save ertugrulozcan/2c6b684a58547bd6293eedcbc99734f0 to your computer and use it in GitHub Desktop.
120920210225150310/v2/subscription/customers{
"name": "test",
"surname": "test",
"identityNumber": "11111111111",
"email": "testdenemesiismet@gmail.com",
"gsmNumber": "+905346118505",
"billingAddress": {
"address": "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1",
"zipCode": "34742",
"contactName": "test test",
"city": "Istanbul",
"country": "Turkey"
},
"shippingAddress": {
"address": "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1",
"zipCode": "34742",
"contactName": "test test",
"city": "Istanbul",
"country": "Turkey"
},
"locale": "tr",
"conversationId": "1234567890"
}
import hmac
import hashlib
SECRET_KEY = 892374928347928347283473
message = ''
signature = hmac.new(
str(SECRET_KEY),
msg=message,
digestmod=hashlib.sha256
).hexdigest().upper()
print signature
STEP 1:
Headers;
- "Accept": "application/json",
- "x-iyzi-client-version": "iyzipay-dotnet-2.1.39",
- "x-conversation-id": "1234567890"
STEP 2:
Random Key: "120920210225150310"
STEP 3:
UriPath: "/v2/subscription/customers"
STEP 4:
Payload: (payload = uripath + json)
/v2/subscription/customers{
"name": "test",
"surname": "test",
"identityNumber": "11111111111",
"email": "testdenemesiismet@gmail.com",
"gsmNumber": "+905346118505",
"billingAddress": {
"address": "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1",
"zipCode": "34742",
"contactName": "test test",
"city": "Istanbul",
"country": "Turkey"
},
"shippingAddress": {
"address": "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1",
"zipCode": "34742",
"contactName": "test test",
"city": "Istanbul",
"country": "Turkey"
},
"locale": "tr",
"conversationId": "1234567890"
}
STEP 5:
dataToEncrypt: (dataToEncrypt = randomKey + payload)
120920210225150310/v2/subscription/customers{
"name": "test",
"surname": "test",
"identityNumber": "11111111111",
"email": "testdenemesiismet@gmail.com",
"gsmNumber": "+905346118505",
"billingAddress": {
"address": "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1",
"zipCode": "34742",
"contactName": "test test",
"city": "Istanbul",
"country": "Turkey"
},
"shippingAddress": {
"address": "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1",
"zipCode": "34742",
"contactName": "test test",
"city": "Istanbul",
"country": "Turkey"
},
"locale": "tr",
"conversationId": "1234567890"
}
STEP 6: Generate Hash
GenerateHash(apiKey, secretKey, randomKey, dataToEncrypt)
apiKey = "sandbox-afXhZPW0MQlE4dCUUlHcEopnMBgXnAZI"
secretKey = "sandbox-wbwpzKIiplZxI3hh5ALI4FJyAcZKL6kq"
Hash = "YXBpS2V5OnNhbmRib3gtYWZYaFpQVzBNUWxFNGRDVVVsSGNFb3BuTUJnWG5BWkkmcmFuZG9tS2V5OjEyMDkyMDIxMDIyNTE1MDMxMCZzaWduYXR1cmU6YWMyMGJiZTAxMDY2NjU3YmVmNTJlODk3ODM2MGQ0ODhjMDBlOGZjZGU1MDliY2UyZGM4OGMzNzc0NDA1M2FkZg=="
STEP 7:
AuthorizationHeader = "IYZWSv2 " + hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment