2017-07-18 174 views
0

我想在Adyen中發起定期付款,但我無法弄清楚如何執行此操作。我曾嘗試發送支付結果的要求多達收據:Adyen中的定期付款

$request = array(
       'amount.currency' => $this->currency, 
       'amount.value' => $sepaSubmission->amount, 
       'merchantAccount' => $this->merchantAccount, 
       'recurring.contract' => "RECURRING,ONECLICK", 
       'reference' => $sepaSubmission->psp_reference, 
       'shopperEmail' => $account->email, 
       'shopperReference' => $account->email, 
       "selectedRecurringDetailReference" => "LATEST", 
       "skinCode" => env('ADYEN_SKIN_CODE'), 
       ); 

    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); 
    curl_setopt($ch, CURLOPT_USERPWD, env('ADYEN_USERNAME') . ":" . env('ADYEN_PASSWORD')); 
    curl_setopt($ch, CURLOPT_URL, "https://test.adyen.com/hpp/pay.shtml"); 
    curl_setopt($ch, CURLOPT_HEADER, false); 
    curl_setopt($ch, CURLOPT_POST,count($request)); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($request)); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); 

我收到以下錯誤:錯誤:皮膚空不存在 我已經驗證有效的skinCode是包括在內。

我正在使用SepaDirect作爲付款。

我也剛剛嘗試將上述字段附加到我正在使用的初始付款提交表單中,並且它們基本上被忽略,付款將作爲一次性處理。

任何援助將不勝感激,我已梳理了幾天的文件得到這個無濟於事。

回答

1

看來你試圖重定向到皮膚,以便做一個後續的Sepa交易。這是因爲您正在撥打「https://test.adyen.com/hpp/pay.shtml」。

SEPA直接借記可以直接通過API進行處理,沒有必要給購物者發送到HPP

你可以做到以下幾點:

$request = array(
      'amount.currency' => $this->currency, 
      'amount.value' => $sepaSubmission->amount, 
      'merchantAccount' => $this->merchantAccount, 
      'recurring.contract' => "RECURRING", 
      'reference' => $sepaSubmission->psp_reference, 
      'shopperEmail' => $account->email, 
      'shopperReference' => $account->email, 
      "selectedRecurringDetailReference" => "LATEST", 
      "shopperInteraction" : "ContAuth", 
      ); 



$ch = curl_init(); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); 
curl_setopt($ch, CURLOPT_USERPWD, env('ADYEN_USERNAME') . ":" . env('ADYEN_PASSWORD')); 
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_POST,count($request)); 
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($request)); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); 

請注意,改變URL,刪除皮膚代碼並添加「shopperInteraction」:「ContAuth」,並刪除一次點擊 recurring.contract'=>「RECURRING」,

所以當你想再次向購物者收費時,你只是從你的最後做這個電話,沒有必要把他送到HPP。

希望這有助於

乾杯, 安德魯