php - 阿迪恩错误: [status] => 403 [errorCode] => 010 [message] => Not allowed [errorType] => security

标签 php payment-gateway payment adyen

我正在尝试使用 JSON API 通过 ADYEN 进行(测试)付款。

这是代码(我从 Github -> Adyen ->adyen-php-sample-code 获取此示例:

    <?php
/**
 * Create Payment through the API (HTTP Post)
 * 
 * 
 * Please note: using our API requires a web service user. Set up your Webservice 
 * user: Adyen Test CA >> Settings >> Users >> ws@Company. >> Generate Password >> Submit 
 *  
 * @author  Created by Adyen - Payments Made Easy
 */ 

 /**
  * A payment can be submitted by sending a PaymentRequest 
  * to the authorise action of the web service, the request should 
  * contain the following variables:
  * 
  * - merchantAccount: The merchant account the payment was processed with.
  * - amount: The amount of the payment
  *     - currency: the currency of the payment
  *     - amount: the amount of the payment
  * - reference: Your reference
  * - shopperIP: The IP address of the shopper (optional/recommended)
  * - shopperEmail: The e-mail address of the shopper 
  * - shopperReference: The shopper reference, i.e. the shopper ID
  * - fraudOffset: Numeric value that will be added to the fraud score (optional)
  * - card
  *     - expiryMonth: The expiration date's month written as a 2-digit string, padded with 0 if required (e.g. 03 or 12).
  *     - expiryYear: The expiration date's year written as in full. e.g. 2016.
  *     - holderName: The card holder's name, aas embossed on the card.
  *     - number: The card number.
  *     - cvc: The card validation code. This is the the CVC2 code (for MasterCard), CVV2 (for Visa) or CID (for American Express).
  * - billingAddress: we advice you to submit billingAddress data if available for risk checks;
  *   - street: The street name
  *   - postalCode: The postal/zip code.
  *   - city: The city
  *   - houseNumberOrName:
  *   - stateOrProvince: The house number
  *   - country: The country
  */

 $request =array(
  "merchantAccount" => "[YourMerchantAccount]",   
  "amount" => array(
    "currency" => "EUR",
    "value" => "199"
  ),
  "reference" => "TEST-PAYMENT-" . date("Y-m-d-H:i:s"),
    "shopperIP" => "2.207.255.255",
    "shopperReference" => "YourReference",
  "billingAddress" => array(
    "street" => "Simon Carmiggeltstraat",
        "postalCode" => "1011DJ",
        "city" => "Amsterdam",
        "houseNumberOrName" => "6-60",
        "stateOrProvince" => "NH",
        "country" => "NL"
  ),
    "card" => array(
        "expiryMonth" => "08",
        "expiryYear" => "2018",
        "holderName" => "Test Card Holder",
        "number" => "4111111111111111",
        "cvc" => "737"
    ),
    "browserInfo"=>array(
        "acceptHeader"=>$_SERVER['HTTP_USER_AGENT'],
        "userAgent"=>$_SERVER['HTTP_ACCEPT']
    )
);

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, "https://pal-test.adyen.com/pal/servlet/Payment/v25/authorise");
 curl_setopt($ch, CURLOPT_HEADER, false); 
 curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC  );
 curl_setopt($ch, CURLOPT_USERPWD, "YourWSUser:YourWSUserPassword");   
 curl_setopt($ch, CURLOPT_POST,count(json_encode($request)));
 curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($request));
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_HTTPHEADER,array("Content-type: application/json")); 

 $result = curl_exec($ch);

 if($result === false)
    echo "Error: " . curl_error($ch);
 else{
    /**
     * If the payment passes validation a risk analysis will be done and, depending on the
     * outcome, an authorisation will be attempted. You receive a
     * payment response with the following fields:
     * - pspReference: The reference we assigned to the payment;
     * - resultCode: The result of the payment. One of Authorised, Refused or Error;
     * - authCode: An authorisation code if the payment was successful, or blank otherwise;
     * - refusalReason: If the payment was refused, the refusal reason.
     */ 

print_r(json_decode($result));
 }

 curl_close($ch);
?>

以前有人遇到过这个问题吗?我该如何解决这个问题? 我几乎使用了 github 中的所有示例,但只有一些错误被记录下来,其余的......什么都没有......

请帮我解决这个问题。谢谢

最佳答案

当您的用户无权处理原始卡详细信息时,通常会出现此问题。处理原始卡信息需要完全符合 PCI 标准 ( SAQ D )。如果您是这样,请联系 support@adyen.com 请求在您的帐户上启用该权限。

如果没有,您可以使用 Adyen 的 CSE 解决方案。 Docs herePHP example here

关于php - 阿迪恩错误: [status] => 403 [errorCode] => 010 [message] => Not allowed [errorType] => security,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47330297/

相关文章:

android - 移动应用程序中的 Dwolla 支付集成

Paypal作为支付网关?

php - 我怎么知道哪个订单是paypal付款的?

paypal - 是否可以将任何个人对个人支付服务整合到我的市场中,从而我也可以为自己收取一定比例的费用?

javascript - 当数据库img标签中没有条目时仍然显示空框

php - Ubuntu 将/opt/lampp/lampp 导出到 PATH

php - PDO 不会从字符串中提取数据,但可以很好地处理整数

angular - 如何通过 POST 请求将用户重定向到外部站点

php - 有没有可靠的方法来避免 PHP 超时?

paypal - PayPal 中账单地址的最低必填字段?