Application Packaging Standard

Last updated 18-Mar-2019

PaymentManagement

Singleton APS resource with methods for operations with payments.

Schema

The considered APS type (download) extends the Resource APS type(s) and looks as follows:

{
  "name": "PaymentManagement",
  "id": "http://www.odin.com/billing/payment-management/1.0",
  "apsVersion": "2.0",
  "implements": [
    "http://aps-standard.org/types/core/resource/1.0"
  ],
  "access": {
    "global": true
  },
  "operations": {
    "pay": {
      "path": "/payment",
      "verb": "POST",
      "response": {
        "type": "APSPaymentCreationResult"
      },
      "errorResponse": {
        "type": "object"
      },
      "parameters": {
        "params": {
          "kind": "body",
          "type": "APSPaymentCreationRequest"
        }
      }
    },
    "payments": {
      "path": "/payments",
      "verb": "GET",
      "response": {
        "type": "array",
        "items": {
          "type": "APSPayment"
        }
      },
      "errorResponse": {
        "type": "object"
      },
      "parameters": {
        "paymentIds": {
          "kind": "query",
          "type": "string"
        }
      }
    }
  },
  "structures": {
    "RedirectData": {
      "type": "object",
      "properties": {
        "method": {
          "type": "string",
          "description": "method"
        },
        "message": {
          "type": "string",
          "description": "message"
        },
        "redirectURL": {
          "type": "string",
          "description": "redirect url"
        },
        "postArguments": {
          "type": "array",
          "description": "post arguments",
          "items": {
            "type": "PostArgument"
          }
        }
      }
    },
    "PostArgument": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "description": "Redirect argument id"
        },
        "value": {
          "type": "string",
          "description": "Redirect argument value"
        }
      }
    },
    "ModalFormData": {
      "type": "object",
      "properties": {
        "checkoutScriptSrc": {
          "type": "string",
          "description": "checkoutScriptSrc"
        },
        "checkoutScriptSection": {
          "type": "string",
          "description": "checkoutScriptSection"
        },
        "checkoutScriptHandler": {
          "type": "string",
          "description": "checkoutScriptHandler"
        },
        "checkoutScriptHtml": {
          "type": "string",
          "description": "checkoutScriptHtml"
        },
        "hints": {
          "type": "string",
          "description": "hints"
        }
      }
    },
    "APSPaymentCreationResult": {
      "type": "object",
      "properties": {
        "paymentId": {
          "type": "integer",
          "description": "PaymentID"
        },
        "redirectData": {
          "type": "RedirectData",
          "description": "Redirect payment result"
        },
        "modalForm": {
          "type": "ModalFormData",
          "description": "Modal Form"
        }
      }
    },
    "PaymentContext": {
      "type": "object",
      "properties": {
        "originUrl": {
          "type": "string"
        },
        "callbackUrl": {
          "type": "string"
        },
        "callbackUrl3D": {
          "type": "string"
        },
        "callbackUrlOk": {
          "type": "string"
        },
        "callbackUrlFail": {
          "type": "string"
        },
        "notifyUrl": {
          "type": "string"
        },
        "ccpViewID": {
          "type": "string"
        }
      }
    },
    "Document": {
      "type": "object",
      "properties": {
        "docType": {
          "type": "string",
          "required": true,
          "enum": [
            "INVOICE",
            "ORDER"
          ]
        },
        "docId": {
          "type": "string"
        },
        "amount": {
          "type": "number"
        }
      }
    },
    "APSPaymentCreationRequest": {
      "type": "object",
      "properties": {
        "total": {
          "type": "number",
          "required": true
        },
        "paymentMethodId": {
          "type": "integer"
        },
        "paymentContext": {
          "type": "PaymentContext"
        },
        "useAvailableCredit": {
          "type": "boolean"
        },
        "documents": {
          "type": "array",
          "items": {
            "type": "Document"
          }
        }
      }
    },
    "APSPayment": {
      "type": "object",
      "properties": {
        "accountId": {
          "type": "string",
          "required": true
        },
        "paymentId": {
          "type": "integer",
          "required": true
        },
        "currency": {
          "type": "string"
        },
        "paymentType": {
          "type": "string"
        },
        "tokenizedCardNumber": {
          "type": "string"
        },
        "transactionNumber": {
          "type": "string"
        },
        "authorizationDate": {
          "type": "string"
        },
        "amount": {
          "type": "number"
        },
        "status": {
          "type": "string",
          "enum": [
            "IN_PROGRESS",
            "SUCCESS",
            "FAILED"
          ]
        }
      }
    }
  }
}

Enums

NAME VALUES DESCRIPTION
DocType
  • ORDER
  • INVOICE
Type of document. INVOICE - Invoice.
ORDER - Order.
Status
  • IN_PROGRESS
  • SUCCESS
  • FAILED
Status of a payment.

Custom Operations

OPERATION VERB PATH RETURNS Description
pay POST /payment Created payment info APSPaymentCreationResult Creates standalone payment
payments GET /payments List of payments Get list of payments.

pay

HTTP Request

POST /aps/2/resources/{aps-id}/payment

Description

Creates standalone payment

Parameters

PARAMETER TYPE DESCRIPTION
params APSPaymentCreationRequest APSPaymentCreationRequest

Returns

Created payment info APSPaymentCreationResult

payments

HTTP Request

GET /aps/2/resources/{aps-id}/payments

Description

Get list of payments.

Parameters

PARAMETER TYPE DESCRIPTION
paymentIds String List of paymentIds separated with comma

Returns

List of payments

Structures

APSPayment

APS structure for payment.

NAME TYPE ATTRIBUTES DEFAULT DESCRIPTION
accountId String Required   Account UUID
amount Real Not Required   Payment card authorized amount
authorizationDate String Not Required   Payment card authorization date
currency String Not Required   Currency key of payment
paymentId Integer Required   Invoice number of payment
paymentType String Not Required   Payment card type
status enum Status Not Required   Payment status.
tokenizedCardNumber String Not Required   Payment card tokenized number
transactionNumber String Not Required   Payment transaction number

APSPaymentCreationRequest

APS structure for payment creation request.

NAME TYPE ATTRIBUTES DEFAULT DESCRIPTION
documents Document array Not Required   Payment documents
paymentContext PaymentContext Not Required   Payment method for payment
paymentMethodId Integer Not Required   Payment method for payment
total Real Required   Total amount of payment
useAvailableCredit Boolean Not Required   Use available customer credit

APSPaymentCreationResult

APS structure for payment creation result.

NAME TYPE ATTRIBUTES DEFAULT DESCRIPTION
modalForm ModalFormData Not Required   Redirect payment callback form data.
paymentId Integer Not Required   Payment identifier.
redirectData RedirectData Not Required   Redirect payment callback result.

Document

NAME TYPE ATTRIBUTES DEFAULT DESCRIPTION
amount Real Not Required   Document amount.
docId String Not Required   Document identifier.
docType   Required   Type of document.

ModalFormData

Payment redirect data

NAME TYPE ATTRIBUTES DEFAULT DESCRIPTION
checkoutScriptHandler String Not Required   Checkout script handler
checkoutScriptHtml String Not Required   Checkout script html
checkoutScriptSection String Not Required   Checkout script section
checkoutScriptSrc String Not Required   Checkout script source
hints String Not Required   Hints

PaymentContext

APS structure for payment context.

NAME TYPE ATTRIBUTES DEFAULT DESCRIPTION
callbackUrl String Not Required   Result callback url.
callbackUrl3D String Not Required   Callback url for payment 3DSecure.
callbackUrlFail String Not Required   Result callback url for failed payment request.
callbackUrlOk String Not Required   Result callback url for successfull payment request.
ccpViewID String Not Required   View ID for return. Used as return URL for CCP
notifyUrl String Not Required   Callback url for payment notify.
originUrl String Not Required   Original request url.

PostArgument

Payment redirect post argument

NAME TYPE ATTRIBUTES DEFAULT DESCRIPTION
key String Not Required   Payment redirect key
value String Not Required   Payment redirect value

RedirectData

Payment redirect data

NAME TYPE ATTRIBUTES DEFAULT DESCRIPTION
message String Not Required   Payment redirect message
method String Not Required   Payment redirect method
postArguments PostArgument array Not Required   Payment redirect post arguments
redirectURL String Not Required   Payment redirect URL

Examples

Since the considered APS type contains custom operations, refer to Custom Operations for the general explanation of their structure and examples of operation calls.