forked from stripe/stripe-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NM] Demo to change Stripe API endpoint
- Loading branch information
u1168238
authored and
u1168238
committed
May 29, 2019
1 parent
098a1ab
commit 2104b63
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.stripe; | ||
|
||
import com.stripe.exception.StripeException; | ||
import com.stripe.model.Charge; | ||
import org.junit.Test; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class MyStripeTest { | ||
|
||
@Test | ||
public void testCharges(){ | ||
Stripe.apiKey = "sk_test_7CTiDS47hsbqVCU50gZdwFrr"; | ||
|
||
Map<String, Object> chargeMap = new HashMap<String, Object>(); | ||
chargeMap.put("amount", 999); | ||
chargeMap.put("currency", "usd"); | ||
chargeMap.put("description", "Example charge"); | ||
chargeMap.put("source", "tok_visa"); // obtained via Stripe.js | ||
chargeMap.put("receipt_email", "25ae2a97be554c16e97ebc1e687f7558"); | ||
|
||
try { | ||
Charge charge = Charge.create(chargeMap); | ||
System.out.println(charge); | ||
} catch (StripeException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |