Capture a payment
See Common API topics - Reserve and Capture for a general introduction to reservations and captures.
A capture can be made in full, or partial.
The capture amount must be defined in the
POST:/payments/{reference}/capture
request.
Capture via the API
Once the goods or services are delivered or on their way to the customer it is time to capture the payment. See: When should I charge the customer?.
Capture is done with a
POST:/payments/{reference}/capture
request.
An example request body:
{
   "modificationAmount":{
      "currency":"NOK",
      "value":49900
   }
}
In the response, the aggregate object will be updated to reflect the capture, for example:
{
   "aggregate":{
      "authorizedAmount":{
         "currency":"NOK",
         "value":49900
      },
      "cancelledAmount":{
         "currency":"NOK",
         "value":0
      },
      "capturedAmount":{
         "currency":"NOK",
         "value":49900
      },
      "refundedAmount":{
         "currency":"NOK",
         "value":0
      }
   }
}
A notification will also be sent once the capture is completed if a
webhook is registered for the event epayments.payment.captured.v1.
Partial Capture
If you do not wish to capture the entire amount a smaller amount than authorized can be captured. This can be done multiple times.
The Idempotency-Key header is there to help you ensure at most once operation where needed.
An example of a partial capture request body (capturing 100.00 NOK of the 499.00 NOK reserved):
{
   "modificationAmount":{
      "currency":"NOK",
      "value":10000
   }
}
Once the capture is completed the aggregate will be updated to reflect this, for example:
{
   "aggregate":{
      "authorizedAmount":{
         "currency":"NOK",
         "value":49900
      },
      "cancelledAmount":{
         "currency":"NOK",
         "value":0
      },
      "capturedAmount":{
         "currency":"NOK",
         "value":10000
      },
      "refundedAmount":{
         "currency":"NOK",
         "value":0
      }
   }
}
If you are not going to capture the rest of the authorized amount you should cancel the remaining amount.