Skip to content
Payment Requests

Pay a Payment Request

POST/api/payment-requests/{paymentRequestId}/pay

To pay a Payment Request you must supply the name of the Asset Type, idempotencyKey and one of assetId, transactionId or authorization.

  • Use assetId if the Asset Type is managed by Centrapay.
  • Use transactionId to verify an external transaction such as a Bitcoin payment.
  • Use authorization to authorize an external transaction.

Path parameters

  • paymentRequestIdrequired string
    The Payment Request id.

Request body

  • amountoptional bignumber
    The value required to pay using the canonical units for the Asset Type.
  • assetIdoptional string
    The id of the Asset being used to make payment.
  • assetTyperequired string
    An Asset Type reference.
  • authorizationoptional string
    Used to authorize an external transaction.
  • externalPaymentRefoptional string
    An external reference to the payment. Required when assetType is farmlands.nzd.*.
  • idempotencyKeyrequired string
    A unique identifier that prevents duplicate processing of the same request. See idempotency.
  • lineItemsoptional array of objects
    The Line Items associated with this payment attempt. This field is only allowed for centrapay.token.* payments. If omitted for centrapay.token.* payments, the highest-value valid line item from the payment request will be used by default.
    • 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.
  • modeoptional enum
    The mode of payment.
    • multi-asset-payment
      Pays part of the amount with this asset. The Payment Request stays open until fully paid, with at most 20 payments.
    • partial-payment
      Pays only part of the amount, and the Payment Request is then marked paid. Requires partialAllowed on the Payment Request.
  • transactionIdoptional string
    Used to verify an external transaction eg Bitcoin.

Responses

Request
curl -X POST https://service.centrapay.com/api/payment-requests/MhocUmpxxmgdHjr7DgKoKw/pay \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '{
"amount": "200",
"assetId": "WRhAxxWpTKb5U7pXyxQjjY",
"assetType": "centrapay.nzd.main",
"externalPaymentRef": "62e4b0d7-551b-4b93-8b62-28265b4457d1",
"idempotencyKey": "b62-11ec-9072-3e22fb52e878",
"mode": "partial-payment"
}'