# Non‑Checkout Flow

The **Non‑Checkout Flow** allows you to recieve card  payments **without redirecting the customer to the Vesicash checkout page**.

In this method, you initiate the payment from your backend and then complete it by making a direct API call using the payment reference.

This flow is ideal when you want **full control of the payment experience** within your website, mobile app, or custom UI.

The flow supports two active operators depending on the currency of the transaction.

1. **GTI** - Exclusively for **USD** payments.
2. **MPGS** - Exclusively for **GHS** payments.

**How the Non‑Checkout Card payment Flow Works**

1. **Initialize the Payment**: Make a server-side POST request to the payment initialization endpoint. Vesicash returns a paymentReference that uniquely identifies the transaction.
2. **Complete the Payment**: Using the paymentReference returned during initiation, your server immediately calls the Complete Payment endpoint. This returns a bank card payment link. Load this link and the customer will complete the transaction.
3. **After the Payment**: Once the payment is completed you can check the status on the status check endpoint and a webhook notification will be sent.

**Step 1: Initialize the Payment**

Send a server‑side POST request to the payment initialization endpoint.

#### <mark style="color:green;">POST:</mark> /v1/payment/init

#### Headers

| Name       | Type   | Description              |
| ---------- | ------ | ------------------------ |
| secret-key | string | Your Vesicash secret key |
| public-key | string | Your Vesicash public key |

#### Request body

* currency (string): The currency for the payment.
* country (string): The country for the payment.
* narration (string): Description or reason for the payment.
* method (string): The payment method to be used.
* amount (number): The amount of the payment.
* operator(string): The payment gateway operator to use. Expected values are gti or mpgs.
* redirect\_success\_url(string): The absolute URL where the user will be redirected to upon a successful payment.
* redirect\_failed\_url(string):The absolute URL where the user will be redirected to if the payment fails.
* integration\_type(string): Required when operator is mpgs. The expected value is DIRECT\_API.
* webhook\_url (string): A URL where notifications about the payment status will be sent.

#### Request

1. #### GTI (USD Payments)

The GTI operator is strictly used for payments in USD.

For example, you can make a post request to the endpoint above and pass in the raw json data below to create a one-off transaction.

```
{
    "amount": 1,
    "currency": "USD",
    "country": "US",
    "method": "card",
    "operator": "gti",
    "narration": "Checkout GTI Test",
    "redirect_success_url": "https://www.yourdomain.com/success",
    "redirect_failed_url": "https://merchant.yourdomain.com/login",
    "webhook_url": "https://api.yourdomain.com/webhooks/checkout"
}

```

2. #### MPGS (GHS Payments)

The `MPGS` operator is used for payments in `GHS`. Notice the inclusion of the integration\_type attribute.

```
{
    "amount": 1,
    "country": "GH",
    "currency": "GHS",
    "method": "card",
    "narration": "Test Narration",
    "operator": "mpgs",
    "redirect_success_url": "https://alexpay-mpgs.yourdomain.app/api/confirm",
    "redirect_failed_url": "https://alexpay-mpgs.yourdomain.app/api/failed",
    "webhook_url": "https://api.yourdomain.com/webhooks/checkout",
    "integration_type": "DIRECT_API"
}

```

#### Response

```
{
    "status": "success",
    "code": 200,
    "message": "success",
    "data": {
        "payment_link": "",
        "reference": "",
        "payment_id": "",
        "status": "pending"
    }
}
```

**Step 2: Complete the Payment**

Using the paymentReference returned during initiation, your server immediately calls the Complete Payment endpoint. This returns a bank card payment link. Load this link and the customer will complete the transaction

<mark style="color:$success;">**POST**</mark>**: /v1/payment/pay/:payment\_reference**

**Params**

| Name               | Type   | Description                                                        |
| ------------------ | ------ | ------------------------------------------------------------------ |
| payment\_reference | string | The payment reference that was generated when initializing payment |

#### Headers

| Name       | Type   | Description              |
| ---------- | ------ | ------------------------ |
| public-key | string | Your Vesicash public key |

#### Request

#### 1. GTI Payload Requirements <a href="#user-content-1-gti-payload-requirements" id="user-content-1-gti-payload-requirements"></a>

The GTI operator requires basic card details, standard billing information, and redirect URLs to handle the payment outcome.<br>

```
{
    "card_number": "5399839213647612",
    "card_cvv": "208",
    "card_expiry_date": "0929",
    "email": "customer@example.com",
    "phone_number": "+2348011112222",
    "customer_first_name": "John",
    "customer_last_name": "Doe",
    "method": "card",
    "operator": "gti",
    "billing_address_line1": "123 Business Way",
    "billing_city": "Lagos",
    "billing_province": "Lagos",
    "billing_postal_code": "100001",
    "billing_country": "NG",
    "redirect_url": "https://google.com",
    "redirect_success_url": "https://www.google.com/",
    "redirect_failed_url": "https://merchant.vesicash.com/login"
}

```

2. #### MPGS Payload Requirements

The **MPGS** operator requires detailed client metadata and network info (likely for 3D Secure verification) but excludes the billing and redirection information found in the **GTI** payload.

```
{
    "phone_number": "111111111",
    "email": "customer@example.com",
    "customer_first_name": "Jane",
    "customer_last_name": "Doe",
    "card_number": "111111111111111111",
    "card_expiry_date": "0629",
    "card_cvv": "222",
    "java_enabled": false,
    "language": "en-GB",
    "screen_height": 1080,
    "screen_width": 1920,
    "color_depth": 24,
    "time_zone": -60,
    "ip_address": "{{clientIPAddress}}",
    "browser_user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36"
}

```

#### Response

```
{
    "status": "success",
    "code": 200,
    "message": "Success. Redirect to 3DS.",
    "data": {
        "message": "Success. Redirect to 3DS.",
        "device_storage_token": null,
        "method": "card",
        "payment_status": "processing",
        "operator": "gti",
        "reference": "",
        "redirect_url": "https://checkout.gtipayglobal.com/checkout//mp"
    }
}
```

Then load the payment link provided in the response, allowing the customer to authorize the card payment.

Once approval is completed, Vesicash processes the transaction.

**Step 3: After the Payment**

Once the customer completes the payment on the bank checkout page:

1. **Query Payment Status**: Your server should call the Payment Status endpoint to confirm the final state of the transaction (e.g., success, failed, pending).
2. **Receive Webhook Notification**: Vesicash automatically sends a webhook to your configured webhook URL whenever the transaction status changes.
