Skip to content

Commit

Permalink
[NM] Demo to change Stripe API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
u1168238 authored and u1168238 committed May 29, 2019
1 parent 098a1ab commit 2104b63
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/stripe/Stripe.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public abstract class Stripe {

public static final String API_VERSION = "2019-05-16";
public static final String CONNECT_API_BASE = "https://connect.stripe.com";
public static final String LIVE_API_BASE = "https://api.stripe.com";
public static final String LIVE_API_BASE = "https://services.dev.api.m2digitalbroker.com/proxy/m2-stripe";
public static final String UPLOAD_API_BASE = "https://files.stripe.com";
public static final String VERSION = "10.0.1";

Expand Down
30 changes: 30 additions & 0 deletions src/test/java/com/stripe/MyStripeTest.java
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();
}
}
}

0 comments on commit 2104b63

Please sign in to comment.