Reply
Member
Posts: 2
Registered: ‎04-18-2017

Iframe Response/Asp.net

[ Edited ]

Hi i am new to the authorize.net world and i have been playing around with the hosted payment form. i am creating a ASP.net Applicaiton and trying to integrate this payment page. I have gotten the iframe to open the gateway. but how can i get a response back from the iframe and forward the origianl page? i have a little example code here that i have modified. 

Our client doesnt want the form to be hosted on there page so that is why we are using the iframe so we can have authorize.net handle everything.

I know this is a broad look at this but i have read through alot of the documentation and still have not come up with any conclusions.

If there are any tips or tricks to do this in asp. it would be greatly appreciated.

Protected Sub ASPxPopupControl1_Load(sender As Object, e As EventArgs) Handles ASPxPopupControl1.Load
        Dim ApiLoginID As String = "Login"
        Dim ApiTransactionKey As String = "Key"
        Dim amount As Decimal = 400
        ApiOperationBase(Of ANetApiRequest, ANetApiResponse).RunEnvironment = AuthorizeNet.Environment.SANDBOX
        ApiOperationBase(Of ANetApiRequest, ANetApiResponse).MerchantAuthentication = New merchantAuthenticationType() With {
                .name = ApiLoginID,
                .ItemElementName = ItemChoiceType.transactionKey,
                .Item = ApiTransactionKey
            }
        Dim settings As settingType() = New settingType(3) {}

        settings(0) = New settingType()
        settings(0).settingName = settingNameEnum.hostedPaymentButtonOptions.ToString()
        settings(0).settingValue = "{""text"": ""Pay""}"

        settings(1) = New settingType()
        settings(1).settingName = settingNameEnum.hostedPaymentOrderOptions.ToString()
        settings(1).settingValue = "{""show"": false}"

        settings(2) = New settingType()
        settings(2).settingName = settingNameEnum.hostedPaymentReturnOptions.ToString()
        settings(2).settingValue = "{""url"": ""https://localhost:44342/Summary2.0.aspx"", ""urlText"":""Continue"" ,""cancelUrl"":""https://localhost:44342/Summary2.0.aspx"",""cancelUrlText"":""Cancel""}"

        Dim transactiontype = transactionTypeEnum.authCaptureTransaction.ToString()
        Dim transactionRequest = New transactionRequestType()
        transactionRequest.transactionType = transactiontype
        transactionRequest.amount = amount
        Dim request = New getHostedPaymentPageRequest()
        request.transactionRequest = transactionRequest
        request.hostedPaymentSettings = settings
        Dim controller = New getHostedPaymentPageController(request)
        controller.Execute()
        Dim response = controller.GetApiResponse()
        token = response.token.ToString()
        ASPxPopupControl1.ContentUrl = "https://test.authorize.net/payment/payment"
    End Sub

 

Member
Posts: 2
Registered: ‎04-18-2017

Re: Iframe Response/Asp.net

Another Question that is had is that if i send the user to the payment page. will i ever get a response. if the payment is successfull or declinced?