Guides

Farmlands POS Integration Guide

Centrapay and Farmlands have entered a partnership to enable a digital way for Farmlands Card Partners to accept Farmlands Card as payment at the point of sale. This solution will position Card Partners to be able to also accept a digital form of the Farmlands Card in the future.

Farmlands Card Partners need to be approved by Farmlands prior to enabling Farmlands Card as a payment option through the Centrapay integration. Contact your Card Portfolio Manager or the Card Specialist team at card.specialist@farmlands.co.nz to work through the onboarding process.

Centrapay Integration Benefits

Integrating with Centrapay streamlines the process for authorising and invoicing Farmlands Card Payments. The integration provides:

  1. Ability to complete real-time, industry standard card checks
  2. Reduced exposure to card fraud.

Secure and instant means of sending full invoice details to Farmlands. Improved staff & customer experiences through ease of facilitating a Farmlands payment. Merchants can opt-in to accept other assets as payment methods with Centrapay.

Payment Flow Overview

Farmlands integrations use Centrapay’s Quick Pay Barcode Flow For Merchants to connect to Cardholders and accept Farmlands transactions.

See also: Requesting Payment

Loading Diagram...

  1. The Farmlands Cardholder presents their Farmlands Card for payment. The cashier at the point of sale will scan the Barcode or manually enter the 9-digit Farmlands Card number.

    The Card number is under the Cardholder’s name on the front of the card; and under the barcode on the back of the card.

The back of an example Farmlands card, displaying a barcode and a 9-digit card number
  1. The POS creates a Payment Request  API  with the Farmlands Card barcode.
Request
POST/api/payment-requests
curl -X POST https://service.centrapay.com/api/payment-requests \
  -H "X-Api-Key: $api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "barcode": "123456789",
    "conditionsEnabled": true,
    "configId": "5ee168e8597be5002af7b454",
    "invoiceRef": "sy8CRmo3sp3ArOpnfmb423",
    "lineItems": [
      {
        "name": "Hard Hat",
        "sku": "GH1234",
        "qty": "1",
        "price": "4000",
        "tax": "15",
        "discount": "400"
      },
      {
        "name": "Tool Belt",
        "sku": "GH1234",
        "qty": "1",
        "price": "6000",
        "tax": "15",
        "discount": "600"
      }
    ],
    "purchaseOrderRef": "oF6kj1QlH5gK0y9rjRHFh2",
    "value": {
      "amount": "10000",
      "currency": "NZD"
    }
  }'
Response
{
  "barcode": "123456789",
  "conditionsEnabled": true,
  "configId": "5ee168e8597be5002af7b454",
  "createdAt": "2021-06-08T04:04:27.426Z",
  "expiresAt": "2021-06-08T04:06:27.426Z",
  "expirySeconds": 120,
  "id": "MhocUmpxxmgdHjr7DgKoKw",
  "invoiceRef": "sy8CRmo3sp3ArOpnfmb423",
  "lineItems": [
    {
      "name": "Hard Hat",
      "sku": "GH1234",
      "qty": "1",
      "price": "4000",
      "tax": "15",
      "discount": "400"
    },
    {
      "name": "Tool Belt",
      "sku": "GH1234",
      "qty": "1",
      "price": "6000",
      "tax": "15",
      "discount": "600"
    }
  ],
  "merchantConditions": [
    {
      "id": "1",
      "name": "photo-id-check",
      "message": "Please check ID",
      "status": "awaiting-merchant"
    }
  ],
  "merchantId": "26d3Cp3rJmbMHnuNJmks2N",
  "merchantName": "Farmlands Card Partner",
  "patronCodeId": "V17FByEP9gm1shSG6a1Zzx",
  "paymentOptions": [
    {
      "amount": "10000",
      "assetType": "farmlands.nzd.main"
    }
  ],
  "purchaseOrderRef": "oF6kj1QlH5gK0y9rjRHFh2",
  "shortCode": "CP-C7F-ZS5",
  "status": "new",
  "updatedAt": "2021-06-08T04:04:27.426Z",
  "url": "https://app.centrapay.com/pay/MhocUmpxxmgdHjr7DgKoKw",
  "value": {
    "currency": "NZD",
    "amount": "10000"
  }
}
  1. The POS polls the Payment Request  API  every second for status changes.
Request
GET/api/payment-requests/{paymentRequestId}
curl https://service.centrapay.com/api/payment-requests/MhocUmpxxmgdHjr7DgKoKw \
  -H "Authorization: $jwt"
Response
{
  "barcode": "123456789",
  "conditionsEnabled": true,
  "configId": "5ee168e8597be5002af7b454",
  "createdAt": "2021-06-08T04:04:27.426Z",
  "expiresAt": "2021-06-08T04:06:27.426Z",
  "expirySeconds": 120,
  "id": "MhocUmpxxmgdHjr7DgKoKw",
  "invoiceRef": "sy8CRmo3sp3ArOpnfmb423",
  "lineItems": [
    {
      "name": "Hard Hat",
      "sku": "GH1234",
      "qty": "1",
      "price": "4000",
      "tax": "15",
      "discount": "400"
    },
    {
      "name": "Tool Belt",
      "sku": "GH1234",
      "qty": "1",
      "price": "6000",
      "tax": "15",
      "discount": "600"
    }
  ],
  "merchantConditions": [
    {
      "id": "1",
      "name": "photo-id-check",
      "message": "Please check ID",
      "status": "awaiting-merchant"
    }
  ],
  "merchantId": "26d3Cp3rJmbMHnuNJmks2N",
  "merchantName": "Farmlands Card Partner",
  "patronCodeId": "V17FByEP9gm1shSG6a1Zzx",
  "paymentOptions": [
    {
      "amount": "10000",
      "assetType": "farmlands.nzd.main"
    }
  ],
  "purchaseOrderRef": "oF6kj1QlH5gK0y9rjRHFh2",
  "shortCode": "CP-C7F-ZS5",
  "status": "new",
  "updatedAt": "2021-06-08T04:04:27.426Z",
  "url": "https://app.centrapay.com/pay/MhocUmpxxmgdHjr7DgKoKw",
  "value": {
    "currency": "NZD",
    "amount": "10000"
  }
}
  1. Polling the Payment Request  API  returns a list of pending merchantConditions in the response. The POS must prompt the cashier to accept  API  or decline  API  each Payment Condition in order to successfully complete a payment.
Request
POST/api/payment-requests/{paymentRequestId}/conditions/{conditionId}/accept
curl -X POST https://service.centrapay.com/api/payment-requests/MhocUmpxxmgdHjr7DgKoKw/conditions/1/accept \
  -H "X-Api-Key: $api_key"
Response
{
  "activityNumber": "2",
  "conditionId": "1",
  "createdAt": "2022-05-12T01:17:00.000Z",
  "createdBy": "crn::user:0af834c8-1110-11ec-9072-3e22fb52e878",
  "merchantAccountId": "C4QnjXvj8At6SMsEN4LRi9",
  "merchantConfigId": "5ee168e8597be5002af7b454",
  "merchantId": "26d3Cp3rJmbMHnuNJmks2N",
  "merchantName": "Farmlands Card Partner",
  "paymentRequestCreatedBy": "crn::user:0af834c8-1110-11ec-9072-3e22fb52e878",
  "paymentRequestId": "MhocUmpxxmgdHjr7DgKoKw",
  "type": "accept-condition",
  "value": {
    "currency": "NZD",
    "amount": 100
  }
}

A successful payment is identified when all Payment Conditions have an accepted status and the Payment Request  API  status is paid. Here, the POS must stop polling and display confirmation of the successful payment.

Request
GET/api/payment-requests/{paymentRequestId}
curl https://service.centrapay.com/api/payment-requests/MhocUmpxxmgdHjr7DgKoKw \
  -H "Authorization: $jwt"
