 	var buyNumber = 1
 	var request:SKProductsRequest?
 	var buyAction:(PayResult)->Void = { _ in }
+	var customUserId:String?
 	
-	public func register() {
+	var lastTransId:String = ""
+	var compLock = NSLock()
+	var compQueue = OperationQueue()
+	
+	public static var shareInstance:CLPay = { CLPay() }()
+	
+	public func register() -> Bool {
+		compQueue.maxConcurrentOperationCount = 1
+		
+		if !SKPaymentQueue.canMakePayments() {
+			return false
+		}
+		
 		SKPaymentQueue.default().add(self)
+		return true
 	}
 	
 	deinit{

		}
		
		for product in response.products {
			addPayment(product: product)
		}
	}

	public func addPayment(product:SKProduct) {
		let payment = SKMutablePayment(product: product)
		payment.quantity = buyNumber
		if let uid = customUserId {
			payment.applicationUsername = uid
		}
		SKPaymentQueue.default().add(payment)
	}
	
