Reply
Highlighted
Member
Posts: 4
Registered: ‎07-10-2018

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

Highlighted
Member
Posts: 4
Registered: ‎07-10-2018

Re: hostedPaymentReturnOptions fails in accept-sample-sapp

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