Response
{
  "barcode": "123456789",
  "conditionsEnabled": true,
  "configId": "5ee168e8597be5002af7b454",
  "createdAt": "2021-06-08T04:04:27.426Z",
  "expiresAt": "2021-06-08T04:06:27.426Z",
  "expirySeconds": 120,
  "id": "MhocUmpxxmgdHjr7DgKoKw",
  "invoiceRef": "sy8CRmo3sp3ArOpnfmb423",
  "lineItems": [
    {
      "name": "Hard Hat",
      "sku": "GH1234",
      "qty": "1",
      "price": "4000",
      "tax": "15",
      "discount": "400"
    },
    {
      "name": "Tool Belt",
      "sku": "GH1234",
      "qty": "1",
      "price": "6000",
      "tax": "15",
      "discount": "600"
    }
  ],
  "merchantConditions": [
    {
      "id": "1",
      "name": "photo-id-check",
      "message": "Please check ID",
      "status": "accepted"
    }
  ],
  "merchantId": "26d3Cp3rJmbMHnuNJmks2N",
  "merchantName": "Farmlands Card Partner",
  "patronCodeId": "V17FByEP9gm1shSG6a1Zzx",
  "paymentOptions": [
    {
      "amount": "10000",
      "assetType": "farmlands.nzd.main"
    }
  ],
  "purchaseOrderRef": "oF6kj1QlH5gK0y9rjRHFh2",
  "shortCode": "CP-C7F-ZS5",
  "status": "paid",
  "updatedAt": "2021-06-08T04:04:27.426Z",
  "url": "https://app.centrapay.com/pay/MhocUmpxxmgdHjr7DgKoKw",
  "value": {
    "currency": "NZD",
    "amount": "10000"
  }
}

Payment Flow Implementation

The Payment Flow can only be used by existing Farmlands Card Partners. Card Partners must complete the following steps to accept Farmlands transactions.

  1. Each Card Partner site must be correctly set up as a Merchant  API  in Centrapay’s system.
  2. Centrapay needs to supply Card Partners with API keys to allow them to authenticate their API requests.
  3. Card Partners must meet basic payment requirements, including supporting Payment Conditions and Refunds in order to implement the Barcode Payment Flow.
  4. Card Partners should extend the Barcode payment Flow to meet any additional requirements, these optional extensions include:

Merchant Configuration

Each Card Partner site that needs to accept Farmlands Card payments must be set up as a separate Centrapay Merchant  API  with its own Merchant Config  API . The Merchant Config contains a Farmlands Payment Option  API  that allows the site to accept Farmlands Payments.

The POS needs to provide the unique Merchant Config ID for the Merchant when creating Payment Requests  API  on their behalf.

Merchants and Merchant Configs are managed by Centrapay. Farmlands will provide Card Partners with these details.

Authentication

Requests to Centrapay’s APIs are authenticated  API  by providing an API key in the X-Api-Key header. API Keys  API  provide enduring access to a single Centrapay account.

Request
GET/api/account-memberships
curl https://service.centrapay.com/api/account-memberships \
  -H "X-Api-Key: $api_key"

Contact integrations@centrapay.com to be issued with your API keys.

Basic Requirements

The Payment Flow needs the following requirements to be met.

Payment Conditions

Farmlands Card Partners must support this extension.

This extension enables the POS to enforce requiring an ID check for high-risk transactions.

Card Partners must extend the Barcode Flow to support this by creating Payment Requests  API  with the conditionsEnabled flag set to true. The response will include the merchantConditions that must be accepted, and each condition will include a message field that the POS can display to the cashier.

The Payment Request must always be polled after accepting or declining a condition.

See also: Payment Conditions

Pre Auth

Farmlands Card Partners must support this extension when there is not an invoice number available at the point of sale or the purchase cannot be fulfilled immediately. This might happen if your stock is not on hand or you have a separate fulfilment process.

This extension enables the POS to create an authorisation that ensures funds are available and places a hold on them.

Card Partners can extend the Barcode Flow to support this by creating Payment Requests  API  with the preAuth flag set to true.

Pre Auth Sequence

