Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 1.62 KB

README.rdoc

File metadata and controls

49 lines (37 loc) · 1.62 KB

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.9.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.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.9.1</artifactId> <!-- replace with your Scala version -->
        <version>1.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
stripe.apiKey = "sSs57dBsUSkxo3lQPsNKNDX5H0RAcYsj"
val charge = stripe.Charge.create(Map(
  "amount" -> 100,
  "currency" -> "usd",
  "card" -> Map("number" -> "4242424242424242", "exp_month" -> 3, "exp_year" -> 2015)
))

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

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