bitpay


License

License

GroupId

GroupId

com.alexdupre
ArtifactId

ArtifactId

bitpay_2.11
Last Version

Last Version

2.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

bitpay
bitpay
Project URL

Project URL

https://github.com/alexdupre/bitpay-scala
Project Organization

Project Organization

com.alexdupre
Source Code Management

Source Code Management

https://github.com/alexdupre/bitpay-scala

Download bitpay_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/com.alexdupre/bitpay_2.11/ -->
<dependency>
    <groupId>com.alexdupre</groupId>
    <artifactId>bitpay_2.11</artifactId>
    <version>2.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.alexdupre/bitpay_2.11/
implementation 'com.alexdupre:bitpay_2.11:2.2.1'
// https://jarcasting.com/artifacts/com.alexdupre/bitpay_2.11/
implementation ("com.alexdupre:bitpay_2.11:2.2.1")
'com.alexdupre:bitpay_2.11:jar:2.2.1'
<dependency org="com.alexdupre" name="bitpay_2.11" rev="2.2.1">
  <artifact name="bitpay_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.alexdupre', module='bitpay_2.11', version='2.2.1')
)
libraryDependencies += "com.alexdupre" % "bitpay_2.11" % "2.2.1"
[com.alexdupre/bitpay_2.11 "2.2.1"]

Dependencies

compile (8)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
com.eed3si9n : gigahorse-okhttp_2.11 jar 0.5.0
com.typesafe.play : play-json_2.11 jar 2.7.4
ai.x : play-json-extensions_2.11 jar 0.40.2
com.beachape : enumeratum_2.11 jar 1.6.1
com.beachape : enumeratum-play-json_2.11 jar 1.6.1
org.bouncycastle : bcprov-jdk15to18 jar 1.68
org.slf4j : slf4j-api jar 1.7.30

test (1)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.2.3

Project Modules

There are no modules declared in this project.

bitpay-scala

Build Status

An asynchronous / non-blocking Scala library for the BitPay API: https://bitpay.com/api

Supported resources:

  • Currencies
  • Invoices
  • Ledgers
  • Payouts
  • Rates
  • Recipients
  • Tokens

Artifacts

The latest release of the library is compiled with Scala 2.11, 2.12 and 2.13 and supports only Gigahorse with OkHttp backend as HTTP provider.

Version Artifact Id HTTP Provider Json Provider Scala
2.2.1 bitpay Gigahorse 0.5.x Play-Json 2.11 & 2.12 & 2.13

If you're using SBT, add the following line to your build file:

libraryDependencies += "com.alexdupre" %% "bitpay" % "<version>"

Usage

The BitPay trait contains all the public methods that can be called on the client object.

Client Pairing

import com.alexdupre.bitpay._
import com.alexdupre.bitpay.models._

val identity = Identity.random()

val client: BitPay = BitPayClient(identity, testNet = true)

val token: Future[Token] = client.getPairingCode(label = "My Client", facade = Some("pos"))

token foreach { t =>
  println(identity)
  pairingExpiration.foreach(println)
  pairingCode.foreach(println)
}

Invoice Creation

import com.alexdupre.bitpay._
import com.alexdupre.bitpay.models._

val identity = Identity("...")

val client: BitPay = BitPayClient(identity, testNet = true)

val basicInvoice: Future[Invoice] = client.createInvoice(150, "USD")

val orderInfo  = OrderInfo(orderId = Some("A-123"), itemDesc = Some("An awesome item"), physical = Some(true))
val ipnParams  = IPNParams(notificationURL = Some("https://example.net/ipn"), transactionSpeed = Some(TransactionSpeed.Medium), fullNotifications = Some(true))
val buyer      = BuyerInfo(email = "[email protected]")
val complexInvoice: Future[Invoice] = client.createInvoice(150, "USD", ipnParams, orderInfo, buyer)

Instant Payment Notification

import com.alexdupre.bitpay.models.InvoiceNotification
import play.api.libs.json.Json

val ipn: InvoiceNotification = Json.parse("...").as[InvoiceNotification]
// notifications are not signed, so call BitPay.getInvoice(ipn.id) before processing the notification

Versions

Version
2.2.1
2.2
2.1
2.0
1.3
1.2
1.1
1.0