This APS type is used to create a singleton APS resource representing the platform payment management service on the APS bus.
In this document:
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.3",
"apsVersion": "2.0",
"implements": [
"http://aps-standard.org/types/core/resource/1.0"
],
"access": {
"global": true
},
"operations": {
"payDeprecated": {
"path": "/payment",
"verb": "POST",
"response": {
"type": "APSPaymentCreationResult"
},
"errorResponse": {
"type": "object"
},
"parameters": {
"params": {
"kind": "body",
"type": "APSPaymentCreationRequest"
}
}
},
"update": {
"path": "/payments/{paymentId}",
"verb": "PUT",
"response": {
"type": "APSPayment"
},
"errorResponse": {
"type": "object"
},
"parameters": {
"paymentId": {
"kind": "path",
"type": "integer"
},
"params": {
"kind": "body",
"type": "APSPaymentUpdateRequest"
}
}
},
"pay": {
"path": "/payments",
"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": {
"accountId": {
"kind": "query",
"type": "string"
},
"paymentIds": {
"kind": "query",
"type": "string"
}
}
}
},
"structures": {
"APSPaymentCreationResultRedirectData": {
"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"
}
}
},
"APSPaymentCreationResultModalFormData": {
"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": "APSPaymentCreationResultRedirectData",
"description": "Redirect payment result"
},
"modalForm": {
"type": "APSPaymentCreationResultModalFormData",
"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"
}
}
},
"APSPaymentDocument": {
"type": "object",
"properties": {
"docType": {
"type": "string",
"required": true,
"enum": [
"INVOICE",
"ORDER"
]
},
"docId": {
"type": "string"
},
"amount": {
"type": "number"
}
}
},
"APSPaymentAttribute": {
"type": "object",
"properties": {
"attributeID": {
"type": "string",
"required": true
},
"value": {
"type": "string",
"required": true
}
}
},
"APSPaymentCreationRequest": {
"type": "object",
"properties": {
"total": {
"type": "number",
"required": true
},
"paymentMethodId": {
"type": "integer"
},
"paymentContext": {
"type": "PaymentContext"
},
"useAvailableCredit": {
"type": "boolean"
},
"documents": {
"type": "array",
"items": {
"type": "APSPaymentDocument"
}
},
"attributes": {
"type": "array",
"items": {
"type": "APSPaymentAttribute"
}
},
"paymentSystemId": {
"type": "string"
}
}
},
"APSPaymentMethod": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"paymentSystemId": {
"type": "string"
},
"paymentSystem": {
"type": "string"
},
"ownerAccountId": {
"type": "string"
},
"number": {
"type": "string"
},
"name": {
"type": "string",
"readonly": true
},
"type": {
"type": "string",
"enum": [
"CREDIT_CARD",
"BANK_ACCOUNT",
"EXTERNAL",
"MANUAL",
"CUSTOM",
"MODAL"
]
},
"perCustomer": {
"type": "boolean",
"required": true
},
"status": {
"type": "string",
"required": true,
"enum": [
"ACTIVE",
"NOT_INSTANTIATED",
"EXPIRED",
"SUSPENDED",
"PENDING",
"FAILED",
"CANCELLED",
"DISABLED",
"DELETED"
]
},
"ratified": {
"type": "string",
"required": true,
"enum": [
"YES",
"NO",
"NOT_REQUIRED"
]
},
"defaultMethod": {
"type": "boolean"
},
"allowedForTopUp": {
"type": "boolean"
},
"tokenizable": {
"type": "boolean"
},
"consentStatus": {
"type": "string",
"enum": [
"CONSENT_NOT_REQUIRED",
"CONSENT_NOT_PROVIDED",
"CONSENT_PROVIDED"
]
},
"consentDate": {
"type": "string",
"format": "date"
},
"deletionDate": {
"type": "string",
"format": "date"
},
"whoAgreedId": {
"type": "string"
},
"agreementURL": {
"type": "string"
},
"parameters": {
"type": "array",
"items": {
"type": "APSPaymentMethodParameter"
}
}
}
},
"APSPaymentMethodParameter": {
"type": "object",
"properties": {
"id": {
"type": "string",
"required": true
},
"name": {
"type": "APSMLString"
},
"type": {
"type": "string"
},
"value": {
"type": "object",
"required": true
}
}
},
"APSMLString": {
"type": "object"
},
"APSPayment": {
"type": "object",
"properties": {
"accountId": {
"type": "string",
"required": true
},
"paymentId": {
"type": "integer",
"required": true
},
"paymentNumber": {
"type": "string"
},
"currency": {
"type": "string"
},
"paymentType": {
"type": "string"
},
"tokenizedCardNumber": {
"type": "string"
},
"transactionNumber": {
"type": "string"
},
"authorizationDate": {
"type": "string"
},
"date": {
"type": "string"
},
"amount": {
"type": "number"
},
"status": {
"type": "string",
"enum": [
"IN_PROGRESS",
"SUCCESS",
"FAILED"
]
},
"paymentMethod": {
"type": "APSPaymentMethod"
},
"invoices": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"APSPaymentUpdateRequest": {
"type": "object",
"properties": {
"operation": {
"type": "string",
"required": true,
"enum": [
"RELEASE",
"VOID"
],
"enumTitles": [
"Release payment",
"Void payment"
]
}
}
}
}
}
The APS type is used to create a singleton APS resource exposing its operations for API calls. The call syntax depends on the operation. For example, a call of an operation that accepts input parameters both in the URL string and in the body looks as follows:
POST /aps/2/services/payment-manager/<operation-path>?<query-params>
{/*<body params>*/}
In the above call, the verb can be either GET, PUT, POST, or DELETE as specified in the definition of the operation.
OPERATION |
VERB |
PATH |
RETURNS |
Description |
---|---|---|---|---|
POST |
/payment |
A representation of the created payment defined by APSPaymentCreationResult. |
This operation is deprecated; please use the |
|
PUT |
/payments/{paymentId} |
The updated payment representation defined by the APSPayment structure. |
Generally, this operation changes a certain payment. Currently, it is used to run the |
|
POST |
/payments |
The representation of the created payment defined by the APSPaymentCreationResult structure. |
Creates a payment document. The payload structure is defined by APSPaymentCreationRequest. |
|
GET |
/payments |
A list of payments. |
Get a list of payments. |
HTTP Request
POST /aps/2/services/payment-manager/payment
Description
This operation is deprecated; please use the pay
operation instead.
Parameters
PARAMETER |
TYPE |
DESCRIPTION |
---|---|---|
params |
Returns
A representation of the created payment defined by APSPaymentCreationResult.
HTTP Request
PUT /aps/2/services/payment-manager/payments/{paymentId}
Description
Generally, this operation changes a certain payment. Currently, it is used to run the Release
or Void
operation in the platform.
Parameters
PARAMETER |
TYPE |
DESCRIPTION |
---|---|---|
paymentId |
Integer |
The identifier of the payment document. |
params |
Returns
The updated payment representation defined by the APSPayment structure.
HTTP Request
POST /aps/2/services/payment-manager/payments
Description
Creates a payment document. The payload structure is defined by APSPaymentCreationRequest.
Parameters
PARAMETER |
TYPE |
DESCRIPTION |
---|---|---|
params |
Returns
The representation of the created payment defined by the APSPaymentCreationResult structure.
HTTP Request
GET /aps/2/services/payment-manager/payments
Description
Get a list of payments.
Parameters
PARAMETER |
TYPE |
DESCRIPTION |
---|---|---|
accountId |
String |
APS ID of a certain reseller. |
paymentIds |
String |
A comma-separated list of payment IDs. |
Returns
A list of payments.
Payment redirect data
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
method |
String |
Not Required |
||
message |
String |
Not Required |
||
redirectURL |
String |
Not Required |
||
postArguments |
Array of PostArgument |
Not Required |
Payment redirect post argument
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
key |
String |
Not Required |
||
value |
String |
Not Required |
Redirect payment callback form data
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
checkoutScriptSrc |
String |
Not Required |
||
checkoutScriptSection |
String |
Not Required |
||
checkoutScriptHandler |
String |
Not Required |
||
checkoutScriptHtml |
String |
Not Required |
||
hints |
String |
Not Required |
The structure to be returned by the payment creation operation.
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
paymentId |
Integer |
Not Required |
The payment ID assigned by the platform. |
|
redirectData |
Not Required |
The response returned by the redirect payment callback. |
||
modalForm |
Not Required |
Redirect payment callback form data. |
The structure of the payment context.
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
originUrl |
String |
Not Required |
The original request URL. |
|
callbackUrl |
String |
Not Required |
The callback URL. |
|
callbackUrl3D |
String |
Not Required |
The callback URL for payment 3DSecure operations. |
|
callbackUrlOk |
String |
Not Required |
The callback URL for successful payment requests. |
|
callbackUrlFail |
String |
Not Required |
The callback URL for failed payment requests. |
|
notifyUrl |
String |
Not Required |
The callback URL for payment notifications. |
|
ccpViewID |
String |
Not Required |
The APS View ID used as the return URL for the customer UX1 panel. |
The APS structure for payment documents that are found inside the APSPaymentCreationRequest.
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
docType |
Enum |
Required |
The type of the document.
The document type:
INVOICE - Invoice.ORDER - Order. |
|
docId |
String |
Not Required |
The document identifier. |
|
amount |
Number |
Not Required |
Document amount. |
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
attributeID |
String |
Required |
||
value |
String |
Required |
The APS structure for payment creation requests.
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
total |
Number |
Required |
Total amount of the payment. |
|
paymentMethodId |
Integer |
Not Required |
The ID of the payment method attached to the payment. |
|
paymentContext |
Not Required |
The structure that defines the payment context. |
||
useAvailableCredit |
Boolean |
Not Required |
If true, it allows the use of available customer credit for payments. |
|
documents |
Array of APSPaymentDocument |
Not Required |
A list of documents to be paid, such as orders and invoices. |
|
attributes |
Array of APSPaymentAttribute |
Not Required |
A list of attributes to be used in that payment |
|
paymentSystemId |
String |
Not Required |
The payment system ID to use for the payment. |
The payment method structure used in operations with payments and payment methods.
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
id |
Integer |
Not Required |
Payment method ID assigned by the platform. |
|
paymentSystemId |
String |
Not Required |
Payment system ID assigned by the platform. |
|
paymentSystem |
String |
Not Required |
The localized name of the payment system. |
|
ownerAccountId |
String |
Not Required |
The APS ID of the payment method owner (account). |
|
number |
String |
Not Required |
The payment method number assigned by the platform. |
|
name |
String |
Not Required Read Only |
The name of the payment method that combines the name of its payment system and its number. |
|
type |
Enum |
Not Required |
The payment method type:
CREDIT_CARD - Locally processed and stored credit card.BANK_ACCOUNT - Bank account.EXTERNAL - External payment site.MANUAL - Manual payment.CUSTOM - Custom payment method.MODAL - Modal form. |
|
perCustomer |
Boolean |
Required |
The flag that indicates if a separate payment method should be created for every customer. |
|
status |
Enum |
Required |
The payment method status:
ACTIVE - Payment method is active.NOT_INSTANTIATED - Payment method is not instantiated.EXPIRED - Payment method has expired.SUSPENDED - Payment method is suspended.PENDING - Payment method creation in 3rd-party system is in progress.FAILED - Payment method creation in 3rd-party system is failed.CANCELLED - Payment method is cancelled by 3rd-party system.DISABLED - Payment method is disabled by vendor.DELETED - Not used, as API neither returns deleted payment methods nor allows to set this status. |
|
ratified |
Enum |
Required |
The ratification status of the payment method:
YES - Payment method is ratified.NO - Payment method is not ratified.NOT_REQUIRED - Ratifications is not required. |
|
defaultMethod |
Boolean |
Not Required |
Flag that indicates if the payment method is default. |
|
allowedForTopUp |
Boolean |
Not Required |
Flag that indicates if the payment method is allowed for TopUp selection. |
|
tokenizable |
Boolean |
Not Required |
Flag that indicates if the payment method is tokenizable. |
|
consentStatus |
Enum |
Not Required |
||
consentDate |
String |
Not Required |
Date, when user agreed on storing his/her credential for payment method |
|
deletionDate |
String |
Not Required |
The date when the payment method will be deleted. This field is retrieved from table PayToolConsent |
|
whoAgreedId |
String |
Not Required |
User APS UUID who accepted consent. |
|
agreementURL |
String |
Not Required |
Link to the page on provider’s web site with consent conditions |
|
parameters |
Array of APSPaymentMethodParameter |
Not Required |
Payment method parameters. |
Structure of the parameter from an APS Payment Method.
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
id |
String |
Required |
The ID of a payment method parameter. |
|
name |
Not Required |
A multi-language string that represents the name of a payment method parameter. |
||
type |
String |
Not Required |
The type of payment method parameter. |
|
value |
Object |
Required |
The value of a payment method parameter. The value type depends on the type of this parameter. If the field |
A structure in the key-value format used to create a string in multiple languages.
APS structure for payment.
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
accountId |
String |
Required |
The APS ID of the reseller. |
|
paymentId |
Integer |
Required |
The payment ID assigned by the platform. |
|
paymentNumber |
String |
Not Required |
The payment number assigned by the platform. |
|
currency |
String |
Not Required |
The currency code as defined by ISO 4217 . |
|
paymentType |
String |
Not Required |
The bank card type. |
|
tokenizedCardNumber |
String |
Not Required |
The payment card tokenized number. |
|
transactionNumber |
String |
Not Required |
The payment transaction number. |
|
authorizationDate |
String |
Not Required |
The payment card authorization date in the format defined by ISO 8601 . |
|
date |
String |
Not Required |
The payment creation date in the format defined by ISO 8601 . |
|
amount |
Number |
Not Required |
The authorized amount for the payment method. |
|
status |
Enum |
Not Required |
Payment status |
|
paymentMethod |
Not Required |
The payment method attached to the payment document. |
||
invoices |
Array of Integer |
Not Required |
A list of the payment’s invoice IDs. |
The structure of the payment update request.
NAME |
TYPE |
ATTRIBUTES |
DEFAULT |
DESCRIPTION |
---|---|---|---|---|
operation |
Enum |
Required |
The requested operation:
RELEASE - Start or continue the payment processing.VOID - Void the payment. |
The scenario in this section illustrates how the provider and resellers can use the payment API methods to integrate SEPA payments outside the platform through their own intermediate systems that support specific requirements of banks they use. This scenario includes the following interaction between the platform (API server), an intermediate management system (API client), and an external payment management system:
The API client calls the payments
operation (RQL functions may or may not be used) to read new payments created
in the platform.
The API client sends the payment data to an external payment management system that performs the money capture (a bank or payment gateway).
Depending on the results of the payment capturing, the API client calls the update operation to either release or void the corresponding payment documents in the platform.
The payments
collection is one of the biggest collections in the platform. Therefore, GET requests for payments
can substantially affect platform performance. If there are too many payments in the platform, we advise reducing
the number of returned payments to only the most necessary by adding various scope restrictions described in this section.
When receiving a GET request for payments, the platform must define the requested scope in the following order:
If the paymentIds
query parameter is specified, the platform uses its value as the initial list of requested
payments. The following steps can reduce this scope.
Restrict the scope by account, which is specified by the accountId
query parameter or identified
by the authentication credentials. For more details about query parameters, refer to the Query Parameters
section.
If the account defined in the previous step is a reseller, define the scope for that reseller through the APS-Actor-Scope HTTP header as described in the Actor Scope section.
Restrict the scope by an RQL statement as described in the RQL Statements section.
The payments
operation enables you to use these two query parameters:
paymentIds
is a string containing a comma-separated list of payment IDs, for example:
paymentIds=6,7,10
accountId
is the APS ID used by a reseller to specify a sub-reseller or a customer whose payments must be
returned, for example:
accountId=47b9b-e827-437f-9e4a-d0acd9469a78
Note
1. If accountId
is not specified, the platform defines the account by using the authentication credentials
provided in the API call.
2. In addition to this parameter, the scope of the returned payments is restricted by the
APS-Actor-Scope
header as described in the Actor Scope section.
If the APS-Actor-Scope HTTP header is not used, the platform returns those payment documents whose owner is the account defined explicitly or implicitly.
Note
An account (reseller or customer) owns those payment documents that they use to pay to their sales vendor.
Assuming that the account is a reseller that has sub-resellers and customers, the APS-Actor-Scope HTTP header affects the scope of payments by the following values assigned to it:
OWN
(default): return only the reseller`s own payments.
FULL
: return payments owned by this reseller and payments owned by all subordinate accounts
(sub-resellers and customers).
You can add an RQL statement after query parameters separating it with the &
sign.
An RQL statement contains functions and relational operators with payment properties
as presented in the following table.
PARAMETER |
Operator or function |
Description |
Example |
---|---|---|---|
|
Operators:
eq gt ge lt le |
Select payments by creation date:
- On the specified date
- After the specified date
- On the specified date or later
- Earlier than the specified date
- On the specified date or earlier
|
|
|
|
Payment status |
|
|
|
Requires the payment manager to return the representation of the payment method associated with the payment. |
|
|
|
Sorts the returned list of payments by payment ID; this is best used together with |
|
Offset and limit |
|
Specifies a range of items from the total list of selected payments to be returned in the response. The first
parameter is the offset (the index of the first payment in the total list), and the second one is the upper
limit on the number of returned payments.
This is best used together with |
|
In a GET request, an RQL statement looks like a single complex parameter separated from HTTP query parameters or from
the URI by the &
sign.
To get payments for a certain day, the request must be sent after the DailyBillingProcessing task for this day is finished in the platform.
To omit calculation of the total number of payments for a faster response, use the APS-Skip-Content-Range HTTP header.
The following sections illustrate how to receive, create, and update payment documents.
In this section:
To get the first 1000 payments with the status IN_PROGRESS of a specified reseller for a certain period and get the associated payment methods, send a GET request with the corresponding query parameters as in the following example:
GET /aps/2/services/payment-manager/payments?accountId=e1e47b9b-e827-437f-9e4a-d0acd9469a78&eq(date,2019-10-31),select(paymentMethod),sort(paymentId),limit(0,1000)"
The payment management service returns a list of payments similar to the following:
HTTP/1.1 200 OK
[
{
"accountId": "e1e47b9b-e827-437f-9e4a-d0acd9469a78",
"amount": 100.0,
"date": "2019-10-31",
"authorizationDate": "",
"currency": "EUR",
"invoices": [ 44 ],
"paymentId": 28,
"paymentMethod": {
"agreementURL": null,
"consentDate": null,
"consentStatus": "CONSENT_NOT_REQUIRED",
"defaultMethod": true,
"deletionDate": null,
"id": 20,
"name": "SEPA DirectDebit ****0300",
"number": "****0300",
"ownerAccountId": "e1e47b9b-e827-437f-9e4a-d0acd9469a78",
"parameters": [
{
"id": "BankNumber",
"value": "BAERDEF1XXX"
},
{
"id": "AccountNumber",
"value": "DE83514203000051420300"
},
{
"id": "AccHolderName",
"value": "ANDREW Berge, Cole a"
}
],
"paymentSystem": "SEPA DirectDebit",
"paymentSystemId": "SEPA DirectDebit",
"perCustomer": true,
"ratified": "NOT_REQUIRED",
"status": "ACTIVE",
"tokenizable": false,
"type": "BANK_ACCOUNT",
"whoAgreedId": null
},
"paymentType": "SEPA DirectDebit",
"status": "IN_PROGRESS",
"tokenizedCardNumber": "****0300",
"transactionNumber": ""
},
{ /* Other payments */ }
]
The paymentMethod
section is the APSPaymentMethod
structure defined
in the PaymentMethodManagement APS type.
A request to pay a customer’s order and a debit memo will look as follows:
POST /aps/2/services/payment-manager/payments
"Content-Type": "application/json"
{
"total": "21.65",
"paymentMethodId": 12,
"documents": [
{
"docType": "ORDER",
"docId": 1000007,
"amount": "6.25"
},
{
"docType": "INVOICE",
"docId": 9,
"amount": "15.40"
}
]
}
In case of success, the response will look similar to the following:
HTTP/1.1 200 OK
{
"paymentId": 10,
"redirectData": null,
"modalForm": null
}
When a payment is in the hold
status, continue its processing by calling the RELEASE
operation
as in the following example:
PUT /aps/2/services/payment-manager/payments/22
{ "operation": "RELEASE" }
If successful, the returned payload contains the payment ID, for example:
HTTP/1.1 200 OK
{ "paymentId": 22 }
To void a payment, call the VOID
operation as in the following example:
PUT /aps/2/services/payment-manager/payments/23
{ "operation": "VOID" }
The response is the same as in the RELEASE
operation. For more details about void operations, refer to
Voiding Payments.
The PaymentManagement API exposes its operations for the payment
documents only. It does not support
refunds or void checks.