I found this post about BitPay but it's not very clear how I can use it.
https://help.bitpay.com/development/how-do-i-use-the-bitpay-java-client-library
I implemented this code:
public void createInvoice() throws BitPayException
{
ECKey key = KeyUtils.createEcKey();
BitPay bitpay = new BitPay(key);
InvoiceBuyer buyer = new InvoiceBuyer();
buyer.setName("Satoshi");
buyer.setEmail("[email protected]");
Invoice invoice = new Invoice(100.0, "USD");
invoice.setBuyer(buyer);
invoice.setFullNotifications(true);
invoice.setNotificationEmail("[email protected]");
invoice.setPosData("ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
Invoice createInvoice = bitpay.createInvoice(invoice);
}
How should I implement the private key?
You need to go through the client pairing process: https://developer.bitpay.com/reference/getting-access
This will output a file/ json object containing the private key. You can save the json object in your application's resource folder and load it into your client like this:
val configFilePath = ConfigFilePath("src/main/resources/BitPay.config.json")
val bitpayClient = Client.createClientByConfigFilePath(configFilePath)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With