Announcement

Collapse
No announcement yet.

Notify Miva of payment authorization from custom external payment gateway?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Notify Miva of payment authorization from custom external payment gateway?

    I am developing a custom Miva payment module that uses the `PaymentModule_Payment_URL` function to redirect the user to my payment gateway.

    After the payment is authorized, I need to 1. notify Miva that the payment was authorized, and 2. redirect back to the Miva store and display the correct order invoice page.
    How exactly do I do this? i.e. what do I send to Miva specifically, and where do I send it?

    I may be mistaken (I am relatively new to Miva, after all), but it feels like there should be documentation about things like this, but I have yet to find any such documentation. Hope someone is able to provide some insight!

    #2
    Here is how we do a simular offsite payment experience using PayPal

    Here are high level steps:

    1. Your module should create a new page on install with a simple self-submitting form. Here is an example of what we use for PayPal

    Code:
    <form target="_parent" name="IFrameEscapeForm" action="&mvt:global:secure_sessionurl;" method="POST">
        <input type="hidden" name="Store_Code" value="&mvte:global:Store:code;" />
        <mvt:if expr="NOT ISNULL g.PayPalAdv_Screen">
            <input type="hidden" name="Screen" value="&mvte:global:PayPalAdv_Screen;" />
        <mvt:else>
            <input type="hidden" name="Action" value="AUTH" />
            <input type="hidden" name="Screen" value="INVC" />
            <input type="hidden" name="PaymentMethod" value="&mvte:global:USER1;" />
            <input type="hidden" name="SplitPaymentData" value="&mvte:global:USER2;" />
            <input type="hidden" name="PaymentAuthorizationToken" value="&mvte:global:USER3;" />
            <input type="hidden" name="SECURETOKEN" value="&mvte:global:SECURETOKEN;" />
        </mvt:if>
    </form>
    
    script language="JavaScript">
    document.IFrameEscapeForm.submit();
    </script
    2. Your Payment module will allow the customer to go offsite to complete payment then get redirected back to your custom page created at install.

    3. In this example, the Secure Token in specific to PayPal, but you’ll want to do some sort of validation the customer paid for the order. This will be specific to your payment gateway. In this case we actually make a server side call to PayPal passing in the secure token which returns us the payment data so we can verify payment was made. Your gateway will likely have its own preferred method of validating the customer has paid.

    4. The form passes the AUTH action which handles all the heavy lifting of creating the order and since the session id is being passed it will know what basket to convert to the order.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      Brennan Is it necessary to create a custom page? It sounds like you're saying that this page doesn't ever actually get shown to the user but is really just a redirect point for getting back to Miva from the payment gateway?
      If so, how?

      What I currently have working is this: I am able to go from the Miva checkout flow to my payment gateway, passing things from my module such as the order total. The way I have this working is just that Miva sends a POST request to my server with this info and then I serve my payment gateway's web page to the user.

      It seems that my server needs to be able to send a request to Miva in order to confirm the payment. It kind of sounds like you're saying that this is what the custom page is for? If that's the best way to do it, that's fine, but it's still unclear to me how specifically one might implement this. (I am pretty new to Miva development...)

      Comment

      Working...
      X