Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 65 lines (46 sloc) 1.755 kb
321b743 @anurag Sonatype release updates
anurag authored
1 # Stripe Java Bindings
2
b9e35d9 @pc Minor rewording of README
pc authored
3 You can sign up for a Stripe account at https://stripe.com.
4
321b743 @anurag Sonatype release updates
anurag authored
5 Requirements
6 ============
71337bb @anurag Rewrite
anurag authored
7
b9e35d9 @pc Minor rewording of README
pc authored
8 Java 1.5 and later.
71337bb @anurag Rewrite
anurag authored
9
321b743 @anurag Sonatype release updates
anurag authored
10 Installation
11 ============
12
13 ### Maven users
14
15 Add this dependency to your project's POM:
16
17 <dependency>
18 <groupId>com.stripe</groupId>
19 <artifactId>stripe-java</artifactId>
a128a88 @ebroder Bump version
ebroder authored
20 <version>1.1.5</version>
321b743 @anurag Sonatype release updates
anurag authored
21 </dependency>
22
23 ### Others
71337bb @anurag Rewrite
anurag authored
24
b9e35d9 @pc Minor rewording of README
pc authored
25 You'll need to manually install the following JARs:
71337bb @anurag Rewrite
anurag authored
26
9be708e @anurag Add events; Bump version.
anurag authored
27 * The Stripe JAR from https://code.stripe.com/stripe-java-latest.jar
321b743 @anurag Sonatype release updates
anurag authored
28 * [Google Gson](http://code.google.com/p/google-gson/) from <http://google-gson.googlecode.com/files/google-gson-1.7.1-release.zip>.
71337bb @anurag Rewrite
anurag authored
29
321b743 @anurag Sonatype release updates
anurag authored
30 Usage
31 =====
71337bb @anurag Rewrite
anurag authored
32
d1887d9 @anurag Add usage example to README
anurag authored
33 StripeExample.java
34
35 import java.util.HashMap;
36 import java.util.Map;
37
38 import com.stripe.Stripe;
39 import com.stripe.exception.StripeException;
40 import com.stripe.model.Charge;
41
42 public class StripeExample {
43
44 public static void main(String[] args) {
45 Stripe.apiKey = "YOUR-SECRET-KEY";
46 Map<String, Object> chargeMap = new HashMap<String, Object>();
47 chargeMap.put("amount", 100);
48 chargeMap.put("currency", "usd");
49 Map<String, Object> cardMap = new HashMap<String, Object>();
50 cardMap.put("number", "4242424242424242");
51 cardMap.put("exp_month", 12);
52 cardMap.put("exp_year", 2012);
53 chargeMap.put("card", cardMap);
54 try {
55 Charge charge = Charge.create(chargeMap);
56 System.out.println(charge);
57 } catch (StripeException e) {
58 e.printStackTrace();
59 }
60 }
61 }
62
63
64 See [StripeTest.java](https://github.com/stripe/stripe-java/blob/master/src/test/java/com/stripe/StripeTest.java) for more examples.
Something went wrong with that request. Please try again.