payment gateway - How to use Bitpay with Java -


i found post bitpay it's not clear how can use it.

https://help.bitpay.com/development/how-do-i-use-the-bitpay-java-client-library

i implemented code:

public void createinvoice() throws bitpayexception     {         eckey key = keyutils.createeckey();         bitpay bitpay = new bitpay(key);         invoicebuyer buyer = new invoicebuyer();         buyer.setname("satoshi");         buyer.setemail("satoshi@bitpay.com");          invoice invoice = new invoice(100.0, "usd");         invoice.setbuyer(buyer);         invoice.setfullnotifications(true);         invoice.setnotificationemail("satoshi@bitpay.com");         invoice.setposdata("abcdefghijklmnopqrstuvwxyz1234567890");          invoice createinvoice = bitpay.createinvoice(invoice);     } 

how should implement private key?

that answer, believe, found in following file: https://github.com/bitpay/java-bitpay-client/blob/master/src/main/java/controller/bitpay.java - say, set private key on bitpay client instance. there can find appropriate constructor needs. want use 1 or more of following fields depending on specific needs:

private eckey _eckey = null; private string _identity = ""; private string _clientname = ""; private hashtable<string, string> _tokencache; 

edit: encryption , decryption of private key exists here: https://github.com/bitpay/java-bitpay-client/blob/master/src/main/java/controller/keyutils.java

if, instance, used following constructor:

public bitpay(uri privatekey) throws bitpayexception, urisyntaxexception,        ioexception {     this(keyutils.loadeckey(privatekey), bitpay_plugin_info, bitpay_url); } 

you pass in uri private key.

specific instructions on available here: https://github.com/bitpay/java-bitpay-client/blob/master/guide.md

two simple examples:

bitpay bitpay = new bitpay(); eckey key = keyutils.createeckey(); this.bitpay = new bitpay(key); 

number two:

// create private key external sdk, store in file, , inject    private key sdk. string privatekey = keyutils.getkeystringfromfile(privatekeyfile); eckey key = keyutils.createeckeyfromhexstring(privatekey); this.bitpay = new bitpay(key); 

after implementing private key, you'd till need initialize client , connect server.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -