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.
<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>
Our jar is here: https://github.com/gluwa/Gluwa-Java/tree/mvn-repo/com/gluwa/sdk/gluwa-sdk-java
Create and initialize a Configuration
class. Then, enter the APIKey
, APISecret
and WebookSecret
generated from the Gluwa Dashboard, and an Ethereum wallet to manage your funds. You can use credentials from the sandbox dashboard and a Rinkeby wallet if you want to test in the sandbox environment.
public class Configuration extends Configuration {public ConfigurationForTest() {super();set__DEV__(true); // sandbox: true, live: falsesetApiKey("{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.
public void postTransaction_test() {GluwaApiSDKImpl wrapper = new GluwaApiSDKImpl(new ConfigurationForTest());GluwaTransaction transaction = new GluwaTransaction();transaction.setCurrency("{Currency}"); // Currency.KRWG, Currency.NGNGtransaction.setAmount("{Amount}");transaction.setTargetAddress("{Target's Address}");transaction.setNote("{Note}");transaction.setMerchantOrderID("{Your OrderID}");GluwaResponse result = wrapper.postTransaction(transaction);}
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">
public void getListTransactionHistory_test() {Configuration conf = new ConfigurationForTest();GluwaApiSDKImpl wrapper = new GluwaApiSDKImpl(conf);GluwaTransaction transaction = new GluwaTransaction();transaction.setCurrency("{Currency}");transaction.setLimit(100); // optionaltransaction.setStatus("Confirmed"); // optionaltransaction.setOffset(0); // optionalGluwaResponse 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}");}