0
PayPal Payflow Pro 용 PHP SDK가 없습니다. PHP를 사용하여 Payflow Pro 신용 카드 요금을 환불받을 수 있습니까? 신용 카드 번호를 사용하지 않고 어떻게 PCI 표준을 준수 할 수 있습니까?Payflow Pro로 요금을 환불하는 PHP 코드
PayPal Payflow Pro 용 PHP SDK가 없습니다. PHP를 사용하여 Payflow Pro 신용 카드 요금을 환불받을 수 있습니까? 신용 카드 번호를 사용하지 않고 어떻게 PCI 표준을 준수 할 수 있습니까?Payflow Pro로 요금을 환불하는 PHP 코드
다음은 curl을 사용하여 신용 카드 요금을 환불하는 일부 PHP 코드입니다. 이 코드는 Radu Manole의 SDK를 기반으로합니다. 더 많은 정보 Payflow 프로 개발자 가이드를 참조하십시오 https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/pp_payflowpro_guide.pdf
$user = 'CHANGEME'; // API User Username
$password = 'CHANGEME'; // API User Password
$vendor = 'CHANGEME'; // Merchant Login ID
// Reseller who registered you for Payflow or 'PayPal' if you registered
// directly with PayPal
$partner = 'PayPal';
$sandbox = true;
$transactionId = 'CHANGEME'; // The PNREF # returned when the card was charged
$amount = '3';
$currency = 'USD';
$url = $sandbox ? 'https://pilot-payflowpro.paypal.com'
: 'https://payflowpro.paypal.com';
$params = array(
'USER' => $user,
'VENDOR' => $vendor,
'PARTNER' => $partner,
'PWD' => $password,
'TENDER' => 'C', // C = credit card, P = PayPal
'TRXTYPE' => 'C', // S=Sale, A= Auth, C=Credit, D=Delayed Capture, V=Void
'ORIGID' => $transactionId,
'AMT' => $amount,
'CURRENCY' => $currency
);
$data = '';
$i = 0;
foreach ($params as $n=>$v) {
$data .= ($i++ > 0 ? '&' : '') . "$n=" . urlencode($v);
}
$headers = array();
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$headers[] = 'Content-Length: ' . strlen($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
// Parse results
$response = array();
$result = strstr($result, 'RESULT');
$valArray = explode('&', $result);
foreach ($valArray as $val) {
$valArray2 = explode('=', $val);
$response[$valArray2[0]] = $valArray2[1];
}
print_r($response);
if (isset($response['RESULT']) && $response['RESULT'] == 0) {
echo 'SUCCESS!';
} else {
echo 'FAILURE: ' . $response['RESPMSG'] . ' ['. $response['RESULT'] . ']';
}
페이팔 Payflow 프로 API를위한 PHP 클래스가, 나는 그것이 도움이 될 것 같아요. 그것을 찾으십시오 @ https://github.com/rcastera/Paypal-PayFlow-API-Wrapper-Class/blob/master/Class.PayFlow.php –