在Adyen经常性付款

时间:2017-07-18 17:20:02

标签: php 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);

我收到以下错误:错误:皮肤null不存在 我已经验证了包含有效的skinCode。

我使用SepaDirect作为付款。

我还尝试将上述字段附加到我正在使用的初始付款提交表单中,并且它们基本上被忽略,付款将作为一次性处理。

任何帮助都会受到赞赏,我已经在文件中梳理了好几天,但这无济于事。

1 个答案:

答案 0 :(得分:1)

您似乎正在尝试重定向到皮肤以执行后续Sepa事务。这是因为您正在拨打" https://test.adyen.com/hpp/pay.shtml"。

可以通过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);   

请注意网址的更改,皮肤代码的删除以及" shopperInteraction" :" ContAuth",并删除一次点击 recurring.contract' => " RECURRING",

因此,当您想再次向购物者收费时,您只需从您的电话进行此呼叫,无需将其发送给HPP。

希望这有帮助,

干杯, 安德鲁