Use PaymentLibrary class instead of writing to database directly