4.6. Charging a payment with a confirmed authorization

Once the authorization resource with charge access is confirmed, a payment can be charged from the Paytrail account while the authorization is valid. The Paytrail account owner is notified by SMS immediately after charging.

Charge process can be either immediate or delayed:

In case of 202 and the delayed process, the API caller should instruct or redirect the customer to complete the payment at the location returned in userActionURL.

Example 4.9. POST /connectapi/authorizations/{id}/charges

Request body
{
    payment: { payment data according to A1 specification }
}
HTTP Status Codes

201: On successful charging

202: User action is needed

400: Address or payment data is malformed, not accepted or missing

404: Authorization does not exist


Table 4.4. Parameters

NameTypem/oDescription
paymentstructm

JSON struct containing the payment to be charged. The contents of the struct is defined in the A1 payment data specification.

Also contains the return URLs:

success – only used for returning the user, no information about payment

cancel – only used for returning the user, no information about payment

notify – called by Paytrail as soon as there is sufficient information (before or after user return), as described below


Example 4.10. Example HTTP Request

POST /connectapi/authorizations/AXJD28237XSDHJS18928/charges HTTP/1.1
Timestamp: 2012-12-31T12:00:00+02:00
Content-MD5: ubewX5M7uzz64zskr7FThQ==
Authorization: PaytrailConnectAPI 13466:ZNcGFgz3bWCvIEV05wyBKCQUcW85ZLazTZz8HxhvJHE=

{
    payment: { payment data according to A1 specification }
}

Example 4.11. Example HTTP Response after immediate charging

HTTP/1.1 201 Created
Location: /connectapi/authorizations/AXJD28237XSDHJS18928/charges/FF1236757632ASDF

Example 4.12. Example HTTP Response after requiring customer interaction

HTTP/1.1 202 Accepted
Location: /connectapi/authorizations/AXJD28237XSDHJS18928/charges/FF1236757632ASDF

{
    "payment": {
        "orderNumber": "MY-ORDER-123",
        "status": "created",
        "userActionUrl": "https://account.paytrail.com/fi_FI/svt/entry/connectapi/token/872a37ab1cf21ad805579266ad7a2ec3929eb50146fa491935e2d3a1aa0813"
    }
}