cancel
Showing results for 
Search instead for 
Did you mean: 

hostedPaymentReturnOptions fails in accept-sample-sapp

I am testing the accept-sample-app (in PHP) from GitHub. I can successfully make a transaction from the iFrame as written, but only with the default receipt.

 

getHostedPaymentForm.php has

 

<hostedPaymentSettings>

...

   <setting>
      <settingName>hostedPaymentReturnOptions</settingName>
  </setting>

...

</hostedPaymentSettings>

 

Adding this line after </settingName>...

 

   <settingValue>{'showReceipt':false, 'url':'https://mypage.com'}</settingValue>

 

causes the app to fail with:

  "The element 'setting' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'settingValue' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."

 

I get a similar failure trying to add the iFrame url parameter to :

<setting>
  <settingName>hostedPaymentIFrameCommunicatorUrl</settingName>
</setting>

 

How do I suppress the AuthNet receipt to display my own?

 

Is there a required order to the settings (as in the <transactionRequest> block)?

 

Is there a newer xml schema?

 

Thanks for any advice

adrianh
Member
1 REPLY 1

Okay, I see what I was missing:

 

Further down the script there is this code:

 

$commUrl = json_encode(array('url' => thisPageURL()."IFrameCommunicator.html" ), JSON_UNESCAPED_SLASHES);


$xml->hostedPaymentSettings->setting[0]->addChild('settingValue', $commUrl);

 

$retUrl = json_encode(array("showReceipt" => false , 'url' => thisPageURL()."return.html", "urlText"=>"Continue to site", "cancelUrl" => thisPageURL()."return.html", "cancelUrlText" => "Cancelx" ), JSON_UNESCAPED_SLASHES);


$xml->hostedPaymentSettings->setting[2]->addChild('settingValue', $retUrl);

 

This properly suppresses the default receipt, and displays the sample's receipt.

 

But why this code instead of the simpler <settingValue> within <hostedPaymentSettings> in the preceding code?

 

Thanks,

Adrian

adrianh
Member