Apple Pay Sandbox test cards with Payment Not Completed In MacOS Safari

Hi, i was integrating apple pay web. I have used my sandbox test id, generated processing certificate and merchant certificate, and finished session.onvalidatemerchant this step with return merchantSession successfully. The current situation is :

For the MacOS safari, it continuously throw Payment Not Completed and can't trigger session.onpaymentmethodselected .

and when check event returned from session.oncancel. => {"isTrusted":true}

Can somebody guid me through it?

Note : I'm trying to check it on local machine and on staging server the same issue

  • I have checked the hash of the merchantIdentifier and it matches what is returned in the payment session

Add a Comment

Accepted Reply

I found the issue , Im parse the merchantSession at completeMerchantValidation with response key like ['response'=> merchantSession] , but it should parse it like

#backend side

curl from back end

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $validationURL);
 curl_setopt($ch, CURLOPT_SSLCERT, $certificatePath);
 curl_setopt($ch, CURLOPT_SSLKEY, $certificateKeyPath);
 curl_setopt($ch, CURLOPT_SSLKEYPASSWD, $appleCerPass);
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, true));
 curl_setopt($ch, CURLOPT_VERBOSE, true);
 $verbose = fopen('php://temp', 'w+');
 curl_setopt($ch, CURLOPT_STDERR, $verbose);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     
 $response = curl_exec($ch);

 return  json_decode($response, true);

parse it as is after json_decode ^_^

#frontend side

session.completeMerchantValidation(merchantSession);

Replies

I found the issue , Im parse the merchantSession at completeMerchantValidation with response key like ['response'=> merchantSession] , but it should parse it like

#backend side

curl from back end

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $validationURL);
 curl_setopt($ch, CURLOPT_SSLCERT, $certificatePath);
 curl_setopt($ch, CURLOPT_SSLKEY, $certificateKeyPath);
 curl_setopt($ch, CURLOPT_SSLKEYPASSWD, $appleCerPass);
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, true));
 curl_setopt($ch, CURLOPT_VERBOSE, true);
 $verbose = fopen('php://temp', 'w+');
 curl_setopt($ch, CURLOPT_STDERR, $verbose);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     
 $response = curl_exec($ch);

 return  json_decode($response, true);

parse it as is after json_decode ^_^

#frontend side

session.completeMerchantValidation(merchantSession);

Hi Hammash,

You might be able to help me. I'm facing a similar issue to what you had.

Is completeMerchantValidation(merchantSession) expecting a string like

SSH0D4F440DD640424BB09A9868BE0A0EC7_916523AAED1343F5BC5815E12BEE9250AFFDC1A17C46B0DE5A943F0F94927C24

or an object like

{"merchantSession": "SSH0D4F440DD640424BB09A9868BE0A0EC7_916523AAED1343F5BC5815E12BEE9250AFFDC1A17C46B0DE5A943F0F94927C24"}

can you advise?