package com.stripe.android;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;

public class PaymentConfiguration {

    @Nullable private static PaymentConfiguration mInstance;
    @NonNull private final String mPublishableKey;

    private PaymentConfiguration(@NonNull String publishableKey) {
        mPublishableKey = publishableKey;
    }

    @NonNull
    public static PaymentConfiguration getInstance() {
        if (mInstance == null) {
            throw new IllegalStateException(
                    "Attempted to get instance of PaymentConfiguration without initialization.");
        }
        return mInstance;
    }

    public static void init(@NonNull String publishableKey) {
        mInstance = new PaymentConfiguration(publishableKey);
    }

    @NonNull
    public String getPublishableKey() {
        return mPublishableKey;
    }

    @VisibleForTesting
    static void clearInstance() {
        mInstance = null;
    }
}

@@ -170,16 +170,22 @@
 %0Apublic 
+final 
 class Pa
@@ -205,16 +205,16 @@
 ation %7B%0A
-
 %0A    @Nu
@@ -412,16 +412,51 @@
 leKey = 
+ApiKeyValidator.get().requireValid(
 publisha
@@ -453,32 +453,33 @@
 d(publishableKey
+)
 ;%0A    %7D%0A%0A    @No
@@ -754,24 +754,107 @@
 nce;%0A    %7D%0A%0A
+    /**%0A     * A publishable key from https://dashboard.stripe.com/apikeys%0A     */%0A
     public s

Update PaymentConfiguration to validate publishable key (#1112)