This is my Table (invoice_payments):

I want to get rows grouped by invoice_id with sum of amount with specific condition.
My SQL query:
select invoice_id, (select sum(invoice_payments.amount) from invoice_payments where
invoice_payments.type!='Store') as total_paid, type from invoice_payments where
invoice_payments.type!='Store' group by invoice_id
I am getting this result:

As you can see this is wrong. Please someone help/suggest a solution. I really appreciate any reply.
Thanks
select invoice_id, sum(invoice_payments.amount) as total_paid, type from invoice_payments where invoice_payments.type!='Store' group by type, invoice_id?