私は同様の問題があったが、私は、私は別の方法を共有するだろうと思ったIPNに頼ることができませんでした。
IPNを使用する必要はありません。paykeyでトランザクションIDを取得できます。これは、モバイル支払いの確認に役立ちます。ここには、payKeyからすべてのトランザクション情報を取得するPHPブロックがあります。モバイルアプリから呼び出す必要があります。 iOSのためにあなたは、このチュートリアルを使用することができます:http://www.raywenderlich.com/13511/how-to-create-an-app-like-instagram-with-a-web-service-backend-part-12
<?
header("Content-Type: application/json");
//DEBUG TO CHECK PAYKEY
//turn php errors on
ini_set("track_errors", true);
//Example payKey (got from iOS app)
$payKey = "<snip>";
//set PayPal Endpoint to sandbox
$url = trim("https://svcs.sandbox.paypal.com/AdaptivePayments/PaymentDetails?payKey=".$payKey."&requestEnvelope.errorLanguage=en_US");
//PayPal API Credentials
//to do: change these for production credentials in the production app
$API_UserName = "<snip>";
$API_Password = "<snip>";
$API_Signature = "<snip>";
//Default App ID for Sandbox
$API_AppID = "APP-80W284485P519543T";
$API_RequestFormat = "NV";
$API_ResponseFormat = "NV";
try
{
//Create payload for this query
$bodyparams = array ("requestEnvelope.errorLanguage" => "en_US");
// convert payload array into url encoded query string
$body_data = http_build_query($bodyparams, "", chr(38)); // Generates body data
//create request and add headers
$params = array("http" => array(
"method" => "POST",
"content" => $body_data,
"header" => "X-PAYPAL-SECURITY-USERID: " . $API_UserName . "\r\n" .
"X-PAYPAL-SECURITY-PASSWORD: " . $API_Password . "\r\n" .
"X-PAYPAL-SECURITY-SIGNATURE: " . $API_Signature . "\r\n" .
"X-PAYPAL-APPLICATION-ID: " . $API_AppID . "\r\n" .
"X-PAYPAL-REQUEST-DATA-FORMAT: " . $API_RequestFormat . "\r\n" .
"X-PAYPAL-RESPONSE-DATA-FORMAT: " . $API_ResponseFormat
));
//create stream context
$ctx = stream_context_create($params);
//open the stream and send request
$fp = @fopen($url, "r", false, $ctx);
//get response
$response = stream_get_contents($fp);
//check to see if stream is open
if ($response === false) {
throw new Exception("php error message = " . "$php_errormsg");
}
//close the stream
fclose($fp);
//parse the ap key from the response
$keyArray = explode("&", $response);
foreach ($keyArray as $rVal){
list($qKey, $qVal) = explode ("=", $rVal);
$kArray[$qKey] = $qVal;
}
//print the response to screen for testing purposes
If ($kArray["responseEnvelope.ack"] == "Success")
{
foreach ($kArray as $key =>$value){
echo $key . ": " .$value . "<br/>";
}
}
else {
echo 'ERROR Code: ' . $kArray["error(0).errorId"] . " <br/>";
echo 'ERROR Message: ' . urldecode($kArray["error(0).message"]) . " <br/>";
}
}
catch(Exception $e)
{
echo "Message: ||" .$e->getMessage()."||";
}
//End check paykey
?>
私はあなたが$ kArrayとで得ることができるすべてのフィールドを示す画像を添付しているだろうが、私は評判を持っていません。 $ kArray ["paymentInfoList.paymentInfo(0).transactionId"]
注:sandboxに使用するAPI認証情報は、developer.paypal.comの「サンドボックスアカウント」にあります。
まずアクセストークンを取得した後、あなたのclientIdとClientSecret
$ch = curl_init();
$clientId = PAYPAL_CLIENT_ID; //client Id
$secret = PAYPAL_CLIENT_SECRET; client secrete key
curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/oauth2/token");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $clientId . ":" . $secret);
curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials");
$result = curl_exec($ch);
$accessToken = null;
if (empty($result))
die('invalid access token');
else {
$json = json_decode($result);
$accessToken = $json->access_token;
}
curl_close($ch);
を使用してアクセストークンを取得し、私はトランザクションを取得する - 私たちのような取引の詳細を取得することができます
これはアプリの購入でこれを使用していますか?私はAppleの方針でそれについて調べてみる前に、自分がアプリを購入する仕組みを持っているので、さらに進んでいきます。 – Openside
私はouメンバーが目的のためにイベントパスを購入できるアプリを開発しています。 Paypalを介して支払う。 –