Payment Requests
Method | URL | Description | Response class |
---|---|---|---|
POST | /v1/payments/ | Create Payment | Status 201 |
GET | /v1/payments/{paymentId} | Get payment | Status 200 |
POST | /v1/payments/{paymentId}/charges | Charge payment | Status 201 |
POST | /v1/charges/{chargeId}/refunds | Refund charge | Status 201 |
POST | /v1/payments/{paymentId}/cancels | Cancel payment | Status 204 |
PUT | /v1/payments/{paymentId}/referenceinformation | Update reference | Status 204 |
PUT | /v1/payments/{paymentId}/orderitems | Update Order | Status 204 |
GET / POST / PUT | Webhooks - Any of the above | Get transaction information with webhooks | Any of the above |
Payment Documentation
Create a Payment - API
Title |
Create Payment |
URL |
api.dibspayment.eu/v1/payments/ |
HTTP header fields |
Authorization (secret-key) |
Sample Call |
{ "order":{ "items":[ { "reference":"string", "name":"string", "quantity":0, "unit":"string", "unitPrice":0, "taxRate":0, "taxAmount":0, "grossTotalAmount":0, "netTotalAmount":0 } ], "amount":0, "currency":"string", "reference":"string" }, // Use merchantNumber if you're a partner and initiating the checkout with your partner keys "merchantNumber":0, "checkout":{ //If charge is set to true and consumer selects payment by invoice, reservation will be declined automatically. "charge":true, "publicDevice":true, "integrationType":"string", "url":"string", "returnUrl":"string", "termsUrl":"string", "appearance": { "displayOptions": { "showMerchantName": false, "showOrderSummary": false }, "textOptions": { "completePaymentButtonText" : "order" } }, "merchantHandlesConsumerData":true, "consumer":{ "reference":"string", "email":"string", "shippingAddress":{ "addressLine1":"string", "addressLine2":"string", "postalCode":"string", "city":"string", "country":"string" }, "phoneNumber":{ "prefix":"string", "number":"string" }, "privatePerson":{ "firstName":"string", "lastName":"string" }, "company":{ "name":"string", "contact":{ "firstName":"string", "lastName":"string" } } }, // if merchantHandlesConsumerData = false specify which consumerTypes should be available in checkout. (B2B or B2C), if merchantHandlesConsumerData=true these parameters will be ignored. "consumerType":{ "default":"string", "supportedTypes":[ "string" ] }, "merchantHandlesShippingCost":true, //Boolean value (true/false). If set to true, requires paymentID to be updated with shipping.costSpecified = true before customer can complete a purchase. "shipping":{ //Specify allowed shipping countries "countries":[ { "countryCode":"string" } ] } }, // Notification Parameters "notifications":{ "webHooks":[ { "eventName":"string", "url":"string", "authorization":"string", "headers": [ { "string": "string" }, { "string": "string" } ] } ] }, // Specify Invoice fee added to total price when invoice is used as payment method. "paymentMethods":[ { "name":"easyinvoice", "fee":{ "reference":"invFee", "name":"fee", "quantity":1, "unit":"ct", "unitPrice":1000, "taxRate":2500, "taxAmount":250, "grossTotalAmount":1250, "netTotalAmount":1000 } } ] } |
Success Response |
Returns a payment ID { "paymentId":"e1d5385e0be743abb25e1b0ae1ce3d57" } |
Error Responses |
Code 400 "Bad request" Code 401 "Unauthorized" Code 500 "Unexpected error" |
Description of parameters affecting checkout/payment flow
checkout.merchantHandlesConsumerData |
Boolean value (true/false), enables the merchant to pre-fill the checkout with customer data. |
checkout.merchantHandlesShippingCost |
Boolean value (true/false). |
checkout.charge |
Boolean value (true/false) |
checkout.integrationType |
Possible values EmbeddedCheckout (default) or HostedPaymentPage.
|
Add discount to payment - API
In order to create a discount row in Easy your total amount must be positive, amount must be at least 0.1 DKK/NOK/SEK/EUR for CARD or 15 DKK/NOK/SEK/EUR for INVOICE payment. Use the format below in the "Create Payment" API above.
"order":{ "items":[ { "reference":"Reference 001", "name":"Test product 001", "quantity":1, "unit":"units", "unitPrice":5000, "taxRate":100, "taxAmount":50, "grossTotalAmount":"5000", "netTotalAmount":"5000" }, { "reference":"discount", "name":"discount", "quantity":1, "unit":"units", "unitPrice":0, "taxRate":0, "taxAmount":0, "grossTotalAmount":"-1000", "netTotalAmount":"-1000" }, ], "amount":4000, "currency":"NOK", "reference":"Test" }
Get Payment details - API
Title |
Get payment details |
TYPE |
GET |
URL |
api.dibspayment.eu/v1/payments/{ paymentId } |
HTTP header fields |
Authorization (secret-key) |
URL Parameters |
{ paymentId } |
Data Parameters |
N/A |
Success Response |
Returns the payment details { "checkout":{ "url":"string" }, "consumer":{ "shippingAddress":{ "addressLine1":"string", "addressLine2":"string", "receiverLine":"string", "postalCode":"string", "city":"string", "country":"string" }, "company":{ "merchantReference":"string", "name":"string", "registrationNumber":"string", "contactDetails":{ "firstName":"string", "lastName":"string", "email":"string", "phoneNumber":{ "prefix":"string", "number":"string" } } }, "privatePerson":{ "merchantReference":"string", "dateOfBirth":"2020-01-22T10:56:51.236Z", "firstName":"string", "lastName":"string", "email":"string", "phoneNumber":{ "prefix":"string", "number":"string" } } }, "created":"2017-03-22T08:02:30.977Z", "orderDetails":{ "amount":"string", "currency":"string", "reference":"string" }, "paymentDetails":{ "cardDetails":{ "maskedPan":"string", "expiryDate":"string" }, "invoiceDetails":{ "dueDate":"string", "invoiceNumber":"string", "ocr":"string", "pdfLink":"string" }, "paymentMethod":"string", "paymentType":"string" }, "paymentId":"string", "refunds":{ "amount":0, "lastUpdated":"string", "orderItems":[ [ { "reference":"ex125454", "name":"example name", "quantity":10, "unit":"pcs", "unitPrice":100, "taxRate":2500, "taxAmount":250, "grossTotalAmount":1250, "netTotalAmount":1000 } ] ], "refundId":"string", "state":"string" }, "summary":{ "cancelledAmount":0, "chargedAmount":0, "refundedAmount":0, "reservedAmount":0 }, "subscription": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } } |
Error Responses |
|
Sample Call |
Charge Payment - API
Title |
Charge payment |
||||||||||||||||||||||||
TYPE |
POST |
||||||||||||||||||||||||
URL |
api.dibspayment.eu/v1/payments/{ paymentId }/charges |
||||||||||||||||||||||||
HTTP header fields |
Authorization (secret-key) |
||||||||||||||||||||||||
URL Parameters |
{ paymentId } |
||||||||||||||||||||||||
Data Parameters |
amount - int "Amount to be charged" |
||||||||||||||||||||||||
Sample Call |
{ "amount":0, "orderItems":[ { "reference":"string", "name":"string", "quantity":0, "unit":"string", "unitPrice":0, "taxRate":0, "taxAmount":0, "grossTotalAmount":0, "netTotalAmount":0 } ] } |
||||||||||||||||||||||||
Success Response |
Returns the charge id |
||||||||||||||||||||||||
Error Responses |
|
||||||||||||||||||||||||
Refund Payment - API
Title |
Refund payment |
||||||||||||||||||||||||
TYPE |
POST |
||||||||||||||||||||||||
URL |
api.dibspayment.eu/v1/charges/{ chargeId }/refunds |
||||||||||||||||||||||||
HTTP header fields |
Authorization (secret-key) |
||||||||||||||||||||||||
URL Parameters |
{ chargeId } |
||||||||||||||||||||||||
Data Parameters |
amount - int "Amount to be refunded" |
||||||||||||||||||||||||
Sample Call |
{ "amount":0, "orderItems":[ { "reference":"string", "name":"string", "quantity":0, "unit":"string", "unitPrice":0, "taxRate":0, "taxAmount":0, "grossTotalAmount":0, "netTotalAmount":0 } ] } |
||||||||||||||||||||||||
Success Response |
Returns the refund id |
||||||||||||||||||||||||
Error Responses |
|
||||||||||||||||||||||||
Cancel Payment - API
Title |
Cancel payment |
||||||||||||||||||||||||
TYPE |
POST |
||||||||||||||||||||||||
URL |
api.dibspayment.eu/v1/payments/{ paymentId }/cancels |
||||||||||||||||||||||||
HTTP header fields |
Authorization (secret-key) |
||||||||||||||||||||||||
URL Parameters |
{ paymentId } |
||||||||||||||||||||||||
Data Parameters |
amount - int "Amount to be canceled" |
||||||||||||||||||||||||
Sample Call |
{ "amount":0, "orderItems":[ { "reference":"string", "name":"string", "quantity":0, "unit":"string", "unitPrice":0, "taxRate":0, "taxAmount":0, "grossTotalAmount":0, "netTotalAmount":0 } ] } |
||||||||||||||||||||||||
Success Response |
204 - No content |
||||||||||||||||||||||||
Error Responses |
|
||||||||||||||||||||||||
Update Reference - API
Title |
Update payment reference |
||||||||||||||||||||||||
TYPE |
PUT |
||||||||||||||||||||||||
URL |
api.dibspayment.eu/v1/payments/{ paymentId }/referenceinformation |
||||||||||||||||||||||||
HTTP header fields |
Authorization (secret-key) |
||||||||||||||||||||||||
URL Parameters |
{ paymentId } |
||||||||||||||||||||||||
Data Parameters |
checkoutUrl - Enter the checkout URL |
||||||||||||||||||||||||
Sample Call |
{ "reference":"Ref1", "checkoutUrl": https://checkout.dibspayment.eu?pram1=1&pram2=2&pram3=3 } |
||||||||||||||||||||||||
Success Response |
204 - NO CONTENT |
||||||||||||||||||||||||
Error Responses |
|
||||||||||||||||||||||||
Update Orderitems - API
Note: This API can only be used as long as the checkout haven't been completed by the customer.
Title |
Update payment orderitems |
||||||||||||||||||||||||
TYPE |
PUT |
||||||||||||||||||||||||
URL |
api.dibspayment.eu/v1/payments/{ paymentId }/orderitems |
||||||||||||||||||||||||
HTTP header fields |
Authorization (secret-key) |
||||||||||||||||||||||||
URL Parameters |
{ paymentId } |
||||||||||||||||||||||||
Data Parameters |
amount - Total amount including VAT items - shipping - |
||||||||||||||||||||||||
Sample Call |
{ "amount":0, "items":[ { "reference":"string", "name":"string", "quantity":0, "unit":"string", "unitPrice":0, "taxRate":0, "taxAmount":0, "grossTotalAmount":0, "netTotalAmount":0 }, ], "shipping":{ "costSpecified":true } } |
||||||||||||||||||||||||
Success Response |
204 - NO CONTENT |
||||||||||||||||||||||||
Error Responses |
|
||||||||||||||||||||||||
Get transaction information with webhooks
Merchants has the possibility to subscribe to different events that affect a payment and to be notified directly when these events happen. When an event occurs in Easy; for example, a charge is made or a payment is refunded, this event can be sent along with the associated data directly to the merchant.
Configuring webhooks for a payment
Easy will send the event as a HTTP POST request to the URL specified by the merchant.
Webhooks are configured per payment and are specified in the create payment request.
When you subscribe to a webhook, Easy will try to send the request to the specified URL until the server responds with a 200 OK status code. If the server responds with anything else, or times out, a certain number of retries are made with increasing time between each attempt. Supported events for webhooks:
To register a webhook, use the following format:
"notifications":{ "webhooks":[ { "eventName":"payment.created", "url":"string", "authorization":"authorizationKey", "headers": [ { "string": "string" }, { "string": "string" } ] } ] }
The authorization field is used by Easy to set the authorization header of the http request when sending the webhook to the merchant site. This header should be verified by you to ensure that the request has come from the correct source.
Receive a webhook
It is very easy to receive a webhook. Just set up a new endpoint on the preferred site and read the JSON body of the request to get the event data.
C# code example:
public async Task<ihttpactionresult> Post(){ var content = await Request.Content.ReadAsStringAsync(); dynamic eventData = JsonConvert.DeserializeObject(content); return Ok(); }
Note that the webhooks need to be sent over HTTPS when designing the endpoint.
Webhook content
The webhook content will have the following format:
{ "id":"f3d5043af4094d6887ee95bf16073958", "merchantId":"e718004345cc48cba095a235de85c359", "timestamp":"2018-01-12T09:40:19.8919+00:00", "event":"payment.refund.completed", "data":{ ... ... } }
The data property inside will contain the event data for the specified event and will change accordingly.
See separate list for details on each event.
Responding to a webhook
To acknowledge the webhook sent from Easy, a 200 HTTP status code is required. Any other status code, even other 2XX codes, will be treated as a not successful attempt.
If the webhook was not successfully posted to you, Easy will continue to send the webhook with an increasing interval in time between each attempt. If your site still has not responded with 200 after this period, the webhook will not be attempted any more.
List of events and content
payment.created
{ "id":"", "merchantId":, "timestamp":"", "event":"payment.created", "data":{ "order":{ "amount":{ "amount":, "currency":"" }, "reference":"", "orderItems":[ { "grossTotalAmount":, "name":"", "netTotalAmount":, "quantity":, "reference":" ", "taxRate":, "taxTotalAmount":, "unit":"", "unitNetPrice": }, { "grossTotalAmount":, "name":"", "netTotalAmount":, "quantity":, "reference":"", "taxRate":2, "taxTotalAmount":, "unit":"", "unitNetPrice": } ] }, "paymentId":"" } }
payment.reservation.created
{ "id":"", "merchantId":, "timestamp":"", "event":"payment.reservation.created", "data":{ "cardDetails":{ "creditDebitIndicator":"", "expiryMonth":, "expiryYear":, "issuerCountry":"", "truncatedPan":", "threeDSecure":{ "acsUrl":"", "authenticationEnrollmentStatus":"", "authenticationStatus":"", "eci":"" } }, "paymentMethod":"", "paymentType":"", "consumer":{ "firstName":"", "lastName":"", "country":"", "email":"", "ip":"", "phoneNumber":{ "prefix":"", "number":"" }, "shippingAddress":{ "addressLine1":"", "addressLine2":"", "city":"", "country":"", "postcode":"" } }, "reservationReference":"", "reserveId":"", "amount":{ "amount":, "currency":"" }, "paymentId":"" } }
payment.reservation.created.v2
{ "id": "", "timestamp": "", "merchantNumber": , "event": "payment.reservation.created.v2", "data": { "paymentMethod": "", "paymentType": "", "amount": { "amount": , "currency": "" }, "paymentId": "" } }
payment.checkout.completed
{ "id":"", "merchantId":, "timestamp":"", "event":"payment.checkout.completed", "data":{ "order":{ "amount":{ "amount":, "currency":"" }, "reference":"", "orderItems":[ { "grossTotalAmount":, "name":"", "netTotalAmount":, "quantity":, "reference":"", "taxRate":, "taxAmount":, "unit":"", "unitPrice": } ] }, "consumer":{ "firstName":"", "lastName":"", "country":"", "email":"", "ip":"", "phoneNumber":{ "prefix":"", "number":"" }, "shippingAddress":{ "addressLine1":"", "addressLine2":"", "city":"", "country":"", "postcode":"", "receiverLine":"" } }, "paymentId":"" }
payment.charge.created
{ "id":"", "merchantId":, "timestamp":"", "event":"payment.charge.created", "data":{ "chargeId":"", "orderItems":[ { "grossTotalAmount":, "name":"", "netTotalAmount":, "quantity":, "reference":"", "taxRate":, "taxTotalAmount":, "unit":"", "unitNetPrice": } ], "reservationId":"", "amount":{ "amount":, "currency":"" }, "paymentId":"" } }
payment.charge.created.v2
{ "id": "", "timestamp": "", "merchantNumber": , "event": "payment.charge.created.v2", "data": { "chargeId": "", "orderItems": [ { "grossTotalAmount": , "name": "", "netTotalAmount": , "quantity": , "reference": "", "taxRate": , "taxAmount": , "unit": "", "unitPrice": } ], "paymentMethod": "", "paymentType": "", "amount": { "amount": , "currency": "" }, "paymentId": "" } }
payment.charge.failed
{ "id":"", "merchantId":, "timestamp":"", "event":"payment.charge.failed", "data":{ "error":{ "code":"", "message":"", "source":"" }, "chargeId":"", "orderItems":[ { "grossTotalAmount":, "name":"", "netTotalAmount":, "quantity":, "reference":"", "taxRate":, "taxTotalAmount":, "unit":"", "unitNetPrice": } ], "reservationId":"", "amount":{ "amount":, "currency":"" }, "paymentId":"" } }
payment.cancel.created
{ "id":"", "merchantId":, "timestamp":"", "event":"payment.cancel.created", "data":{ "cancelId":"", "orderItems":[ { "grossTotalAmount":, "name":"", "netTotalAmount":, "quantity":, "reference":"", "taxRate":, "taxTotalAmount":, "unit":"", "unitNetPrice": } ], "amount":{ "amount":, "currency":"" }, "paymentId":"" } }
payment.cancel.failed
{ "id":"", "merchantId":, "timestamp":"", "event":"payment.cancel.failed", "data":{ "error":{ "code":"", "message":"", "source":"" }, "cancelId":"", "orderItems":[ { "grossTotalAmount":, "name":"", "netTotalAmount":, "quantity":, "reference":"", "taxRate":, "taxTotalAmount":, "unit":"", "unitNetPrice": } ], "amount":{ "amount":, "currency":"" }, "paymentId":"" } }
payment.refund.initiated
{ "id":"", "merchantId":, "timestamp":"", "event":"payment.refund.initiated", "data":{ "refundId":"", "chargeId":"", "orderItems":[ { "grossTotalAmount":, "name":"", "netTotalAmount":, "quantity":, "reference":"", "taxRate":, "taxTotalAmount":, "unit":"", "unitNetPrice": } ], "amount":{ "amount":, "currency":"" }, "paymentId":"" } }
payment.refund.initiated.v2
{ "id":"", "merchantNumber":, "timestamp":"", "event":"payment.refund.initiated.v2", "data":{ "refundId":"", "chargeId":"", "amount":{ "amount":, "currency":"" }, "paymentId":"" } }
payment.refund.completed
{ "id":"", "merchantId":, "timestamp":"", "event":"", "data":{ "refundId":"", "amount":{ "amount":, "currency":"" }, "paymentId":"" } }
payment.refund.failed
{ "id":"", "merchantId":, "timestamp":"", "event":"", "data":{ "error":{ "code":"", "message":"", "source":"" }, "refundId":"", "amount":{ "amount":, "currency":"" }, "paymentId":"" } }
About the parameters
The JSON posts that are sent to our API consists of several input parameters which are listed on this page.
String - The parameter type string is limited to 128 characters and you are able to find a complete list of all supported characters here. The only exception from this is Cherckout.URL which support up to 256 characters.
Int - The parameter type int has a maximum value of 2,147,483,647. Supported fields (noted with asterisks below) have a minimum value of -2,147,483,648.
Decimal - Decimal separators are not allowed in Easy. The last two digits of a number are considered to be the decimals. Example: send "10050" if you want Easy to interpret is as 100.50 SEK (or any other currency).
- order
- items - Order item - Multiple order items can be added (mandatory)
- reference - Product reference
- name - Product name (mandatory)
- quantity - Product quantity (mandatory)
- unit - Product unit, for instance pcs or Kg (mandatory)
- unitPrice - Product price per unit without VAT (mandatory)
- taxRate - Product tax rate - defaults to 0 if not provided.
- taxAmount - Product tax/VAT amount - defaults to 0 if not provided. taxAmount should include the total tax amount for the entire order row.
- grossTotalAmount - Product total amount including VAT (mandatory)
- netTotalAmount - Product total amount excluding VAT (mandatory)
- amount - Total amount of the payment (mandatory)
- currency - Currency of the payment (mandatory)
- reference - Payment reference (mandatory)
- items - Order item - Multiple order items can be added (mandatory)
- checkout - Information that Easy need to initialize the window
- integrationType - hostedPaymentPage or EmbeddedCheckout, (default value = EmbeddedCheckout)
- url - specify where checkout will be loaded if EmbeddedCheckout integrationType
- returnUrl - specify where customer will return if HostedPaymentPage integrationType
- termsUrl - the URL to your terms and conditions (mandatory)
- appearance
- textOptions
- completePaymentButtonText - Overrides payment button text when doing a payment with subscriptions. Can only use one of these predefined values: (pay, purchase, order, book, reserve, signup, subscribe, accept). Supports language translation.
- displayOptions
- showMerchantName - If set to true, displays merchant name above the checkout (default = true for HostedPaymentPage).
- showOrderSummary - If set to true, displays order summay above the checkout (default = true for HostedPaymentPage).
- textOptions
- merchantHandlesConsumerData - enables the merchant to pre-fill the checkout with customer data.
- consumer - add consumer data, EASY will use the postalCode and email address to try and recognize the consumer to load saved payment methods.
- privatePerson - either pass "privatePerson" or "company"
- company - either pass "privatePerson" or "company"
- shippingCountries - Limits the shipping countries (optional)
- countryCode - Shipping country ISO code, see Datastring Parameters
- consumerType - Configures which consumers types should be accepted (optional, will default to B2C if not entered)
- supportedTypes - B2C and/or B2B
- default - Sets the default consumer type
- publicDevice - Default value = false, if set to true the checkout will not load any user data.
- charge - Default value = false, if set to true the transaction will be charged automatically after reservation have been accepted without calling the Charge API.
- paymentMethods
- name
- fee
- reference
- name
- quantity
- unit
- unitPrice
- taxRate
- taxAmount
- grossTotalAmount
- netTotalAmount
- notifications - Used to get the status of a transaction (optional)
- webhooks - List of webhooks the merchant wants to register for the payment. Maximum number of webhooks is 32.
- eventName - Input the event you want to listen for
- url - The callback is sent to this url on the merchant site. Must be https. Maximum length is 256 characters.
- authorization - Header of the callback sent to the merchant site will be set to this value. Must be between 8 and 32 characters long and alphanumeric.
- webhooks - List of webhooks the merchant wants to register for the payment. Maximum number of webhooks is 32.
WebHooks
Supported events for webhooks
Event | Description |
---|---|
payment.created | When a payment is created. |
payment.reservation.created payment.reservation.created.v2 |
When a customer successfully has reserved. |
payment.checkout.completed | When Checkout is completed. |
payment.charge.created payment.charge.created.v2 |
When a payment has been charged. Partially or fully. |
payment.charge.failed | When a charge has failed. |
payment.refund.initiated payment.refund.initiated.v2 |
When a refund is initiated. |
payment.refund.failed | When a refund has not gone through. |
payment.refund.completed | When a refund has successfully been completed. |
payment.cancel.created | When a reservation has been canceled. |
payment.cancel.failed | When a cancellation did not go through. |
Notifications
Parameter | Type | Description |
---|---|---|
webhooks | webhook | List of webhooks the merchant wants to register for the payment. Maximum number of webhooks is 32. |
Webhook parameters
Parameter | Type | Description |
---|---|---|
eventName | string | The callback will be triggered for this payment event. See list for valid events. |
url | string | The callback is sent to this url on the merchant site. Must be https. Maximum length is 256 characters. |
authorization | string | Authorization header of the callback sent to the merchant site will be set to this value. You may choose whatever key you want as long as it fits the format described in this section. Format: * 8 to 64 characters * "a-z," "A-Z", "0-9" and "-" (regex: [a-zA-Z0-9\-]) |