API Documentation
NeoX documents v.2
NeoX documents v.2
  • Introduction
  • NeoX App
    • E-Wallet
    • eKYC
    • Functionality
  • Payment Gateway
    • Payment Methods
    • Integrations
      • Hosted Checkout
        • Plugin/Extenstion
        • iOS SDK
        • Android SDK
        • React Native SDK
        • Web SDK
        • APIs
      • Direct API
        • Tokenization
      • Refund
        • APIs
        • IPN
    • Transaction Management
      • Query DR
      • Cancel
      • IPN
      • Error Codes
      • Refund on portal
    • Reconciliation
    • Settlement
  • Disbursement
    • Integration
      • Introduction
      • How To Register
      • Security Method
      • Generate token API
      • Get merchant profile API
      • Request disbursement API
      • Get disbursement transaction API
      • Get exchange rate API
      • Inquiry bank account API
      • Currency conversion API
      • Event Notification
      • Response Data Structure
      • Error codes
    • Disbursement Account
    • Disbursement request
    • Transaction Management
      • Query Request/Transaction
      • Webhook
      • Error Codes
    • Reconciliation
  • Collections
    • Integration
      • Introduction
      • How To Register
      • Security Method
      • API authenPlatform
      • API upload file
      • APIs for virtual accounts management
        • API create list of virtual accounts
        • API update KYC virtual account information
        • API update Virtual Account transaction data from merchant
        • API set active/inactive Virtual Account
        • API get list virtual accounts
        • API get detail virtual account
      • APIs for transactions management
        • API update transaction documents
        • API get list transactions
        • API get detail transaction
      • APIs for refund requests management
        • API create refund request
        • API get list refund requests
        • API get detail refund request
      • APIs for withdraw requests management
        • API get list withdraw banks
        • API create withdraw request
        • API get list withdraw requests
        • API get detail withdraw request
      • Event Notification
      • SFTP upload document file of collection transaction
      • Error Codes
    • Virtual Account Management
      • Virtual Account
      • Webhook
    • Transaction Management
      • Webhook
    • Transaction Status Management
      • Webhook
    • Refund Request Management
      • Webhook
    • Withdraw Request Management
      • Webhook
    • Reconciliation
    • Settlement
  • Merchant Portal
    • Onboarding
    • Payment Gateway
      • Reconciliation
      • Withdraw
    • Disbursement
      • Reports
    • Collections
      • Reports
      • Withdraw
Powered by GitBook
On this page
  • Before using SDK, these setup must be completed
  • Process to integrate NeoX Payment Gateway

Was this helpful?

  1. Payment Gateway
  2. Integrations
  3. Hosted Checkout

Android SDK

PreviousiOS SDKNextReact Native SDK

Was this helpful?

Before using SDK, these setup must be completed

  • A verified account on NeoX Merchant Portal. Register at this link .

  • Taking the developer credentials (instruction here).

  • Initialize payment request at order payment step.

Process to integrate NeoX Payment Gateway

Implement permissions in AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        ...
        android:requestLegacyExternalStorage="true"
        >
        ...
    </application>

</manifest>

Implement NeoX SDK library in app/build.gradle

Download package here

dependencies {
    implementation(files("libs/neox-release.aar"))
    ...
}

Method to initialize payment request

import com.android.neox.*
...

class YOUR_ACTIVITY: AppCompatActivity() {
   private lateinit var yourPaymentBtn: Button
   
   override fun onCreate(savedInstanceState: Bundle?) {
      ...
      
      yourPaymentBtn.setOnClickListener {
         val paymentRequest = NeoXPaymentRequest(
             neo_ENV = "development environment" // Default is production. Supported sandbox|production. Ex: NeoXEnvironment.SANDBOX.env
             neo_MerchantCode = "merchant code",
             neo_SecureHash = "secret key",
             neo_Amount = "payment amount", // 10000
             neo_PaymentMethod = arrayOf("payment channel"), // Default is all channel. Payment methods WALLET|ATM|CC|QC
             neo_MerchantTxnID = "your transaction id", // size <= 36.
             neo_OrderID = "order_id || order_code",
             neo_OrderInfo = "order description", // size <= 256
             neo_Command = "command", // Supported commands are PAY, QUERY. Default is PAY. 
             neo_Currency = "payment currency", // Supported currencies are VND, USD. Default is VND.
             neo_Locale = "locale", // Supported locales are vi, en. Default is vi,
             neo_Version = "version", // Default is 1.
             neo_ReturnURL = "url address" // URL to return payment result.
         )
         NeoXPaymentHandler.paymentInitialize(this, paymentRequest)
      }
   }

