Reputation: 153
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.
Upvotes: 0
Views: 1088
Reputation: 21
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
Upvotes: 2