1
我正在嘗試爲Clickbank創建IPN偵聽器,但到目前爲止我還沒有成功。Clickbank IPN版本6 PHP/Laravel
我用ClickBank的網站上列出的代碼示例:https://support.clickbank.com/entries/22803622-Instant-Notification-Service
<?php
// NOTE: the mcrypt libraries need to be installed and listed as an available extension in
// your phpinfo() to be able to use this method of decryption.
$secretKey = "YOUR SECRET KEY"; // secret key from your ClickBank account
// get JSON from raw body...
$message = json_decode(file_get_contents('php://input'));
// Pull out the encrypted notification and the initialization vector for
// AES/CBC/PKCS5Padding decryption
$encrypted = $message->{'notification'};
$iv = $message->{'iv'};
error_log("IV: $iv");
// decrypt the body...
$decrypted = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128,
substr(sha1($secretKey), 0, 32),
base64_decode($encrypted),
MCRYPT_MODE_CBC,
base64_decode($iv)), "\0..\32");
error_log("Decrypted: $decrypted");
// convert the decrypted string to a JSON object...
$order = json_decode($decrypted);
// Ready to rock and roll - If the decoding of the JSON string wasn't successful,
// then you can assume the notification wasn't encrypted with your secret key.
?>
對於IPN V4我設法獲得的IPN測試儀驗證確認,並輸出保存到我的日誌。但對於v6,我甚至無法將輸出保存到日誌文件中。似乎clickbank甚至沒有發送任何東西。他們的文檔是模糊的,我想知道這個代碼是否應該在第一位工作。
有沒有人有這方面的經驗?我是否應該回復響應200以外的任何內容?
在此先感謝。
你可以打開一張票/發送電子郵件/打電話給他們。我知道我之前做過這件事的時候,文件已經過時。您也可以使用[403](https://en.wikipedia.org/wiki/HTTP_403)或[500](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)而不是200. – Andrew
感謝您的快速回復,我嘗試過,但他們說,他們不提供對API實施的支持。你碰巧有一個從那時起的示例代碼? –
對不起,我不知道。我從來沒有處理過Clickbank,但我已經處理了其他API,這通常是我做的。致電或發郵件給他們。對不起,我幫不了你。 – Andrew