Payment Session Handler

A uniform checkout flow

The following diagram describes the uniform checkout sequence for all payment gateways:




Initial options of a Payment Session

Please also see our documentation of DataSet API.
Please note the Payment Session Handler is authorised by the Payment Engine API key.

Name

Type

Mandatory

Example

Description

Name

Type

Mandatory

Example

Description

paymentMethodType

STRING

YES

Test, Betalingsservice, MobilePayOnline, MobilePaySubscriptions, Card

Definition of how payment will be made.
Test is a SMS based solution for testing various outcomes.

paymentType

STRING

YES

Recurring, OneOff, Single

Definition of whether payment is recurring, single or a combination (OneOff).

amount

DOUBLE

YES

100.0

Amount charged

oneOffAmount

DOUBLE

(YES)

100.0

Amount charged. Required if paymentMethodType is OneOff.

currencyCode

STRING

YES

DKK

ISO formatted Currency Code (wiki)

purposeAccountingCode

STRING(32)

NO



A code that identifies the purpose of this agreement, with respect to accounting.

plan

STRING(30)

(YES)



Mandatory for MobilePay Subscriptions. Appears in MobilePay Subscriptions

description

STRING(60)

NO



Appears in MobilePay Subscriptions

oneOffDescription

STRING

NO



Optional for MobilePay Subscriptions

msisdn

STRING

(YES)

4535294855

Phone with Country Code (wiki on Country Code) with 1-3 digits reserved for country code without prefixes, such as 00 (wiki on MSISDN). Required by MobilePay Subscriptions and optional for Betalingsservice.

cpr

STRING

(YES)

0101601234

National ID. Required by Betalingsservice, if individual.

cvr

STRING

(YES)

37273457

Business code, i.e. VAT number. Required by Betalingsservice, if business.

sortCode

STRING

(YES)

1234

Sort code for bank account. Required by Betalingsservice

accountNumber

STRING

(YES)

1234567890

Account number for bank account. Required by Betalingsservice

frequency

STRING

(YES)

Yearly, Halfyearly, Quarterly, Monthly, Custom

Required by MobilePay Subscriptions

communicationCollectionGuid

STRING(64)

NO 



Unique Guid of existing Communication. Please see Communication documentation.

dataSetGuid

STRING(64)

NO

a863d62e-d53b-4651-9b7b-xxxxxxxxxxxx

Unique Guid of existing DataSet. Please see DataSet documentation.

contact

OBJECT

NO



Please see Contact documentation for properties

agreement

OBJECT

(YES)



Please see Agreement documentation for properties.

Required if paymentMethodType is Recurring or OneOff.

subscription

OBJECT

(YES)



Please see Subscription documentation for properties.

Required if paymentMethodType is Recurring or OneOff.

errorReturnPageUrl

STRING

YES

https://domain.tld/error.html

Final Page URL for failed checkout sequence

successReturnPageUrl

STRING

YES

https://domain.tld/thanks.html

Final Page URL for successful checkout sequence

 

Advanced options of a Payment Session

The following are optional, but allows a customised checkout flow between your application, the chosen payment gateway and the receipt's landing page.

Name

Type

Mandatory

Example

Description

Name

Type

Mandatory

Example

Description

preWaitPageUrl

STRING

NO

https://domain.tld/preWait.html

URL for user interception before Gateway Landing Page.
The contents of preWaitPage given below.

postWaitPageUrl

STRING

NO

https://domain.tld/postWait.html

URL for user interception after Gateway Landing Page.
The contents of postWaitPage given below.


GET /paymentSession/{guid}

Get a single Payment Session.

Response

HTTP

Description

HTTP

Description

200

OK

404

Payment not found

HTTP 200 Example of a processed Payment Session

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 { "paymentSessionGuid": "a2ddec67-2795-4dc8-bc78-xxxxxxxxxxxx", "createdTs": "2019-08-16 15:26:49 +0200", "state": "Complete", "initialUserRedirectUrl": "https://domain.tld/preWait.html?paymentSessionGuid=da2ddec67-2795-4dc8-bc78-xxxxxxxxxxxx", "redirectToGatewayUrl": "https://epay.onlinefundraising.dk/ToGatewayRedirect?sessionGuid\u003d2fbba6f6-021b-4b92-b3d5-xxxxxxxxxxxx", "redirectReturnFromGatewayUrl": "https://domain.tld/postWait.html?paymentSessionGuid=da2ddec67-2795-4dc8-bc78-xxxxxxxxxxxx", "finalRedirectUrl": "https://domain.tld/tak.html?paymentSessionGuid=da2ddec67-2795-4dc8-bc78-xxxxxxxxxxxx", "finalRedirectUrl": "https://domain.tld/error.html?paymentSessionGuid=da2ddec67-2795-4dc8-bc78-xxxxxxxxxxxx", "dataSetGuid": "9cacc900-cc06-4447-bc0f-xxxxxxxxxxxx", "paymentGatewayPaymentReferenceId": "d38fd4fa-8561-4296-9b82-xxxxxxxxxxxx", "paymentGatewayTransactionId": "224841XXX", "contactGuidResult": "8d51dff8-c12b-4949-bc24-xxxxxxxxxxxx", "paymentMethodGuidResult": "162e7168-0d0f-4367-8804-xxxxxxxxxxxx", "paymentGuidResult": "66620d86-bf43-4a75-b2d6-xxxxxxxxxxxx" }

