Salesforce Visualforce for Hosted Payment Page

41 views Asked by At

I have a question on hosted payment pages and Salesforce. Many providers (SnapPay in our instance) allow a Hosted Payment Page for taking secure PCI compliant payments. My goal in Salesforce is to use VF to call that component for payment, and then communicate back once successful (frmHostedFormResponse array and Attribute ‘transactionstatus’).

My question is this. I have this completed in a VF page, but how do I extract out the form response after it gets submitted and send back to Salesforce?

Any thoughts?

I have this as the VF page, since the hosted payment page is generated by some private attributes from the controller, this page just needs to display their page.

<apex:page controller="PaymentGenerateSignature" contentType="text/html" applyHtmlTag="false" showHeader="false" >
      <apex:outputText value="{!baseURL}"  escape="false" />
      <apex:outputPanel layout="block" id="pbtbl" >{!baseURL}</apex:outputPanel>
</apex:page>

The code displays this form that is generated from attributes in the controller sent to this URL:https://stage.snappayglobal.com/Interop/HostedPaymentPage/): PaymentForm

Once you submit, it passes through this URL: https://stage.snappayglobal.com/Interop/HostedPaymentPage/HostedFormResponse Where there are these attributes (among others):

<form id="frmHostedFormResponse" name="frmHostedFormResponse" method="POST" action="#">
    <input type="hidden" name="transactionstatus" value="Y">
    <input type="hidden" name="returnmessage" value="Transaction successful.">
    <input type="hidden" name="source" value="hostedpaymentpage">
    <input type="hidden" name="transactiontype" value="S">
    <input type="hidden" name="currencycode" value="USD">
    <input type="hidden" name="transactionamount" value="10">
    <input type="hidden" name="totaltransactionamount" value="10.3">
    <input type="hidden" name="webhookurl">
    <input type="hidden" name="pgreturncode" value="000">
    <input type="hidden" name="pgreturndescription" value="Transaction successful.">
    <input type="hidden" name="transactiondate" value="12/22/2023 06:59:48 AM">
</form>

Then it takes you to the redirect URL that was established in the original call, which for us is a Visualforce page to display either a success message or failure message based on the attributes above.

I just need to get frmHostedFormResponse attributes back into Salesforce and not sure how to make that last connection.

0

There are 0 answers