| | |
| | | @Component |
| | | public class StripePayUtils { |
| | | |
| | | private static final String key = "sk_test_51Mu5D0KDN0sswRVwUNL5998QrX1VJkNrLsflVUXkEFH0cY2l9StrCc5O4c9gtzs7tLbVmeaTfyNL6pnrtw1tRClA00ZVfbNb3d"; |
| | | // private static final String key = "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"; |
| | | // private static final String key = "sk_test_51Mu5D0KDN0sswRVwUNL5998QrX1VJkNrLsflVUXkEFH0cY2l9StrCc5O4c9gtzs7tLbVmeaTfyNL6pnrtw1tRClA00ZVfbNb3d"; |
| | | private static final String key = "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"; |
| | | |
| | | /** |
| | | * 创建初始用户 |
| | |
| | | } |
| | | // cus_NtikoSLGuD5goQ tok_1N8HCEKDN0sswRVwd8fQmIq6 |
| | | public static void main(String[] args) throws StripeException { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("number","4242424242424242"); |
| | | map.put("exp_month","12"); |
| | | map.put("exp_year","34"); |
| | | map.put("cvc","541"); |
| | | |
| | | // String stripeCustomNoCard = createStripeCustomNoCard("286988043@qq.com"); |
| | | // System.out.println(stripeCustomNoCard); |
| | | // HashMap<String, Object> map = new HashMap<>(); |
| | | // map.put("number","4147202602480020"); |
| | | // map.put("exp_month","04"); |
| | | // map.put("exp_year","28"); |
| | | // map.put("cvc","541"); |
| | | // String cardToken = createCardToken(map); |
| | | // System.out.println(cardToken); |
| | | // |
| | | String cus_ntikoSLGuD5goQ = updateStripeCustomWithCard("cus_NtikoSLGuD5goQ", map); |
| | | System.out.println(cus_ntikoSLGuD5goQ); |
| | | // boolean charge = charge("cus_NtikoSLGuD5goQ", new BigDecimal(0.01), "aud", "测试"); |
| | | // String cus_ntikoSLGuD5goQ = updateStripeCustomWithCard("cus_OdnGgggJJ7iEJh", map); |
| | | // System.out.println(cus_ntikoSLGuD5goQ); |
| | | // boolean charge = charge("cus_OdnGgggJJ7iEJh", new BigDecimal(0.01), "aud", "测试"); |
| | | |
| | | try { |
| | | boolean charge = charge("cus_OdnGgggJJ7iEJh", new BigDecimal(1), "c", "cs"); |
| | | System.out.println(charge); |
| | | } catch (StripeException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | //发起支付 |
| | | Map<String, Object> payParams = new HashMap<>(); |
| | | //1元=100 |
| | | payParams.put("amount", money.multiply(new BigDecimal(100)).longValue()); |
| | | payParams.put("currency", moneyType); |
| | | payParams.put("amount", (money.multiply(new BigDecimal(100)).multiply(new BigDecimal(1.035))).longValue()); |
| | | payParams.put("currency", "usd"); |
| | | payParams.put("description", description); |
| | | payParams.put("customer", stripeMemberId); |
| | | payParams.put("capture", true); |