> For the complete documentation index, see [llms.txt](https://docs.ecommerce.seb.ee/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ecommerce.seb.ee/integration/mobile-sdk/ios-sdk/quickstart.md).

# Quickstart

This walks you from an installed SDK to one successful sandbox payment through hosted checkout. It takes three values from your backend and about twenty lines of app code.

## Prerequisites

* The SDK installed in your project. See [Installation](/integration/mobile-sdk/ios-sdk/installation.md).
* A backend that can create a payment. See [Backend integration](/integration/mobile-sdk/ios-sdk/guides/backend-integration.md).
* The sandbox base URL for your backend's status endpoint.

***

## Step 1: Get the payment from your backend

Your backend creates the payment and returns three values to the app:

| Value              | Where it comes from                                       |
| ------------------ | --------------------------------------------------------- |
| `paymentId`        | The `paymentId` field of the payment initiation response. |
| `verificationKey`  | The last path segment of `_links.checkoutRedirect.href`.  |
| `checkoutRedirect` | The `_links.checkoutRedirect.href` value itself.          |

Your backend also chooses the `shopRedirectUrl` it sends at initiation. Your app uses the same value as its return URL, so decide it once and share it between the two.

[Backend integration](/integration/mobile-sdk/ios-sdk/guides/backend-integration.md) has the full request and response.

## Step 2: Register your return URL scheme

If your return URL uses a custom scheme, declare it in your app's `Info.plist`:

```xml
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array><string>myapp</string></array>
    </dict>
</array>
```

An `https://` universal link works too, and needs no `Info.plist` entry.

## Step 3: Create a payment kit

Create one `PaymentKit` for your checkout screen. `apiBaseURL` points at your own backend, which the SDK calls to confirm the payment status once the shopper is done.

```swift
import EGWPay

let configuration = Configuration(
    apiBaseURL: URL(string: "https://your-backend.example.com"),
    environment: .sandbox
)

let paymentKit = PaymentKit(configuration: configuration)
```

## Step 4: Start the payment

```swift
let request = PaymentRequest(
    paymentId: payment.paymentId,
    verificationKey: payment.verificationKey,
    checkoutURL: payment.checkoutRedirect,
    returnURL: URL(string: "myapp://checkout/return")!
)

paymentKit.startPayment(request, from: self) { result in
    switch result.outcome {
    case .succeeded:
        self.showReceipt(reference: result.orderNumber ?? result.paymentId)
    case .failed:
        self.showFailure(message: result.error?.localizedDescription)
    case .cancelled:
        break
    case .unresolved:
        self.confirmWithBackend(paymentId: result.paymentId)
    }
}
```

Run the app and pay. The checkout page opens, you complete the payment, and the callback fires with `.succeeded`.

What happened automatically: the SDK presented the checkout page modally, watched every navigation for your return URL, dismissed its own interface as soon as the shopper finished, asked your backend for the payment status, and delivered exactly one result on the main thread.

Sandbox test cards: [Test cards](/guides/sandbox/test-data.md#payment-cards)

***

## About `.unresolved`

`.unresolved` is a normal outcome, not an error. It means the SDK could not determine the result, most often because the payment is still in flight at the moment the shopper returns to your app. Ask your backend rather than guessing. [Handling the result](/integration/mobile-sdk/ios-sdk/using-the-sdk/handling-the-result.md) covers each outcome in detail.

{% hint style="danger" %}
**Do not fulfill an order from the payment result.** Fulfill from your backend, driven by the platform's notifications to it. The result tells you what to put on screen, nothing more.
{% endhint %}

***

## Next steps

* [Hosted checkout](/integration/mobile-sdk/ios-sdk/using-the-sdk/hosted-checkout.md) - return URL matching, preselecting a payment method.
* [Native card form](/integration/mobile-sdk/ios-sdk/using-the-sdk/native-card-form.md) - collect card details in your own UI.
* [Handling the result](/integration/mobile-sdk/ios-sdk/using-the-sdk/handling-the-result.md) - outcomes, the callback contract, custom status lookup.
* [Error handling](/integration/mobile-sdk/ios-sdk/guides/error-handling.md) - every error code and how to trace a failure.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ecommerce.seb.ee/integration/mobile-sdk/ios-sdk/quickstart.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
