Skip to content

    Charge payments

    Charge payment

    When you ship the order to your customer, make sure to charge the payment in order to receive the funds from Nets.

    A payment can be:

    • fully charged (default)
    • partially charged if needed
    • reserve and release partial amount if needed

    Note that it is not possible to charge an amount that exceeds the original order. The system will tell when you exceed the limit. Below is the server code to charge a payment:

    Charge payment

    <?php
    
    $secretKey = "<YOUR_SECRET_API_KEY>";
    $paymentId = "<YOUR_PAYMENT_ID>";

    Enable safe retries by using an idempotency key when creating charges. Read more about retries and idempotency keys in the API reference.

    Full charge

    A full charge only requires you to specify the full amount to be charged, like this:

    Charge payment fully

    payload.json
    {
        "amount": 5500
    }

    Partial charge

    If you instead want to do a partial charge, you need to specify the order items that you charge for. A partial charge is typically used when you only ship a subset of the items ordered, or if you decide to lower the price of the items. Regardless, you always need to specify a new order so that the registered order of the payment aligns with the charge.

    Charge payment partially

    payload.json
    {
        "amount": 2750,
        "orderItems": [
          {

    Reserve and release partial amount

    If you instead want to do a reserve and release partial amount charge, you need to specify the order items that you charge for. A reserve and release partial amount charge is typically used when you only ship a subset of the items ordered in the cases where an item in the order is out of stock.

    Example

    If a customer has ordered three items but subsequently one of the items is out of stock, it is possible to do a reserve and release partial amount charge by sending the items in stock and charging the partial amount of these.

    Use cases

    1. When the last item is back in stock, the remaining item and reserved amount can be released and charged therafter.

    2. In the cases where the item out of stock is still not available, the reservation can be held for maximum of 7 days from the original authorization date. It is therefore required of you to release the remaining amount of the charge.

    Regardless, you always need to specify a new order so that the registered order of the payment aligns accordingly with the charge.

    finalCharge is a boolean which indicates whether the reserve and release partial amount will be released or not. If finalCharge is true that means that the reserved amount will be released. If the finalChargeis false that means that the reserved amount will be kept.

    Reserve and release partial amount

    payload.json
    {
        "amount": 2750,
        "orderItems": [
          {

    You can subscribe to the following webhook events to track charges associated with a payment: