liujie
2023-10-15 871efa21e6c95520e9825ae1f2338c9a919fdd5d
src/main/java/com/stylefeng/guns/modular/system/utils/PaymentProcessor.java
@@ -1,6 +1,7 @@
package com.stylefeng.guns.modular.system.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.stripe.Stripe;
import com.stripe.exception.*;
import com.stripe.model.Customer;
@@ -13,6 +14,7 @@
import com.stripe.param.PaymentIntentUpdateParams;
import com.stripe.param.PaymentMethodListParams;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.logging.Logger;
@@ -33,8 +35,21 @@
    }
    public static void main(String[] args) {
        try {
            String cus_odnGgggJJ7iEJh = getMethod("cus_OdnGgggJJ7iEJh");
            JSONObject jsonObject = JSON.parseObject(cus_odnGgggJJ7iEJh);
            Object id1 = jsonObject.get("id");
            long l = 1;
            Boolean pay = PaymentProcessor.pay("cus_odnGgggJJ7iEJh", id1.toString(), l);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    public static Boolean pay(String cus,String method,Long money) throws StripeException {
        Stripe.apiKey = "sk_test_51Mu5D0KDN0sswRVwUNL5998QrX1VJkNrLsflVUXkEFH0cY2l9StrCc5O4c9gtzs7tLbVmeaTfyNL6pnrtw1tRClA00ZVfbNb3d";
//        Stripe.apiKey = "sk_test_51Mu5D0KDN0sswRVwUNL5998QrX1VJkNrLsflVUXkEFH0cY2l9StrCc5O4c9gtzs7tLbVmeaTfyNL6pnrtw1tRClA00ZVfbNb3d";
        Stripe.apiKey = "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";
        PaymentIntentCreateParams params =
                PaymentIntentCreateParams.builder()
                        .setCurrency("usd")