> **Description:** Enable quick and easy in-store payments using static QR codes that customers can scan with their Vipps or MobilePay app, perfect for simple point-of-sale setups.

# How the merchant callback QR works

In this flow, a user pays by scanning a QR with their Vipps  or MobilePay  app.
The merchant gets their ID and sends a payment request to them through the app.
Optionally, the merchant can also get the phone number of the user and enroll them in their loyalty program.

Flow diagram: 5-step static QR merchant callback process. (1) Products are added to the order. (2) The customer scans the static QR. (3) Merchant generates a payment request. (4) The customer authorizes the payment. (5) The payment is registered.

## Prerequisites

 **Merchant callback QR**: Generate a merchant callback QR code, as described in the [QR API: Merchant callback QR codes](https://developer.vippsmobilepay.com/docs/APIs/qr-api/api-guide/merchant-callback.md).

 **Webhooks**: Set up [webhooks](https://developer.vippsmobilepay.com/docs/APIs/webhooks-api/README.md) to receive event notifications when the QR is scanned and when the payment is approved.

## Details

### Step 1: Products are added for payment

### Step 2: The customer scans the QR

### Step 3: The merchant's system sends the payment request

Your system will receive a webhook notification that the customer has scanned the QR and is ready to pay with Vipps MobilePay.
The notification will contain a token you can use to start a payment.

Use the token to send the customer a
[Create Payment request](https://developer.vippsmobilepay.com/redocusaurus/epayment-swagger-id.yaml).

### Step 4: The customer authorizes the payment

The payment request will appear in the customer's Vipps or MobilePay app,
where they can select to pay or cancel.

### Step 5: The merchant's system updates the status

Your system will receive a webhook notification regarding their choice.
You can also poll for the status.

Once the payment is approved, update the status in your system.
You may capture the payment immediately and provide a receipt.

## Sequence diagram

Integration sequence for payments.

Payment-only flow

```mermaid
sequenceDiagram
    autonumber
    actor C as Customer
    participant Webhooks as Webhooks API
    participant M as Merchant
    participant ePayment as ePayment API
    participant QR as QR API

    M->>QR: Create Callback QR
    C->>C: Customer scans QR
    Webhooks-->>M: Get notification of scan
    M->>M: Add product to sale
    M->>ePayment: Initiate payment request and add order details
    ePayment->>C: Request payment
    C->>C: Customer clicks pay
    Webhooks-->>M: Webhook with status of payment authorization
    M->>ePayment: Capture payment
    ePayment-->>M: Status of capture
    M->>M: Verify status of POS matches capture
```

  Merchant creates a callback QR code via the QR API.
  Customer scans the QR code.
  Webhooks API notifies the merchant of the scan.
  Merchant adds the product to the sale.
  Merchant initiates a payment request and adds order details via the ePayment API.
  ePayment API requests payment from the customer.
  Customer clicks pay.
  Webhooks API sends the merchant a webhook with the payment authorization status.
  Merchant captures the payment via the ePayment API.
  ePayment API returns the status of the capture.
  Merchant verifies that the POS status matches the capture.

See a more complex flow

A more complex flow could involve getting access to the customer's phone number when they scan the QR code.
This uses the [Customer token exchange endpoint](https://developer.vippsmobilepay.com/docs/APIs/qr-api/api-guide/merchant-callback.md#customer-token-exchange-endpoint).

Once you have the phone number, you could check if the customer is a member of your loyalty program.
If not, you can ask them to enroll. This uses the
[Login flow](https://developer.vippsmobilepay.com/docs/APIs/login-api/how-it-works/merchant-initiated-login-howitworks.md)
to gather consent from the customer.

The steps needed to get consent from the user are explained in detail there.
The merchant initiated login flow will send a push to the user, and once the user has finished the flow, they will be ready to pay.

Sequence diagram for complete flow including phone number lookup, customer enrollment and payment is as follows.

Flow with lookup, enrollment, and payment

```mermaid
sequenceDiagram
    autonumber
    actor C as Customer
    participant Webhooks as Webhooks API
    participant M as Merchant
    participant ePayment as ePayment API
    participant login as Login API
    participant QR as QR API

    M->>QR: Create Callback QR
    C-->>Webhooks: Customer scans QR which triggers webhook
    Webhooks-->>M: Get notification of scan
    M->>QR: Get phone number from token
    M->>login: Initiate login
    login->>C: Request login
    C->>C: Customer approves login
    M->>login: Poll login token
    M->>login: Get user info
    M->>M: Add product to sale
    M->>ePayment: Initiate payment request and add order details
    ePayment->>C: Request payment
    C->>C: Customer clicks pay
    Webhooks-->>M: Webhook with status of payment authorization
    M->>ePayment: Capture payment
    ePayment-->>M: Status of capture
    M->>M: Verify status of POS matches capture
```

  Merchant creates a callback QR code via the QR API.
  Customer scans the QR code, which triggers a webhook.
  Webhooks API notifies the merchant of the scan.
  Merchant retrieves the customer's phone number from the token via the QR API.
  Merchant initiates a login via the Login API.
  Login API requests login from the customer.
  Customer approves the login.
  Merchant polls the login token from the Login API.
  Merchant retrieves user info from the Login API.
  Merchant adds the product to the sale.
  Merchant initiates a payment request and adds order details via the ePayment API.
  ePayment API requests payment from the customer.
  Customer clicks pay.
  Webhooks API sends the merchant a webhook with the payment authorization status.
  Merchant captures the payment via the ePayment API.
  ePayment API returns the status of the capture.
  Merchant verifies that the POS status matches the capture.

## Next steps

See:

* [QR API guide: Merchant Callback QR codes](https://developer.vippsmobilepay.com/docs/APIs/qr-api/api-guide/merchant-callback.md)

> **Full site overview:** For every page in this documentation, read [https://developer.vippsmobilepay.com/llms.txt](https://developer.vippsmobilepay.com/llms.txt).
