在应用程序内结算验证。请问服务器端code例如地方存在? [英] In-app billing verification. Does server side code example exist somewhere?
本文介绍了在应用程序内结算验证。请问服务器端code例如地方存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
很多人都问如何编写服务器端code
应用内计费verificartion。
有谁能够公布这些code?或知道这样code是。
如何在服务器上安装在?
有<一个href=\"http://stackoverflow.com/questions/6371614/in-app-purchase-signature-verification-with-php-openssl\">similar科目
A lot of people ask how to write server side code for in-app billing verificartion. Can anybody publish such code? Or know where such code is. How to install in on the server? There are similar subjects
我无法理解。
我不知道PHP。
它是下一个噩梦,我要学习?
I could not understand it. I don't know php. Is it the next nightmare which I must study?
感谢您的帮助和建议。
推荐答案
其实这是pretty容易,你只需要在PHP这样一个小功能:
Actually it's pretty easy, you just need a small function like this in PHP:
function checkPayment($data, $signature)
{
$base64EncodedPublicKey = "yourBase64PublicKey";
$openSslFriendlyKey = "-----BEGIN PUBLIC KEY-----\n" . chunk_split($base64EncodedPublicKey, 64, "\n") . "-----END PUBLIC KEY-----";
$publicKeyId = openssl_get_publickey($openSslFriendlyKey);
$result = openssl_verify ($data, base64_decode($signature), $publicKeyId, OPENSSL_ALGO_SHA1);
/*
if ($result == 1) {
echo "Success";
} elseif ($result == 0) {
echo "Verification Failed";
}
*/
return $result;
}
这篇关于在应用程序内结算验证。请问服务器端code例如地方存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文