Gluwa
Gluwa Documentation
Gluwa Documentation
  • What is Gluwa
  • Change Log
    • Gluwa API Change Log
    • Gluwa Wallet Change Log
    • Gluwa Exchange Change Log
  • Get Started
    • Gluwa Mobile App
      • Gluwa Invest (Investor DAO) FAQ
      • Gluwa Invest (Fixed-Term Interest Account) FAQ
      • Create a New Gluwa Wallet
      • Restore Wallet
      • Send Gluwacoin to an address
      • Make QR Code Payments
      • Create a Signature
      • Access Private Keys
      • Non-Custodial Wallet
      • Gluwa Lottery Account FAQ
      • Fees
      • Transaction Status
      • Delete your Gluwa Account
    • Gluwa Dashboard
      • API Keys
      • Webhooks
      • Addresses
      • Transactions
    • Gluwacoin
  • Branding
    • Buttons and Marks
  • Development
    • Environments
    • QR Codes
    • Webhooks
    • Creating Signatures
    • Idempotent Requests
    • Sending Address
    • Gluwa SDK for PHP
    • Gluwa SDK for .NET
    • Gluwa SDK for Java
    • Gluwa SDK for JavaScript (Node.js)
  • API
    • API Reference
    • Authorization
    • Currency and Conversion Symbols
    • Errors and Error Codes
    • Balance
    • Fee
    • Transaction
    • Payment QR Code
    • Wrap / Unwrap
  • Exchange API
    • Exchange Webhook
    • Quote
    • Order
    • Exchange Request
    • Order Book
Powered by GitBook
On this page
  • Getting started
  • Method Examples
  1. Development

Gluwa SDK for Java

If your service is developed in Java, the features we provide are available through the SDK. The Gluwa SDK for Java is a library with powerful features that enable Java developers to easily make requests to the Gluwa APIs.

Getting started

<repositories>
    <repository>
        <id>Gluwa-java-mvn-repo</id>
        <url>https://raw.github.com/gluwa/Gluwa-Java/mvn-repo/</url>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.gluwa.sdk</groupId>
        <artifactId>gluwa-sdk-java</artifactId>
        <version>1.0.0</version>
    </dependency>
</dependencies>

Please note that the sandbox environment is deprecated and will be replaced with an alternative solution in the future.

public class Configuration extends Configuration {
	public ConfigurationForTest() {
		super();
		set__DEV__(true); // sandbox: true, live: false
		setApiKey("{Your API Key}");
		setApiSecret("{Your API Secret}");
		setWebhookSecret("{Your Webhook Secret}");
		setMasterEthereumAddress("{Your Ethereum Address}");
		setMasterEthereumPrivateKey("{Your Ethereum Private Key}");
	}
}

Gluwa SDK For Java works with JDK 1.8 or higher.

Method Examples

public void postTransaction_test() {
	GluwaApiSDKImpl wrapper = new GluwaApiSDKImpl(new ConfigurationForTest());
	GluwaTransaction transaction = new GluwaTransaction();

	transaction.setCurrency("{Currency}"); // Currency.KRWG, Currency.NGNG
	transaction.setAmount("{Amount}");
	transaction.setTargetAddress("{Target's Address}");
	transaction.setNote("{Note}");
	transaction.setMerchantOrderID("{Your OrderID}");

	GluwaResponse result = wrapper.postTransaction(transaction);
}
public void getPaymentQRCode_example() {
	Configuration conf = new ConfigurationForTest();
	GluwaApiSDKImpl sdkImpl = new GluwaApiSDKImpl(conf);

	GluwaTransaction transaction = new GluwaTransaction();
	transaction.setCurrency(Currency.USDCG);
	transaction.setAmount("51");
	transaction.setExpiry(1800);
}

getPaymentQRCode API returns a QR code png image as a Base64 string. You can display the image on your website as below:

<img src="data:image/png;base64,{BASE64_STRING_YOU_RECEIVED}" alt="Gluwa Payment QR Code">

Create a Payment QR Code​ With Payload

public void getPaymentQRCodeWithPayload_example() {
  Configuration conf = new ConfigurationForTest();
  GluwaApiSDKImpl sdkImpl = new GluwaApiSDKImpl(conf);

  GluwaTransaction transaction = new GluwaTransaction();
  transaction.setCurrency(Currency.USDCG);
  transaction.setAmount("51");
  transaction.setExpiry(1800);

  // `getPaymentQRCode` API returns QR code png image as a Base64 string and payload.
  GluwaResponse result = sdkImpl.getPaymentQRCodeWithPayload(transaction);
  assertNotNull(result);
}
public void getListTransactionHistory_test() {
  Configuration conf = new ConfigurationForTest();
  GluwaApiSDKImpl wrapper = new GluwaApiSDKImpl(conf);

  GluwaTransaction transaction = new GluwaTransaction();
  transaction.setCurrency("{Currency}");
  transaction.setLimit(100); // optional
  transaction.setStatus("Confirmed"); // optional
  transaction.setOffset(0); // optional

  GluwaResponse result = wrapper.getListTransactionHistory(transaction);
}
public void getListTransactionDetail_test() {
  Configuration conf = new ConfigurationForTest();
  GluwaApiSDKImpl wrapper = new GluwaApiSDKImpl(conf);

  GluwaTransaction transaction = new GluwaTransaction();
  transaction.setCurrency("{Currency}");
  transaction.setTxnHash("{Txn Hash}");

  GluwaResponse result = wrapper.getListTransactionDetail(transaction);
}
public void getAddresses_Test() {
  Configuration conf = new ConfigurationForTest();
  GluwaApiSDKImpl wrapper = new GluwaApiSDKImpl(conf);

  GluwaTransaction transaction = new GluwaTransaction();
  transaction.setCurrency("{Currency}");

  GluwaResponse result = wrapper.getAddresses(transaction);
}

When the user completes the transfer via the QR code, the Gluwa API sends a webhook to your webhook endpoint. Verify that the values ​​were actually sent from the Gluwa server.‌

Verify the requested Signature and Payload as follows:

public void validateWebhook_test() {
  Configuration conf = new ConfigurationForTest();
  GluwaApiSDKImpl wrapper = new GluwaApiSDKImpl(conf);
  boolean result = wrapper.validateWebhook(
    "{Payload in Request's body}",
    "{Signature in Request's header}");
}
PreviousGluwa SDK for .NETNextGluwa SDK for JavaScript (Node.js)

Last updated 2 years ago

Our jar is here:

Create and initialize a Configuration class. Then, enter the APIKey, APISecret and WebookSecret generated from the , and an Ethereum wallet to manage your funds.

​​

​​

​​

​​

​​

​​

https://github.com/gluwa/Gluwa-Java/tree/mvn-repo/com/gluwa/sdk/gluwa-sdk-java
Gluwa Dashboard
Create a New Transaction
Create a Payment QR Code
List Transaction History for an Address
Retrieve Transaction Details by Hash
Retrieve a Balance for an Address
Webhook Validation