Confirmation

In this tutorial you will learn what to do after the user has passed Ecster Pay successfully.

Show success page

First of all you have to decide if you are going to use your own success page or Ecster Pay's success page.

Show your own success page

The default setting is set to show your own success page. You don't have to configure this in Ecster's JavaScript libary . You only need to listen to Ecsters callback onPaymentSuccess and redirect the user to your own success page. See more information about Ecster's callbacks here.

Show Ecster Pay's success page

To configure this option set Ecster's JavaScript library showPaymentResult to the value true. You can see all start functions in Ecster´s JavaScript library here.

Confirmation callback

Ecster have confirmation callbacks for you to listen to. This way you can instantly show the user your success page without delay.

Ecster Pay can return three different confirmation callbacks after a user has clicked the "Place order" button.

  • onPaymentSuccess
  • onPaymentFailure
  • onPaymentDenied

onPaymentSuccess

This event is trigged when the payment has been successfully executed. When triggered, you should update the order in your system accordingly.

onPaymentFailure

An event that is trigged when the payment has failed e.g. users card are blocked by the issuing bank.

Note

In the case of a payment failure the user remains in the Ecster Pay frame in order to allow the user to choose another payment method.

onPaymentDenied

An event that is trigged when the payment was denied by the payment service.

Note

In the case of a payment failure the user remains in the Ecster Pay frame in order to allow the user to choose another payment method.

Push notifications

Ecster uses push notifications to tell you what the current orderstatus and which events have been done to an order.

Ecster calls this Order Event Notification (OEN). Ecster will send an OEN when an orderstatus is changed or when an event occur.

OEN is an asynchronous notification which means that it can be sent within seconds but can also be delayed for minutes.

This is why you should not build your application relying on an OEN being sent within a certain amount of time.

OEN example

Ecster does a HTTP POST request to the notificationURL provided in the createCart and updateCart request with the following parameters:

  • orderId
  • orderReference
  • status
  • time
  • event

You can see all order and event statuses in the API Reference section. 

Below you have an JSON example on how a OEN response look like.

POST /<your notificationURL>

Content-Type: application/json

{
  "orderId": "eYBtAD0wTZIzDWkVpGhe",
  "orderReference": "10000",
  "status": "READY"
  "time": "2019-02-07T12:27:28Z",
  "event":"CREATED"
}

What to do when you receive an OEN notification

After you have received an OEN you should always call Ecster's REST call getOrder, this way you will get the full order with current status so you can update your order in your own system. You can read all about getOrder here.

Change order reference

This function lets you update or set the parameter orderReference after an order have been processed. 

You only have to send a HTTP POST request with the orderReference you want it to be, it has no limit of how many times it can be changed.

Below you see an example:

 

PUT /rest/public/v1/orders/<internalReference>/orderReference

x-api-key: JKN675aVeMR9Mleh786FGf2ff7T1okmH6
x-merchant-key: 10569832
Content-Type: application/json

{
 "orderReference":"neworderref"
}

Next step

You have now managed to handle a confirmation of a purchase. Next step is to integrate order management functions like, debit or credit. Please continue to the Order Management section for more information.

Go to next step here

Request test account