本文整理汇总了Java中com.google.bitcoin.protocols.payments.PaymentSession类的典型用法代码示例。如果您正苦于以下问题:Java PaymentSession类的具体用法?Java PaymentSession怎么用?Java PaymentSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PaymentSession类属于com.google.bitcoin.protocols.payments包,在下文中一共展示了PaymentSession类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import com.google.bitcoin.protocols.payments.PaymentSession; //导入依赖的package包/类
public static void main(String[] args) throws PaymentRequestException,
BitcoinURIParseException, InterruptedException, ExecutionException {
String url = "bitcoin:13dbaDHdYUwDHP24Qg3fEa3yqCBWE5hd9y?amount=0.01&r=https%3A%2F%2Fbitpay.com%2Fi%2FT5P3671YhMuYsqbCt5LsPY";
ListenableFuture<PaymentSession> future = null;
if (url.startsWith("http")) {
future = PaymentSession.createFromUrl(url);
} else if (url.startsWith("bitcoin:")) {
future = PaymentSession.createFromBitcoinUri(new BitcoinURI(url));
}
PaymentSession session = future.get(); // may throw
// PaymentRequestException.
System.out.println(session);
String memo = session.getMemo();
BigInteger amountWanted = session.getValue();
PaymentRequest pr = session.getPaymentRequest();
System.out.println(pr);
System.out.println(session.getPaymentDetails());
if (session.isExpired()) {
System.out.println("session expired.");
}
PaymentSession.PkiVerificationData identity = null;
try {
identity = session.verifyPki();
System.out.println(identity.name);
System.out.println(identity.orgName);
System.out.println(identity.rootAuthorityName);
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:y12studio,项目名称:bkbc-tools,代码行数:39,代码来源:BitcoinPaymentTool.java
注:本文中的com.google.bitcoin.protocols.payments.PaymentSession类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论