POST /paymentSession

Initiate a Payment Session.

Request examples

A single payment of 100 DKK paid by Card, including a DataSet reference and a new Contact.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 { "dataSetGuid": "003705cc-42c8-4250-a666-xxxxxxxxxxxx", "communicationCollectionGuid": "18c281b2-2efe-4765-8dc0-xxxxxxxxxxxx", "contact": { "name": "John Doe", "firstName": "John", "lastName": "Doe", "address": "St. Kongensgade 59B, 3.", "postCode": "1264", "city": "K\u00f8benhavn", "countryCode": "DK", "msisdn": "4511223344", "email": "noreply@yourdomain.tld" }, "paymentMethodType": "Card", "paymentType": "Single", "amount": 100.0, "currencyCode": "DKK", "preWaitPageUrl": "https://domain.tld/preWait.html", "postWaitPageUrl": "https://domain.tld/postWait.html", "errorReturnPageUrl": "https://domain.tld/error.html", "successReturnPageUrl": "https://domain.tld/thanks.html" }

 

A subscription of a personal monthly Agreement of 100 DKK paid by Card, starting on 2019-09-01, including a DataSet reference and a new Contact.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 { "dataSetGuid": "e945a145-3fc2-469e-a3ff-xxxxxxxxxxxx", "communicationCollectionGuid": "18c281b2-2efe-4765-8dc0-xxxxxxxxxxxx", "contact": { "name": "John Doe", "firstName": "John", "lastName": "Doe", "address": "St. Kongensgade 59B, 3.", "postCode": "1264", "city": "K\u00f8benhavn", "countryCode": "DK", "msisdn": "4511223344", "email": "noreply@yourdomain.tld" }, "agreement": { "name": "Donation", "description": "Donation to the club", "agreementType": "Personal", "defaultQuantity": 1, "unit": "pcs", "unitPrice": 100.0, "amount": 100.0, "amountVat": 0.0, "amountTotal": 100.0, "taxDeductable": true, "vatPercentage": 0.0, "currencyCode": "DKK", "paymentRequired": false, "scheduleType": "Monthly", "scheduleBaseTier": 9, "scheduleFixedDay": 1, "dataSetGuid": "e945a145-3fc2-469e-a3ff-xxxxxxxxxxxx", "communicationCollectionGuid": "18c281b2-2efe-4765-8dc0-xxxxxxxxxxxx" }, "subscription": { "startDate": "2019-09-01", "quantity": 1, "dataSetGuid": "e945a145-3fc2-469e-a3ff-xxxxxxxxxxxx" }, "paymentMethodType": "Card", "paymentType": "Recurring", "currencyCode": "DKK", "frequency": "Monthly", "plan": "Donation", "description": "Donation to the club", "preWaitPageUrl": "https://domain.tld/preWait.html", "postWaitPageUrl": "https://domain.tld/postWait.html", "errorReturnPageUrl": "https://domain.tld/error.html", "successReturnPageUrl": "https://domain.tld/thanks.html" }

 

A subscription of a personal monthly Agreement of 25 DKK, with a OneOff payment of 250 DKK, paid by MobilePay Subscriptions, starting on 2020-01-09:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 { "dataSetGuid": "351b0f2d-07fb-4e85-a033-xxxxxxxxxxxx", "communicationCollectionGuid": "93383565-801a-4dce-992f-xxxxxxxxxxxx", "contact": { "name": "xxx", "address": "xxx", "postCode": "xxx", "city": "xxx", "countryCode": "xxx", "msisdn": "xxx" }, "agreement": { "name": "xxx", "description": "xxx", "agreementType": "Personal", "defaultQuantity": 1, "unit": "pcs", "unitPrice": 25.0, "amount": 25.0, "amountVat": 0.0, "amountTotal": 25.0, "taxDeductable": true, "vatPercentage": 0.0, "currencyCode": "DKK", "paymentRequired": false, "scheduleType": "Monthly", "scheduleBaseTier": 1, "scheduleFixedDay": 9, "purposeAccountingCode": "xxx", "dataSetGuid": "351b0f2d-07fb-4e85-a033-xxxxxxxxxxxx", "communicationCollectionGuid": "93383565-801a-4dce-992f-xxxxxxxxxxxx" }, "subscription": { "quantity": 1, "dataSetGuid": "351b0f2d-07fb-4e85-a033-xxxxxxxxxxxx", "startDate": "2020-01-09", "nextDueDate": "2020-02-09" }, "amount": 25.0, "oneOffAmount": 250.0, "currencyCode": "DKK", "paymentType": "OneOff", "frequency": "Monthly", "paymentMethodType": "MobilePaySubscriptions", "msisdn": "xxx", "plan": "Membership", "description": "Membership of the club", "oneOffDescription": "First payment", "preWaitPageUrl": "https://domain.tld/preWait.html", "postWaitPageUrl": "https://domain.tld/postWait.html", "errorReturnPageUrl": "https://domain.tld/error.html", "successReturnPageUrl": "https://domain.tld/thanks.html" }

 

