Skip to content

jasongilanfarr/stripe-scala

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stripe Scala bindings

Quickstart with sbt 0.10

In the stripe-scala directory, run sbt console. You’re now in a Scala REPL where you can import com.stripe. Set your stripe.apiKey and start making API requests. (See the Example section at the end of this file)

Installation

The current release is distributed for Scala 2.10.0 or later. Add stripe-scala as a dependency in sbt or Maven:

sbt

Add the stripe-scala dependency:

val stripeScala = "com.stripe" %% "stripe-scala" % "1.2"

Maven

Add the Scala-Tools repository and the stripe-scala dependency to your POM:

<dependencies>
    <dependency>
        <groupId>com.stripe</groupId>
        <artifactId>stripe-scala_2.10.0</artifactId> <!-- replace with your Scala version -->
        <version>1.2</version>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>ScalaToolsMaven2Repository</id>
        <name>Scala-Tools Maven2 Repository</name>
        <url>http://scala-tools.org/repo-releases</url>
    </repository>
</repositories>

Run the test suite

In the stripe-scala directory, run sbt test, using your stripe test secret key.

Documentation

Example

import com.stripe.{api, apiKey}
import com.stripe.apache.ApacheHttpClient
import com.stripe.model._

stripe.api = new StripeApi with ApacheHttpClient
stripe.apiKey = "sSs57dBsUSkxo3lQPsNKNDX5H0RAcYsj"
val chargeFuture = Charge.create(
  amount = 100,
  currency = "usd",
  card = Some(ChargeCard(number = "4242424242424242", expMonth = 3, expYear = 2015)
))
// wait for the future to complete.

See src/test/scala/com/stripe/StripeSuite.scala for more examples.

See stripe.com/api for the most up-to-date documentation.

About

Stripe Scala Library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 100.0%