How to integrate eWAY payment in a .Net project ?

How to integrate eWAY payment in a .Net project ?



12 February 2020


Robust, Reliable, Safe and Secure

Robust and highly available, eWAY’s infrastructure delivers industry-leading uptime. Working closely with leading technology partners worldwide

eWAY seamlessly integrates with hundreds of leading eCommerce shopping cart platforms and a network of custom integration development partners providing a competitive advantage for any business that wants to grow through accepting digital payments.

Combining all the most popular payment solutions in a single package, eWAY Rapid API includes fraud prevention, hosted payments, transparent redirect, and direct connection to help developers create secure, perfectly rendered payment pages on all devices.

Here are the steps to integrate eWAY API into the .NET projects :

    1. Creating Testing/Sandbox Environment

      Hit the link and log in with your account. If you don’t have the account you can easily sign up for it.
      Now you can get the API key by navigating to the Account tab on the sandbox page and select the API Key option. Here you will get the API key. Click on the Generate Password to get the password. Each time when you click on the Generate Password you will get a new password so the same password you would need to update on the code level.eway-payment-2.jpg
    2. About eWAY Rapid APIs.

      eWAY Rapid API includes fraud prevention, hosted payments, transparent redirect, and direct connection to help developers create secure, perfectly rendered payment pages on all devices.
      There are various platforms like REST (JSON), SOAP, RPC (XML or JSON) etc., for requests and responses from the eWAY APIs.
      For any API request, you need to pass the API Key and generated password along with the endpoint i.e. “Sandbox” or “Production” in the header.eway-payment-3.jpg
      Some important points about eWAY Rapid APIs

      • eWAY’s Rapid APIs provides six different types of Transaction Methods i.e.
        1. Direct Connection
        2. Transparent Redirect
        3. Responsive Shared Page
        4. IFrame
        5. Secure Fields
        6. Secure Panel.

        Each method can have three types of Transaction Types i.e. Purchase, MOTO, and Recurring. For more details, you can go to the eWAY APIs Reference page of

      • Through eWAY Payment API there can be three types of Payment Methods
        1. Process Payment: This method allows merchants to process a standard payment.
        2. Authorise: This transaction will hold an amount on the customer’s card without charging it until a Capture request is sent.
        3. Token Payment: This method allows merchants to process payments using Token customers.
    3. Create the UI for the card payment

      Various free plugins are available which you can use for the awesome frontends views. Some jQuery plugins for the same are mentioned below. validation like expiry month/year and the required inputs ought to handle on the UI side so that we can show the Warning/Error message without sending the API call and wait for the responses.
    4. Creating methods to Authenticate Card, Save Card or Charge Card

      First set the API Key and Password inside the <AppSetting> element of the WebConfig file and call these before sending the request to the API. On the backend, you will have to write the methods for calling the API for authentication if you need card’s details for authentication purpose only. If you are saving the card you don’t need to call the API for the authentication as it saves the card after authenticating itself.
      For the authentication, you can refer to the link
      For saving the card data you need to call the API for creating the customer and need to pass the card and customer details, it will return the TokenCustomerID as the response and you can save this TokenCustomerID for the future transaction. For more details, you can refer to the link
      For charging the card you need to set the Transaction Type as Purchase and you can make the charge by passing the TokenCustomerID or the details of the card. Refer to the link for more details.Many more APIs are available like Refunds, Transaction Query, Recurring Payments etc., which can also be used.eway-payment-7.jpg
    5. Error Handling

      When any kind of errors occurred during the transaction process the API returns the respective Error Code in the response. eWAY returns the error message if you request using the error code and the preferred language code. You can also show a custom error message by creating a method where you can write your custom error message for the respective error code and call that method inside the error/exception handling code. You can refer to the link for the various error codes.eway-payment-8.jpg
      To make development even faster and easier, eWAY provides Software Development Kits for . NET (C#). These provide native structures and functions to do the heavy lifting for you. All eWAY SDKs are free, MIT licensed and open source.

      The eWAY Rapid C# .NET package is available in NuGet – it can be added using Visual Studio’s package manager. Simply search for “eWAY” and add the package to your project. Alternatively, you can use the Package Manager Console and run Install-Package eWAY.Rapid. NuGet will automatically include the required dependencies.Hope this would help you to develop a payment gateway using eWAY in your project.
      Happy Coding!

Blog Categories
Request a quote