Loading Diagram...

  1. The Cardholder presents their Farmlands Card for the POS to scan.
  2. The POS authorises a Pre Auth payment by creating a Payment Request  API  with the barcode on the Farmlands Card and the preauth flag. Creating a Payment Request must also enable the Payment Conditions extension and include full details for all Line Items  API .
Request
POST/api/payment-requests
curl -X POST https://service.centrapay.com/api/payment-requests \
  -H "X-Api-Key: $api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "barcode": "123456789",
    "conditionsEnabled": true,
    "configId": "5ee168e8597be5002af7b454",
    "lineItems": [
      {
        "name": "Hard Hat",
        "sku": "GH1234",
        "qty": "1",
        "price": "4000",
        "tax": "15",
        "discount": "400"
      },
      {
        "name": "Tool Belt",
        "sku": "GH1234",
        "qty": "1",
        "price": "6000",
        "tax": "15",
        "discount": "600"
      }
    ],
    "preAuth": true,
    "value": {
      "amount": "10000",
      "currency": "NZD"
    }
  }'
Response
{
  "barcode": "123456789",
  "conditionsEnabled": true,
  "configId": "5efbe2fb96c08357bb2b9242",
  "createdAt": "2021-06-08T04:04:27.426Z",
  "expiresAt": "2021-06-08T04:06:27.426Z",
  "expirySeconds": 120,
  "id": "MhocUmpxxmgdHjr7DgKoKw",
  "invoiceRef": "sy8CRmo3sp3ArOpnfmb423",
  "lineItems": [
    {
      "name": "Hard Hat",
      "sku": "GH1234",
      "qty": "1",
      "price": "4000",
      "tax": "15",
      "discount": "400"
    },
    {
      "name": "Tool Belt",
      "sku": "GH1234",
      "qty": "1",
      "price": "6000",
      "tax": "15",
      "discount": "600"
    }
  ],
  "merchantConditions": [
    {
      "id": "1",
      "name": "photo-id-check",
      "message": "Please check ID",
      "status": "awaiting-merchant"
    }
  ],
  "merchantId": "26d3Cp3rJmbMHnuNJmks2N",
  "merchantName": "Farmlands Card Partner",
  "paymentOptions": [
    {
      "amount": "10000",
      "assetType": "farmlands.nzd.main"
    }
  ],
  "patronCodeId": "V17FByEP9gm1shSG6a1Zzx",
  "purchaseOrderRef": "oF6kj1QlH5gK0y9rjRHFh2",
  "shortCode": "CP-C7F-ZS5",
  "status": "new",
  "updatedAt": "2021-06-08T04:04:27.426Z",
  "url": "https://app.centrapay.com/pay/MhocUmpxxmgdHjr7DgKoKw",
  "value": {
    "currency": "NZD",
    "amount": "10000"
  }
}
  1. The POS polls the Payment Request  API  every second for status changes.
Request
GET/api/payment-requests/{paymentRequestId}
curl https://service.centrapay.com/api/payment-requests/MhocUmpxxmgdHjr7DgKoKw \
  -H "Authorization: $jwt"
Response
{
  "barcode": "123456789",
  "conditionsEnabled": true,
  "configId": "5ee168e8597be5002af7b454",
  "createdAt": "2021-06-08T04:04:27.426Z",
  "expiresAt": "2021-06-08T04:06:27.426Z",
  "expirySeconds": 120,
  "id": "MhocUmpxxmgdHjr7DgKoKw",
  "invoiceRef": "sy8CRmo3sp3ArOpnfmb423",
  "lineItems": [
    {
      "name": "Hard Hat",
      "sku": "GH1234",
      "qty": "1",
      "price": "4000",
      "tax": "15",
      "discount": "400"
    },
    {
      "name": "Tool Belt",
      "sku": "GH1234",
      "qty": "1",
      "price": "6000",
      "tax": "15",
      "discount": "600"
    }
  ],
  "merchantConditions": [
    {
      "id": "1",
      "name": "photo-id-check",
      "message": "Please check ID",
      "status": "awaiting-merchant"
    }
  ],
  "merchantId": "26d3Cp3rJmbMHnuNJmks2N",
  "merchantName": "Farmlands Card Partner",
  "patronCodeId": "V17FByEP9gm1shSG6a1Zzx",
  "paymentOptions": [
    {
      "amount": "10000",
      "assetType": "farmlands.nzd.main"
    }
  ],
  "purchaseOrderRef": "oF6kj1QlH5gK0y9rjRHFh2",
  "shortCode": "CP-C7F-ZS5",
  "status": "new",
  "updatedAt": "2021-06-08T04:04:27.426Z",
  "url": "https://app.centrapay.com/pay/MhocUmpxxmgdHjr7DgKoKw",
  "value": {
    "currency": "NZD",
    "amount": "10000"
  }
}
  1. Polling the Payment Request  API  returns a list of pending merchantConditions in the response. The POS must prompt the cashier to accept  API  or decline  API  each Payment Condition in order to successfully authorise a Pre Auth payment.
Request
POST/api/payment-requests/{paymentRequestId}/conditions/{conditionId}/accept
curl -X POST https://service.centrapay.com/api/payment-requests/MhocUmpxxmgdHjr7DgKoKw/conditions/1/accept \
  -H "X-Api-Key: $api_key"
Response
{
  "activityNumber": "2",
  "conditionId": "1",
  "createdAt": "2022-05-12T01:17:00.000Z",
  "createdBy": "crn::user:0af834c8-1110-11ec-9072-3e22fb52e878",
  "merchantAccountId": "C4QnjXvj8At6SMsEN4LRi9",
  "merchantConfigId": "5ee168e8597be5002af7b454",
  "merchantId": "26d3Cp3rJmbMHnuNJmks2N",
  "merchantName": "Farmlands Card Partner",
  "paymentRequestCreatedBy": "crn::user:0af834c8-1110-11ec-9072-3e22fb52e878",
  "paymentRequestId": "MhocUmpxxmgdHjr7DgKoKw",
  "type": "accept-condition",
  "value": {
    "currency": "NZD",
    "amount": 100
  }
}

A successful authorisation is identified when all Payment Conditions have an accepted status, the Payment Request  API  status is paid and the preAuthStatus is authorized. Here, the POS must stop polling and display confirmation of the successful authorisation.

Request
GET/api/payment-requests/{paymentRequestId}
curl https://service.centrapay.com/api/payment-requests/MhocUmpxxmgdHjr7DgKoKw \
  -H "Authorization: $jwt"
Response
{
  "barcode": "123456789",
  "conditionsEnabled": true,
  "configId": "5ee168e8597be5002af7b454",
  "createdAt": "2021-06-08T04:04:27.426Z",
  "expiresAt": "2021-06-08T04:06:27.426Z",
  "expirySeconds": 120,
  "id": "MhocUmpxxmgdHjr7DgKoKw",
  "invoiceRef": "sy8CRmo3sp3ArOpnfmb423",
  "lineItems": [
    {
      "name": "Hard Hat",
      "sku": "GH1234",
      "qty": "1",
      "price": "4000",
      "tax": "15",
      "discount": "400"
    },
    {
      "name": "Tool Belt",
      "sku": "GH1234",
      "qty": "1",
      "price": "6000",
      "tax": "15",
      "discount": "600"
    }
  ],
  "merchantConditions": [
    {
      "id": "1",
      "name": "photo-id-check",
      "message": "Please check ID",
      "status": "accepted"
    }
  ],
  "merchantId": "26d3Cp3rJmbMHnuNJmks2N",
  "merchantName": "Farmlands Card Partner",
  "patronCodeId": "V17FByEP9gm1shSG6a1Zzx",
  "paymentOptions": [
    {
      "amount": "10000",
      "assetType": "farmlands.nzd.main"
    }
  ],
  "preAuthStatus": "authorized",
  "purchaseOrderRef": "oF6kj1QlH5gK0y9rjRHFh2",
  "shortCode": "CP-C7F-ZS5",
  "status": "paid",
  "updatedAt": "2021-06-08T04:04:27.426Z",
  "url": "https://app.centrapay.com/pay/MhocUmpxxmgdHjr7DgKoKw",
  "value": {
    "currency": "NZD",
    "amount": "10000"
  }
}
  1. When the purchase is ready to be fulfilled, the POS makes a Pre Auth confirmation  API  against the Payment Request  API . Multiple confirmations can be performed against an authorisation but the total value cannot exceed the original authorised value.
