Skip to content
Payment Requests

Create a Payment Request

POST/api/payment-requests

This endpoint allows you to create a Payment Request for a given Merchant Config and value.

Request body

  • barcodeoptional string
    Scanned Code used to create the Payment Request. Required when the Quick Pay payment flow is used.
  • barcodeTypeoptional string
    Indicates the provider of a barcode, e.g. ticketek.
  • basketAmountoptional bignumber
    The total amount of the transaction including non Centrapay payment methods. Required when partialAllowed is true.
  • collectionIdoptional string
    The identifier of the Token Collection.
  • conditionsEnabledoptional boolean
    Flag to indicate that a merchant is able to accept Payment Conditions. Set it when creating a Payment Request; if a condition arises without it, the Payment Request is cancelled.
  • configIdrequired string
    The Merchant Config id used to configure the payment options.
  • connectionIdoptional stringexperimental
    The identifier of the Connection associated with the payment request.
  • createdByAccountNameoptional string
    Name of the Centrapay Account creating the Payment Request.
  • deviceIdoptional string
    The hardware id or serial number of the payment terminal.
  • expirySecondsoptional integer
    The expiry seconds used to configure the Payment Request expiry.
  • externalRefoptional string
    An external reference to the Payment Request.
  • invoiceRefoptional string
    A reference to an invoice for this Payment Request. Must be less than or equal to 128 characters.
  • lineItemsoptional array of objects
    The Line Items being paid for. Line Item currency and units are consistent with the Payment Request value, and the sum of Line Item prices should equal the Payment Request value.
    • classificationoptional object
      Product Classification.
      • codeoptional string
        The classification code.
      • nameoptional string
        The classification title.
      • propsoptional object
        The product classification properties. Classification properties allow optional additional product characterizing attrubutes to be supplied. In the case of GS1 product classifications this corresponds to the GPC brick attributes.
      • typeoptional enum
        The classification type. See GS1 Global Product Classification. When GS1 is used as the product classification type then the product code should be the GPC product brick identifier.
    • discountoptional bignumber
      Discount amount in cents (tax exclusive). A discount that applies to multiple Line Items may be represented as a separate Line Item with a negative amount.
    • metadataoptional object
      A set of up to 20 key-value string pairs for storing additional structured information about the line item. Keys may be up to 40 characters; values up to 500 characters.
    • namerequired string
      The product description.
    • pricerequired bignumber
      The total price in cents for the line item (eg. price = product price * qty - discounts + tax). Either price or unitPrice is required; if both are supplied, price takes priority.
    • productIdoptional string
      Manufacturer's product identifier (eg GTIN/EAN).
    • qtyrequired bignumber
      The product quantity (eg. item count, weight, volume etc).
    • restrictedoptional boolean
      Disallow payment with a “restricted” Asset Type.
    • skuoptional string
      The product (stock keeping unit) code. Required for Token redemptions.
    • taxoptional bignumber
      Tax rate (percentage).
    • unitMeasureoptional string
      A free-text label describing the unit of qty (eg. kg, L, seat). Display only, maximum 20 characters.
    • unitPriceoptional string
      The price of a single unit of qty, in cents. Used to compute price when price is not supplied.
  • operatorIdoptional string
    POS operator Id.
  • partialAllowedoptional boolean
    Flag to indicate that the Payment Request can be paid for partially.
  • patronNotPresentoptional boolean
    Flag to indicate the patron is not physically present. This may affect payment conditions or available Payment Options.
  • paymentLinkIdoptional stringexperimental
    The identifier of the Payment Link.
  • preAuthoptional boolean
    Flag to indicate if the request is a Pre Auth for supported Asset Types.
  • purchaseOrderRefoptional string
    A reference to a purchase order for this Payment Request.
  • redirectCancelUrloptional stringexperimental
    URL to redirect the user to after they cancel the Payment Request. Must start with one of the allowedRedirectUrls for the Merchant Config.
  • redirectPaidUrloptional stringexperimental
    URL to redirect the user to after they pay the Payment Request. Must start with one of the allowedRedirectUrls for the Merchant Config.
  • terminalIdoptional string
    The software or logical id of the payment terminal.
  • valuerequired monetary
    The canonical value of the Payment Request. Must be less than 100000000 and positive.

Responses

Request
curl -X POST https://service.centrapay.com/api/payment-requests \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '{
"configId": "mc_5efbe2fb96c08357bb2b9242",
"connectionId": "cn_9asd9k19",
"expirySeconds": 120,
"lineItems": [
{
"discount": "400",
"name": "Hard Hat",
"price": "4000",
"qty": "1",
"sku": "GH1234",
"tax": "15"
},
{
"discount": "600",
"name": "Tool Belt",
"price": "6000",
"qty": "1",
"sku": "GH1234",
"tax": "15"
}
],
"paymentLinkId": "pl_5srt998b",
"value": {
"amount": "10000",
"currency": "NZD"
}
}'