Capture a payment

Learn to capture a payment.

To capture a payment, you must first place it via Drop-in Checkout.

In Digital River, payments are captured by marking items in the order as fulfilled. Therefore, it is not possible to capture a payment by adding a Charge transaction. Also, while partial captures are supported, it is not possible to specify the amount of the capture. This amount will is calculated for you by Digital River based on the items you fulfill.

Items can be marked as fulfilled using the following methods:

The next sections provide more details.

Call the Digital River fulfillments API

To use the Digital River API directly, you need your Digital River secret API key and the Digital River order and line item IDs. The Digital River order ID is available in the custom field drOrderId on the commercetools order. The Digital River line item ID is available in the custom field drLineItemId in each commercetools order line item.

Use the Convenience API

The convenience API is similar to the Digital River API above except that it lets you use the commercetools resource IDs and looks up your configured secret API key for you. The following is an example:

Method: POST

Path: /api/v1/fulfillments/create

Payload:

{
  "orderId": "<commercetools order id>",
  "shipmentId": "<your shipment id>",
  "items": [
    {
      "itemId": "<commercetools line item id>",
      "shipmentItemId": "<your shipment item id>",
      "quantity": <quantity to fulfill>,
      "cancelQuantity": 0
    }
  ],
  "metadata": {
    <any key value pairs>
  },
  "trackingCompany": "<tracking company>",
  "trackingNumber": "<tracking number>",
  "trackingUrl": "<tracking url>"
}

You can optionally track order details, metadata, and shipment IDs.

Note: The endpoint should be secured, even if you use the convenience API.

Understand the capture outcome

Digital River calculates the amount to be captured for you. When this is available, a Charge transaction, in a Pending state with the amount, is added to the commercetools payment. Once the results of the capture is available, the Charge transaction is updated to either Success or Failure.

The interactionId of the Charge transaction is set to the id of the Digital River charge so that you can reconcile these two if needed.

Last updated