Request
POST/api/payment-requests/{paymentRequestId}/confirm
curl -X POST https://service.centrapay.com/api/payment-requests/MhocUmpxxmgdHjr7DgKoKw/confirm \
  -H "X-Api-Key: $api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "idempotencyKey": "e8df06e2-13a5-48b4-b670-3fd6d815fe0a",
    "invoiceRef": "sy8CRmo3sp3ArOpnfmb423",
    "lineItems": [
      {
        "name": "Hard Hat",
        "sku": "GH1234",
        "qty": "1",
        "price": "4000",
        "tax": "15",
        "discount": "400"
      }
    ],
    "value": {
      "amount": "4000",
      "currency": "NZD"
    },
  }'
Response
{
  "activityNumber": "3",
  "createdAt": "2021-06-08T04:04:27.426Z",
  "createdByAccountId": "Jaim1Cu1Q55uooxSens6yk",
  "createdByAccountName": "Farmlands Card Partner",
  "idempotencyKey": "e8df06e2-13a5-48b4-b670-3fd6d815fe0a",
  "invoiceRef": "sy8CRmo3sp3ArOpnfmb423",
  "lineItems": [
    {
      "name": "Hard Hat",
      "sku": "GH1234",
      "qty": "1",
      "price": "4000",
      "tax": "15",
      "discount": "400"
    }
  ],
  "paymentRequestId": "MhocUmpxxmgdHjr7DgKoKw",
  "preAuth": true,
  "shortCode": "CP-C7F-ZS5-03",
  "type": "confirmation",
  "updatedAt": "2021-06-08T04:04:27.426Z",
  "value": {
    "amount": "4000",
    "currency": "NZD"
  }
}
  1. The POS releases any remaining authorised funds  API  against the Payment Request  API  back to the Cardholder. To confirm if there are funds requiring release you can list payment activities  API  and sum the confirmation payment activities  API .

Only call release if there are funds requiring release.

Request
POST/api/payment-requests/{paymentRequestId}/release
curl -X POST https://service.centrapay.com/api/payment-requests/MhocUmpxxmgdHjr7DgKoKw/release \
  -H "X-Api-Key: $api_key"
Response
{
  "activityNumber": "4",
  "assetType": "farmlands.nzd.main",
  "createdAt": "2021-06-12T01:17:00.000Z",
  "createdBy": "crn::user:0af834c8-1110-11ec-9072-3e22fb52e878",
  "merchantAccountId": "C4QnjXvj8At6SMsEN4LRi9",
  "merchantConfigId": "5ee168e8597be5002af7b454",
  "merchantId": "26d3Cp3rJmbMHnuNJmks2N",
  "merchantName": "Farmlands Card Partner",
  "paymentRequestCreatedBy": "crn::user:0af834c8-1110-11ec-9072-3e22fb52e878",
  "paymentRequestId": "MhocUmpxxmgdHjr7DgKoKw",
  "preAuth": true,
  "shortCode": "CP-C7F-ZS5-05",
  "type": "release",
  "value": {
    "currency": "NZD",
    "amount": "6000"
  }
}

Cardholder Not Present

Farmlands Card Partners must support this extension if they accept payments when the Cardholder is not physically present when a payment is authorised. For example, to accept phone-based orders or orders where the Farmlands barcode is already known.

Please refer to your Farmlands Card Partner Acceptance Terms and Conditions to understand the risks involved with these transactions.

Card Partners can extend the Barcode Flow to support this by creating Payment Requests  API  with the patronNotPresent flag set to true.

