dti70601 2017-07-18 17:20
浏览 88

在Adyen经常性付款

I am trying to initiate a recurring payment in Adyen but I am unable to figure out how to do so. I have tried sending a request up receipt of payment results:

$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);

I get the following error: Error: Skin null does not exist I have verified a valid skinCode is included.

I am using SepaDirect as payment.

I have also just tried attaching the above fields to the initial payment submission form I am using and they are essentially ignored, the payment is processed as a one off.

Any assistance would be appreciated, I have been combing through the documents for several days to get this going to no avail.

  • 写回答

1条回答 默认 最新

  • duanjiao4763 2017-07-19 08:24
    关注

    It seems you are trying to redirect to the skin in order to do a followup Sepa transaction. This because you are making the call to "https://test.adyen.com/hpp/pay.shtml".

    Sepa direct debit can be processed directly via the API, there is no need to send the shopper to the HPP

    You can do the following:

    $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);   
    

    Please note the change in URL, the removal of the skincode and the addition of "shopperInteraction" : "ContAuth", and the removal of one click in recurring.contract' => "RECURRING",

    So when you want to charge a shopper again, you just do this call from your end, there is no need to send him to the HPP.

    Hope this helps,

    Cheers, Andrew

    评论

报告相同问题?