Individual payments

Individual payments can be made if the customer has been registered with a valid payment type. In addition you need to have a default payment acquirer in your Áskell account. Get in touch with us to ensure that you it is all set up before you start.

Like most other actions in the Áskell API this actions requires the Private API key.

Payment status

Individual transactions can have four statuses.

State identifier

Description

pending

Payment has been established and will be charged immediately

settled

Transaction successful

failed

Transaction unsuccessful and can be retried up to 4 times

retrying

Transaction will be retried as soon as possible

The process

All Swagger API calls in our documentation can be tested and accessible here

  1. A payment has been created for a customer with information on currency and amount. Description and reference from your own CRM or accounting tool is optional.

  • python
API_KEY = 'your api key here'
headers = {
    "Authorization": f"Api-Key {API_KEY}"
}

data = {
    "customer_reference": "customer-12345",
    "amount": "1",
    "currency": "ISK",
    "description": "My description", # Optional description
    "reference": "customer-12345", # Optional reference
}

response = requests.post("https://askell.is/api/payments/", data=data, headers=headers)

The answer looks like this:

{
    "uuid": "a19ca264-5dd4-4897-bcb8-47d84844a2bc",
    "amount": "1.0000",
    "currency": "ISK",
    "description": "My description",
    "reference": "customer-12345",
    "state": "pending",
    "created_at": "2021-10-15T10:02:25.663806Z",
    "updated_at": "2021-10-15T10:02:25.663824Z",
    "transactions": [
        {
        "external_reference": null,
        "data": {},
        "state": "initial",
        "uuid": "951913b0-3b99-4c6c-a58c-3b8e7c18b488",
        "fail_code": null,
        "refund_code": null,
        "cancel_code": null,
        "amount": "1.00",
        "currency": "ISK"
        }
    ]
}
  1. The payment status needs to be monitored through the webhooks. When the payment status changes we send the event payment.changed. Here you can see an example of a payment that has moved through the process and is considered paid.

Further information available through Webhooks

{
    "event": "payment.changed",
    "sender": "admin",
    "data": {
        "uuid": "a19ca264-5dd4-4897-bcb8-47d84844a2bc",
        "amount": "1.0000",
        "currency": "ISK",
        "description": "My description",
        "reference": "customer-12345",
        "state": "settled",
        "created_at": "2021-10-15T10:02:25.663806Z",
        "updated_at": "2021-10-15T10:02:25.663824Z",
        "transactions": [
            {
                "external_reference": "2286047",
                "data": {
                "id": "2286047",
                "receipt": {
                        "BuidAdOgilda": false,
                        "Bunkanumer": "B0003049",
                        "Dagsetning": "14.10.2021",
                        "F22_1til4": "1005",
                        "Faersluhirdir": "VALITOR, sími: 525 2000",
                        "Faerslunumer": "2286047",
                        "FaerslunumerUpphafleguFaerslu": null,
                        "Heimildarnumer": "277031",
                        "Hugbunadarnumer": "11101040000",
                        "Kortnumer": "****-****-****-2779",
                        "LinaC1": "060",
                        "LinaC2": "1509",
                        "LinaC3": "FÆRSLUNR: 128715286045",
                        "LinaC4": "HEIMILD:277031",
                        "LinaD1": "12",
                        "LinaD2": null,
                        "PinSkilabod": null,
                        "PosiID": "0225",
                        "Soluadilinumer": "S0053128",
                        "StadsetningNumer": "0001",
                        "TegundAdgerd": "SALA",
                        "TegundKorts": "Mastercard",
                        "TegundKortsKodi": "500",
                        "TerminalID": "11100126",
                        "Timi": "15:36",
                        "Upphaed": "1",
                        "UtstodNumer": "0001",
                        "VerslunHeimilisfang": null,
                        "VerslunNafn": "Fyrirtækjagreiðslur TEST",
                        "VerslunStadur": "Reykjavík",
                        "Vidskiptaskilabod": "VIÐSKIPTI ISK: 1"
                    },
                    "status": "settled"
                },
                "state": "settled",
                "uuid": "3c03b82a-951a-4331-b651-550de9da9004",
                "fail_code": null,
                "refund_code": null,
                "cancel_code": null,
                "amount": "1.00",
                "currency": "ISK"
            },
        ]
    }
}
  1. There is always a possibility that a payment doesn’t go through for some reason and gets the status failed. In those cases the same payment can be retried with the retry API call. This payment can be retried up to four times.

  • python
API_KEY = 'your api key here'
headers = {
    "Authorization": f"Api-Key {API_KEY}"
}

uuid = "a19ca264-5dd4-4897-bcb8-47d84844a2bc"

response = requests.post(f"https://askell.is/api/payments/{uuid}/retry/", data={}, headers=headers)