Request
POST/api/payment-requests
curl -X POST https://service.centrapay.com/api/payment-requests \
  -H "X-Api-Key: $api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "barcode": "123456789",
    "conditionsEnabled": true,
    "configId": "5ee168e8597be5002af7b454",
    "invoiceRef": "sy8CRmo3sp3ArOpnfmb423",
    "lineItems": [
      {
        "name": "Hard Hat",
        "sku": "GH1234",
        "qty": "1",
        "price": "4000",
        "tax": "15",
        "discount": "400"
      },
      {
        "name": "Tool Belt",
        "sku": "GH1234",
        "qty": "1",
        "price": "6000",
        "tax": "15",
        "discount": "600"
      }
    ],
    "patronNotPresent": true,
    "purchaseOrderRef": "oF6kj1QlH5gK0y9rjRHFh2",
    "value": {
      "amount": "10000",
      "currency": "NZD"
    }
  }'

See also: Patron Not Present

Validating Farmlands Barcodes

Farmlands Card Partners may optionally decode a scanned Farmlands Barcode  API  to confirm that it is valid and apply Farmlands discounts before creating a Payment Request  API .

Request
POST/api/decode
curl -X POST https://service.centrapay.com/api/decode \
  -H "Authorization: $jwt" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "123456789",
    "merchantConfigId": "5ee168e8597be5002af7b454",
    "scannedBy": "merchant"
  }'
Response
{
  "code": "123456789",
  "displayName": "Farmlands Card",
  "merchantConfigId": "5ee168e8597be5002af7b454",
  "provider": "farmlands",
  "scannedBy": "merchant"
}

Handling Payment Errors

The POS must follow Centrapay’s guidelines on handling errors when dealing with inconsistencies in Payment Request  API  statuses due to network issues or race conditions.

Refunds

Farmlands Card Partners must support refunds.

Cardholder purchases are refunded by refunding the Payment Request  API .

When the Cardholder presents a transaction reference (e.g. a Payment Request  API  short code or externalRef) on their paper receipt, the POS should use this reference to look up the Payment Request ID and initiate the refund.

Loading Diagram...

  1. The Cardholder presents a transaction reference on their paper receipt. The POS looks up the Payment Request  API  ID using the transaction reference.
  2. The POS refunds the Payment Request  API  using its ID.
Request
POST/api/payment-requests/{paymentRequestId}/refund
curl -X POST https://service.centrapay.com/api/payment-requests/{paymentRequestId}/refund \
  -H "X-Api-Key: $api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "externalRef": "e8df06e2-13a5-48b4-b670-3fd6d815fe0a",
    "merchantConfigId": "5ee168e8597be5002af7b454",
    "lineItems": [
      {
        "name": "Tool Belt",
        "sku": "GH1234",
        "qty": "1",
        "price": "6000",
        "tax": "15",
        "discount": "600"
      }
    ],
    "value": {
      "amount": "6000",
      "currency": "NZD"
    }
  }'
Response
{
  "activityNumber": "4",
  "assetType": "farmlands.nzd.main",
  "createdAt": "2021-06-12T01:17:00.000Z",
  "createdBy": "crn::user:0af834c8-1110-11ec-9072-3e22fb52e878",
  "invoiceRef": "sy8CRmo3sp3ArOpnfmb423",
  "merchantAccountId": "C4QnjXvj8At6SMsEN4LRi9",
  "merchantConfigId": "5ee168e8597be5002af7b454",
  "merchantId": "5ee0c486308f590260d9a07f",
  "merchantName": "Farmlands Card Partner",
  "paymentRequestCreatedBy": "crn::user:0af834c8-1110-11ec-9072-3e22fb52e878",
  "paymentRequestId": "MhocUmpxxmgdHjr7DgKoKw",
  "shortCode": "CP-C7F-ZS5-04",
  "type": "refund",
  "value": {
    "currency": "NZD",
    "amount": "100"
  }
}

See also: Initiating Refunds

Short Codes