  ...
 
}
import com.android.neox.*;
...

public class YOUR_ACTIVITY extends AppCompatActivity {
   private Button paymentButton;
   
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      ...
      paymentButton.setOnClickListener(view -> {
            String[] paymentMethods = {};
            NeoXPaymentRequest paymentRequest = new NeoXPaymentRequest(
                "env", // NeoXEnvironment.SANDBOX.getEnv()
                "merchant_code",
                "secret_key",
                "amount",
                paymentMethods,
                "merchant_txn_id",
                "order_id",
                "order_info",
                "command",
                "currency",
                "locale",
                "version",
                "return_url"
            );
            NeoXPaymentHandler.INSTANCE.paymentInitialize(YOUR_ACTIVITY.this, paymentRequest);
       });
   }
   ...
}

Method to listen payment event

import com.android.neox.*
...

class YOUR_ACTIVITY: AppCompatActivity() {
   ...
   override fun onCreate(savedInstanceState: Bundle?) {
       ...
      
       NeoXPaymentHandler.setNeoXPaymentListener(object: NeoXPaymentListener {
            override fun onPaymentClose() {
                    // Your implementation
            }
            override fun onPaymentError(result: NeoXPaymentResult) {
                    // Your implementation
            }
            override fun onPaymentSuccess(result: NeoXPaymentResult) {
                    // Your implementation
            }
        })
   }

  ...
 
}
import com.android.neox.*;
...

public class YOUR_ACTIVITY extends AppCompatActivity {
   ...
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      ...
      NeoXPaymentHandler.INSTANCE.setNeoXPaymentListener(new NeoXPaymentListener() {
            @Override
            public void onPaymentSuccess(@NonNull NeoXPaymentResult neoXPaymentResult) {
                // Your implementation
            }
            @Override
            public void onPaymentError(@NonNull NeoXPaymentResult neoXPaymentResult) {
                // Your implementation
            }
            @Override
            public void onPaymentClose() {
                // Your implementation
            }
       });
   }
   ...
}

Method to custom Payment Gateway UI

import com.android.neox.*
...

class YOUR_ACTIVITY: AppCompatActivity() {
   ...
   override fun onCreate(savedInstanceState: Bundle?) {
      ...
      
      with(NeoXPaymentUtils) {
            useNeoXToolbar = false
            finishActivityOnComplete = true
            overridePaymentButton(NeoXPaymentButton(
                label = "Pay now",
                backgroundColor = "#fed07f",
                textColor = "#000",
                fontSize = 16,
                borderRadius = 24
            ))
            overridePaymentViewTitles(NeoXTitles(
                paymentGatewayTitle = "NeoX Payment Gateway",
                bankPaymentTitle = "Bank transfer",
                cardPaymentTitle = "ATM/Card payment",
                resultTitle = "Payment result"
            ))
        }
     }

  ...
 
}
import com.android.neox.*;
...

public class YOUR_ACTIVITY extends AppCompatActivity {
   ...
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      ...
      NeoXPaymentUtils.setUseNeoXToolbar(true);
      NeoXPaymentUtils.setFinishActivityOnComplete(true);
      NeoXPaymentUtils.INSTANCE.overridePaymentButton(new NeoXPaymentButton(
          "Pay now", // label
          "#fed07f", // background color
          "#000", // text color
          16, // text size
          24 // border radius
      ));
      NeoXPaymentUtils.INSTANCE.overridePaymentViewTitles(new NeoXTitles(
          "NeoX Payment Gateway",
          "Bank transfer",
          "ATM/Card payment",
          "Payment result"
      ));
   }
   ...
}
https://portal.neopay.vn/merchant/portal/user/register