Confirm order
This guide shows what information you need to send to your customer after a completed checkout.
Before you start
This guide assumes that you already have a Checkout Portal account and have integrated Checkout on your website.
Overview
Once a purchase has completed, an order confirmation must be sent by email to your customer. The confirmation must include detailed information about the order. The information can be retrieved in two ways:
- Using Checkout Portal.
- Using the Retrieve payment method from the Payment API.
You can be notified about new purchases on the checkout page by subscribing to the webhook event payment.checkout.completed
.
This guide lists all the information you need to provide in the order confirmation email and how to retrive the information from Checkout by using webhooks and the Payment API.
Step 1: Track new orders using webhooks
To get notified when a new order has been placed by a customer, you can subscribe to the payment.checkout.completed
event. See the guide Track events using webhooks for information about how to set up a webhook endpoint.
Here is an example of a payload sent from Checkout for the Checkout completed event:
Payload (payment.checkout.completed)
{ "id": "36ce3ff4a896450ea2b70f3263554772", "merchantId": 100017120, "timestamp": "2021-05-04T22:09:08.4342+02:00",
The most important property in this payload is the paymentId
that can be used to retrieve more details about the payment.
Step 2: Retrieve information from Checkout Portal (optional)
You can find information about completed purchases in Checkout Portal by follwoing the steps below:
- Log in to Checkout Portal.
- Navigate to New payments.
- Click on the order row you are interested in.
- Click "Order details" and "Transaction details" to show all information about the order.
Although you can find all the information you need in Checkout Portal, we recommend that you use the Payment API to automatically fetch the details about new orders programmatically.
Step 3: Retrieve payment details from the Payment API
You can retrieve detailed information about a payment by using the Retrieve payment method. You need to pass the identifier of the payment that you are interested in. Here is an example:
Retrieve payment details
- PHP
- Node
<?php $curl = curl_init();
A successful request will return information about the specified payment. Here is an example of a response body:
Response (Retrieve payment)
{ "payment": { "paymentId": "01cc000060c31fdc611b370244e765d0", "summary": {
Please note that unless you have collected consumer data on the checkout page, there is no guarantee that any consumer data is returned in the response. If you are managing customer data on in your own backend, you need to be able to match the order refererence with a customer in your database.
Step 4: Send order confirmation
The order confirmation email must contain the detailed information about the purchase and should be sent immediately to the customer after a successful order. The following table lists all the required fields that you need to include in the order confirmation email:
Field | Description | Property |
---|---|---|
Payment ID | The payment identifer. | paymentId |
Order number | Your webshop’s internal order reference number. | reference |
Delivery date | Expected date of delivery (for example, "will be delivered within 5 days"). | n/a |
Contact details | Your contact details including company name, address, e-mail address and/or telephone number. | n/a |
Purchased products | A complete description of the services/products purchased. | n/a |
Masked pan | The last four digits of the card number when purchase is done by card. | maskedPan |
Order date | The date when the order was created. | created |
Total amount | The total amount being charged (charges, value added tax, shipping etc). The amount indicated must not exceed the amount quoted in the order form. | amount |
Currency | All prices must include the currency (SEK for example) | currency |