Skip to content

    Process payments

    This article walks you through an example of how to process card payments with Unified Services.

    Before you start

    Please make sure you have a valid access token before sending requests to the Unified Commerce services. Also, at this point, you should have a PaymentId as a result of sending the Create Payment call.

    Unified Services uses several APIs.

    There are two different environments for each of these APIs: the test environment and the live environment.

    In the following examples we will always refer to the test environment. Please find the base url's for both, test and live environment in the API reference.

    To process payments with Unified Commerce you use the PaymentService API:

    PaymentService API base url (test environment):
    sandbox.unifiedapi.nets.eu/api/v1/payments

    Please find the production base url in our API reference.

    Overview

    Now that you have created a payment and received the corresponding PaymentId, you can send more calls, in order to process the payment.

    To process a card payment can be devided into two steps: Authorize a payment and Capture a payment. For card payments, after Authorizing a payment you can also Cancel a payment.

    The example refers to processing card payments. The requirements for direct bank payments and alternate payment methods such as wallets might be different.

    The availability of payment methods depends on the chosen channel. Find a list of available payment methods per channel here

    There are potentially more calls you might want to send such as Card update or Refund. Please find all available calls in our API reference.

    Get details of a payment

    After your customers have made their payment, you might want to check the current payment status with the Get details of a payment call.

    You can send this call anytime, after the payment has been created.

    For this to work, you only need to add the access token and the paymentId.

    Get details of a payment

    curl --request GET \
      --url https://unifiedapi.netsdev.eu/api/v1/payments/{paymentId} \
      --header 'Authorization: {Access Key}'

    If successful, the response contains the paymentDetails of the payment.

    Response to Get Payment Details

    "paymentDetails": {
            "paymentMethodType": "Card",
            "paymentMethod": "AmericanExpress",
            "paymentMethodDescription": "string",

    Please note, that the paymentMethodType determines, what subsequent call's are possible or required to process that payment.

    Since in our example the consumers used an American Express card for their payment, the next step would be to authorize a payment.

    Separate capture (split between authorizing a payment and capturing a payment) is not possible for all payment methods. Learn more about payment method specific order of calls in the Payment Method section.

    Authorize payments

    For card payments it is possible, to reserve (authorize) the amount previously set in the Create payment call, before performing the actual capture. That allows you to make sure the ordered item has been sent, before charging the customer’s card. It is also possible, to do a partial charge, after the authorization. This helps to avoid chargebacks.

    To authorize the transaction, you need to send the Authorize payment call with the corresponding paymentId.

    Here is an example of a possible Authorize payment call.

    Authorize payment

    curl --request POST \
      --url https://sandbox.unifiedapi.nets.eu/api/v1/payments/{paymentId}/Authorize \
      --header 'Authorization: {Access token} \
      --header 'content-type: application/json' \

    If successful the response will contain an authorizationId and the paymentId.

    Cancel payments

    There are multiple reasons that might force you to cancel a payment: the customer might have revoked the purchase, or you might have run out of the item that has been ordered.

    As long as you have authorized the amount, but not yet captured it you can cancel the payment.

    The required parameters for that call include the paymentId.

    Capture payments

    By now you have only authorized (reserved) the funds. After you have sent the goods to the customer, it is time to capture the amount with the Capture Payment call. If necessary, you may capture only a part of the authorized amount.

    US - Code Sample - Capture payment

    curl --request POST \
      --url https://unifiedapi.netsdev.eu/api/v1/payments//%7BpaymentId%7D/Capture \
      --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
      --header 'content-type: application/json' \

    If succesfull, you will receive the PaymentId as a response: The amount has now been captured.

    Refund a payment

    If the customer returns the product or the purchase is cancelled for any other reason, and you have already captured the payment, you need to credit a previously captured amount by performing the Refund a payment call. During the credit, the captured amount is returned to the customer's account. If necessary, you can credit only a part of the captured amount.

    Was this helpful?

    What was your feeling about it?