X-Payments:Capturing payments when using X-Payments with Magento
If payment for an order is performed in the "Auth and capture" mode ("Initial transaction = Auth and capture" in the payment configuration settings in X-Payments and "Use forced Authorize operation = No" in the X-Payments connector payment method settings in Magento), the customer is charged for the order at the time of order creation. However, in a workflow where the initial payment transaction is performed in the "Authorization only" mode ("Initial transaction = Auth" in X-Payments and/or "Use forced Authorize operation = Yes" in Magento), no money changes hands immediately after order creation: the payment transaction is done only to obtain an authorization for the amount listed as the order Grand Total, and you have to take a few additional steps to capture the amount that was authorized.
Below we discuss how to capture the funds for which an authorization has been obtained as a result of the customer making a payment in the "Authorization only" mode.
For orders for which an authorization has been obtained via X-Payments, Magento uses a special status: X-Payments Pending Payment (In the Magento front end, the same status is named "X-Payments Authorized Payment").
When an order has this status, you know that a capture needs to be performed on it. Please note that when an authorization to capture a certain amount is obtained, this amount is reserved on the customer's account for you to capture only for a limited time; for this reason, when you get an order with the "X-Payments Pending Payment" status, be sure to keep an eye on it and perform the capture before the authorization expires.
The main method that can be used to capture a previously authorized amount is based on creating an invoice. If required, multiple invoices can be created for a single order, each containing as many or as few of the purchased items as you specify.
To perform a capture:
- In the Admin panel, select Sales > Orders:
- In the Orders list, locate the order for which you want to perform a capture and click to open the order details.
- In the upper right, click the Invoice button:
This opens a new invoice page: - Scroll down to the Items to Invoice section.
This section provides a list of items you can invoice and their respective quantities. By default, the invoice will be created for the entire order. If you are going to invoice only some of the items and do a partial capture this time, update the quantities to invoice (specify the correct quantities in the Qty to invoice column and click the Update Qty's button); the invoice totals will be re-calculated.Important: Before using partial capture, make sure your payment gateway supports this feature. - Work through the invoicing process as usual: add a tracking number, create a packing slip, enter invoice comments as needed, specify whether a copy of the invoice needs to be emailed to the customer and whether your comments need to be appended to it.
- In the Amount field, select the payment action you require:
- Capture Online: Upon invoice submission, the invoice amount will be captured (a request to capture the specified amount will be sent through X-Payments to the payment gateway). After the capture, you will have the ability to create a credit memo should you require to issue a refund.
- Capture Offline: Upon invoice submission, the system will not capture the payment (no request to capture the payment will be sent). This option should be selected if the capture of funds is performed directly through the gateway or through the X-Payments back end. Note that after using the "Capture Offline" option you will no longer have the option to capture this payment through your Magento store. You will have the ability to create a credit memo.
- Not Capture: Upon invoice submission, the system will not capture the payment (no request to capture the payment will be sent). This option assumes that you will capture the payment at a later date. The completed invoice (you will be able to access it through Order View > Invoices) will have a Capture button allowing you to complete the task:
Before the payment is captured, you will able to cancel the invoice. After capturing you will be able to create a credit memo.Important: Do not select “Not Capture” unless you are certain that you are going to capture the payment through Magento at a later date. You will not be able to create a credit memo until the payment has been captured using the Capture button.
- Click the Submit Invoice button to process the invoice.
The invoice will be created. The selected payment action (Capture Online, Capture Offline or Not Capture) will be applied.
Now if you go back to the order details and click on the Invoices tab under the Order View menu, you should be able to see the new invoice added to the list of invoices pertaining to the order:
An invoice created with the "Capture Online" option or captured after it has been created with the "Not Capture" option will have the status Paid. The respective capture transaction will appear in the X-Payments back end with the status Charged.
An invoice created with the "Capture Offline" or "Not Capture" option will have the status Pending; no transaction will be reflected in X-Payments.