Payment Requests  API  have a short code field that is human- and OCR-friendly. When combined with the date or merchant id, short codes can unambiguously identify the correct Payment Request.

Short codes can be used for initiating refunds by making them available to the Cardholder on a paper printout.

Card Partners should store the short code for each transaction. This helps with reconciliation if a transaction query occurs.

Some Payment Activities  API  are repeatable (e.g. Pre Auth Confirmations and Refunds) so these have their own unique short code in order to disambiguate them. The short codes for these activities are different from the original Payment Request short code.

Testing Your Integration

Merchant Integrators need to work with Farmlands and Centrapay to get set up to test payments. Please contact Farmlands to organise full end-to-end testing.

You need to go through the following steps in order to test your integration in a test environment:

  1. Centrapay must set you up with a test merchant and merchant config ID, and issue you with an API key before you can make API requests.

  2. Integrators can use the Farmlands test barcodes below to test different scenarios.

    Test ScenarioFarmlands Card Barcode
    Active Card with available balance424242424
    Active Card with no available balance434343434
    Expired Card454545454
    Inactive Card464646464
  3. Centrapay can set you up with a Centrapay Portal account and a test Merchant to allow you to verify that transactions are being processed correctly.

Certification Requirements

For Centrapay to allow integrations to have production assets turned on, we require partners to complete a Certification Process.

The Certification Process includes checking that Farmlands POS integrators are meeting Centrapay’s Point Of Sale requirements, and the following additional requirements.

POS Requirements

  • The POS MUST support manual barcode entry.
  • The POS scanner SHOULD be capable of scanning the barcode on the back of a Farmlands Card.

Barcode Flow Requirements

Line Item Requirements

  • Full details for Line Items  API  MUST include the description, SKU, quantity, price, tax and the discount provided to the Cardholder.
  • The price of a Line Item MUST represent the amount that a Cardholder will pay for that Line Item, including tax and any discounts applied.
  • The total for all Line Item prices MUST sum to the Payment Request  API  amount.
  • The price and discount for each Line Item MUST be provided in cents.
  • The currency for each Line Item MUST be consistent with the Payment Request value.

Patron Not Present Requirements

  • The Patron Not Present extension SHOULD be supported. This is required when the Cardholder is not physically present (e.g. over the phone) or when the Farmlands Barcode is already known.

Pre Auth Requirements

  • The Pre Auth extension MUST be supported when invoice numbers are not available at the time of purchase.
  • Payment Request  API  short codes MUST be included when completion is performed through existing reconciliation channels.
  • Pre Auth Confirmations MUST be made with an idempotencyKey in order to prevent merchants from drawing down on authorised funds twice.
  • Pre Auth Confirmations MUST include an invoice number and full details for all Line Items  API .
  • Authorised funds that will not be confirmed MUST be released  API  in order to return the funds to the Cardholder (e.g. orders that are cancelled before fulfilment).
  • Confirmed funds MUST be refunded  API  in order to return them to the Cardholder. They cannot be released.

Refund Requirements

  • Refunds  API  can be partial or full. Partial refunds can be performed multiple times but the total refunded amount cannot exceed the paid amount.

  • You MUST include an externalRef field, unique to each refund transaction, in order to ensure that a refund request can be retried safely.

  • At least one of externalRef and shortCode MUST be available to the patron (eg, on paper print-out).

  • You MUST include an invoice number and full details for all Line Items  API .

  • Short codes for refunds MUST be included when sending a PDF invoice or EDI file to Farmlands for settlement.

    Refunds have their own short code that is different to the Payment Request short code.

  • Refunds made against a Pre Auth Confirmation MUST include the confirmationIdempotencyKey field used for original confirmation.

Next Steps

  1. Processing Farmlands Card transactions through the Centrapay platform is only available to existing Farmlands Card Partners. Existing Card Partners who are interested in integrating with Centrapay should contact their Card Partnership Manager or the Card Specialist team at card.specialist@farmlands.co.nz to work through the onboarding process.
  2. Reach out to integrations@centrapay.com to get your API keys and a copy of Centrapay’s Certification Process.