StripeConfig.java
832 Bytes
package com.ecommerce.payment.config;
import com.stripe.Stripe;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
@Configuration
public class StripeConfig {
    
    @Value("${stripe.secret-key:sk_test_default}")
    private String stripeSecretKey;
    
    @Value("${stripe.publishable-key:pk_test_default}")
    private String stripePublishableKey;
    
    @Value("${stripe.webhook-secret:whsec_default}")
    private String stripeWebhookSecret;
    
    @PostConstruct
    public void init() {
        Stripe.apiKey = stripeSecretKey;
    }
    
    public String getPublishableKey() {
        return stripePublishableKey;
    }
    
    public String getWebhookSecret() {
        return stripeWebhookSecret;
    }
}