Guides › Database reference › Orders and sales
Magento 2 sales_order_payment table
The payment of each order: the method used, amounts authorised, paid and refunded, and the gateway's references.
Key columns
| Column | What it means |
|---|---|
parent_id | The order, linking to sales_order.entity_id. |
method | Payment method code, such as checkmo, banktransfer or a gateway's own code. |
amount_ordered / amount_paid / amount_refunded | Amounts in the order currency; base_ versions are in your base currency. |
last_trans_id | The latest transaction ID from the payment gateway. |
cc_type / cc_last_4 | Card type and the last four digits, when the gateway provides them. |
additional_information | Extra details from the payment method, stored as JSON. |
Good to know
- Magento doesn't store full card numbers or security codes here.
- Payment-gateway transactions are in
sales_payment_transaction.
Example: Orders per payment method, last 30 days
Works on Magento Open Source and Adobe Commerce.
SELECT p.method, COUNT(*) AS orders, ROUND(SUM(o.base_grand_total), 2) AS revenue
FROM sales_order o
JOIN sales_order_payment p ON p.parent_id = o.entity_id
WHERE o.created_at >= NOW() - INTERVAL 30 DAY
GROUP BY p.method
ORDER BY orders DESC;
Tested on Magento Open Source and Adobe Commerce 2.4.8. Read-only. If your tables have a prefix, add it to each table name.
This table has the same 54 columns on Magento Open Source and Adobe Commerce.
Foreign keys
parent_id→ sales_order.entity_id
All 54 columns (Magento Open Source)
Show all columns
| Column | Type | Can be empty | Magento's description |
|---|---|---|---|
entity_id | int(10) unsigned | Entity ID | |
parent_id | int(10) unsigned | Parent ID | |
base_shipping_captured | decimal(20,4) | yes | Base Shipping Captured |
shipping_captured | decimal(20,4) | yes | Shipping Captured |
amount_refunded | decimal(20,4) | yes | Amount Refunded |
base_amount_paid | decimal(20,4) | yes | Base Amount Paid |
amount_canceled | decimal(20,4) | yes | Amount Canceled |
base_amount_authorized | decimal(20,4) | yes | Base Amount Authorized |
base_amount_paid_online | decimal(20,4) | yes | Base Amount Paid Online |
base_amount_refunded_online | decimal(20,4) | yes | Base Amount Refunded Online |
base_shipping_amount | decimal(20,4) | yes | Base Shipping Amount |
shipping_amount | decimal(20,4) | yes | Shipping Amount |
amount_paid | decimal(20,4) | yes | Amount Paid |
amount_authorized | decimal(20,4) | yes | Amount Authorized |
base_amount_ordered | decimal(20,4) | yes | Base Amount Ordered |
base_shipping_refunded | decimal(20,4) | yes | Base Shipping Refunded |
shipping_refunded | decimal(20,4) | yes | Shipping Refunded |
base_amount_refunded | decimal(20,4) | yes | Base Amount Refunded |
amount_ordered | decimal(20,4) | yes | Amount Ordered |
base_amount_canceled | decimal(20,4) | yes | Base Amount Canceled |
quote_payment_id | int(11) | yes | Quote Payment ID |
additional_data | text | yes | Additional Data |
cc_exp_month | varchar(12) | yes | Cc Exp Month |
cc_ss_start_year | varchar(12) | yes | Cc Ss Start Year |
echeck_bank_name | varchar(128) | yes | Echeck Bank Name |
method | varchar(128) | yes | Method |
cc_debug_request_body | varchar(32) | yes | Cc Debug Request Body |
cc_secure_verify | varchar(32) | yes | Cc Secure Verify |
protection_eligibility | varchar(32) | yes | Protection Eligibility |
cc_approval | varchar(32) | yes | Cc Approval |
cc_last_4 | varchar(100) | yes | Cc Last 4 |
cc_status_description | varchar(32) | yes | Cc Status Description |
echeck_type | varchar(32) | yes | Echeck Type |
cc_debug_response_serialized | varchar(32) | yes | Cc Debug Response Serialized |
cc_ss_start_month | varchar(128) | yes | Cc Ss Start Month |
echeck_account_type | varchar(255) | yes | Echeck Account Type |
last_trans_id | varchar(255) | yes | Last Trans ID |
cc_cid_status | varchar(32) | yes | Cc Cid Status |
cc_owner | varchar(128) | yes | Cc Owner |
cc_type | varchar(32) | yes | Cc Type |
po_number | varchar(32) | yes | Po Number |
cc_exp_year | varchar(4) | yes | Cc Exp Year |
cc_status | varchar(4) | yes | Cc Status |
echeck_routing_number | varchar(32) | yes | Echeck Routing Number |
account_status | varchar(32) | yes | Account Status |
anet_trans_method | varchar(32) | yes | Anet Trans Method |
cc_debug_response_body | varchar(32) | yes | Cc Debug Response Body |
cc_ss_issue | varchar(32) | yes | Cc Ss Issue |
echeck_account_name | varchar(32) | yes | Echeck Account Name |
cc_avs_status | varchar(32) | yes | Cc Avs Status |
cc_number_enc | varchar(128) | yes | |
cc_trans_id | varchar(32) | yes | Cc Trans ID |
address_status | varchar(32) | yes | Address Status |
additional_information | text | yes | Additional Information |