A subscription of a personal monthly Agreement of 50 DKK paid by Betalingsservice starting on 2020-02-01:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 { "dataSetGuid": "a75083de-ac8d-4946-bb08-xxxxxxxxxxxx", "communicationCollectionGuid": "db2ed250-46fa-4cf1-b74e-xxxxxxxxxxxx", "contact": { "address": "xxx", "city": "xxx", "countryCode": "xxx", "email": "xxx", "externalId": "xxx", "firstName": "xxx", "lastName": "xxx", "msisdn": "xxx", "name": "xxx", "nationalId": "xxx", "postCode": "xxx" }, "agreement": { "agreementType": "Personal", "amount": 50.0, "amountTotal": 50.0, "amountVat": 0.0, "communicationCollectionGuid": "db2ed250-46fa-4cf1-b74e-xxxxxxxxxxxx", "currencyCode": "DKK", "dataSetGuid": "a75083de-ac8d-4946-bb08-xxxxxxxxxxxx", "defaultQuantity": 1, "name": "xxx", "paymentRequired": false, "purposeAccountingCode": "500", "scheduleBaseTier": 2, "scheduleFixedDay": 1, "scheduleType": "Monthly", "taxDeductable": true, "unit": "pcs", "unitPrice": 50.0, "vatPercentage": 0.0 }, "subscription": { "quantity": 1, "dataSetGuid": "a75083de-ac8d-4946-bb08-xxxxxxxxxxxx", "startDate": "2020-02-01", "nextDueDate": "2020-03-01" }, "amount": 50.0, "currencyCode": "DKK", "paymentType": "Recurring", "frequency": "Monthly", "paymentMethodType": "Betalingsservice", "cpr": "xxx", // nationalId "cvr": "xxx", // businessCode "sortCode": "xxx", "accountNumber": "xxx", "plan": "Membership", "description": "Membership of the club", "oneOffDescription": "First payment", "preWaitPageUrl": "https://domain.tld/preWait.html", "postWaitPageUrl": "https://domain.tld/postWait.html", "errorReturnPageUrl": "https://domain.tld/error.html", "successReturnPageUrl": "https://domain.tld/thanks.html" }

 

Response

HTTP

Description

HTTP

Description

201

Created

400

Something's wrong with request body.

HTTP 201 Example

1 2 3 4 5 6 7 8 { "paymentSessionGuid": "a863d62e-d53b-4651-9b7b-xxxxxxxxxxxx", "initialUserRedirectUrl": "https://domain.tld/preWait.html?paymentSessionGuid=da2ddec67-2795-4dc8-bc78-xxxxxxxxxxxx", "redirectToGatewayUrl": "https://epay.onlinefundraising.dk/ToGatewayRedirect?sessionGuid\u003d2fbba6f6-021b-4b92-b3d5-xxxxxxxxxxxx", "redirectReturnFromGatewayUrl": "https://domain.tld/postWait.html?paymentSessionGuid=da2ddec67-2795-4dc8-bc78-xxxxxxxxxxxx", "finalRedirectUrl": "https://domain.tld/tak.html?paymentSessionGuid=da2ddec67-2795-4dc8-bc78-xxxxxxxxxxxx", "finalRedirectUrl": "https://domain.tld/error.html?paymentSessionGuid=da2ddec67-2795-4dc8-bc78-xxxxxxxxxxxx" }

Resulting properties of a Payment Session

Name

Type

Description

Name

Type

Description

state

STRING

Please see list of Payment Session States below

initialUserRedirectUrl

STRING

URL to defined preWaitPageUrl

redirectToGatewayUrl

STRING

URL to chosen Payment Gateway

finalRedirectUrl

STRING

URL to either defined successReturnPageUrl or errorReturnPageUrl depending on session state

paymentGatewayPaymentReferenceId

STRING

Unique internal Guid

paymentGatewayTransactionId

STRING

Transaction ID from chosen Payment Gateway. Only applies to Bambora (Card) and MobilePay Subscriptions

contactGuidResult

STRING

Unique Guid of resulting Contact

paymentMethodGuidResult

STRING

Unique Guid of resulting Payment Method

paymentGuidResult

STRING

Unique Guid of resulting Payment


Payment Session States

Following is a list of Payment Session states:

State

Description

State

Description

SentToGateway

Session has been handed over to chosen Payment Gateway

Complete

Session is complete and user should be redirected to finalRedirectUrl

Rejected

Session was rejected by user

SoftError

Session was rejected by user closing payment window

Failed

Session failed with chosen Payment Gateway

SessionExpired

Session expired due to missing user or gateway action

Contents of preWait and postWait

You may wish to use the preWait and postWait landing pages as they are defined in OnlineFundraising, but you can replace them entirely adding e.i. your own branding, tracking or some custom logic to the checkout flow.

To get started, please see these examples: