> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://mmg-sdk.wetechnologygroup.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mmg-sdk.wetechnologygroup.com/_mcp/server.

# Hosted Checkout Overview

> Learn how to integrate the Mobile Money Guyana (MMG) Hosted Checkout flow using the SDK.

# MMG Hosted Checkout

The MMG Hosted Checkout allows you to redirect customers to a secure, MMG-hosted payment page. Customers authenticate and authorize the payment directly with MMG, reducing your PCI compliance burden.

Because the checkout relies on local RSA encryption and decryption, the SDK provides specialized utility functions to generate the redirect URLs and decrypt the incoming webhooks safely.

## The Checkout Lifecycle

1. **Initiate:** Your customer clicks "Pay with MMG" on your application.
2. **Generate URL:** Your backend uses the SDK to encrypt the checkout details and generates a secure MMG redirect URL.
3. **Redirect:** You redirect the customer to the generated URL.
4. **Authorize:** The customer logs into MMG, verifies the OTP, and confirms the payment.
5. **Callback:** MMG securely `POST`s the encrypted transaction result to your server's Webhook URL.
6. **Decrypt & Fulfill:** Your server uses the SDK to decrypt the webhook payload and fulfills the customer's order.

## Prerequisites

Before building the checkout flow, ensure you have received the following credentials from your MMG onboarding representative:

* **Merchant Client ID** (`X-CLIENT-ID`)
* **Merchant Mobile Number** (7-digit Merchant ID)
* **Secret Key**
* **PEM Public Key** (Used to encrypt the outgoing payload)
* **PEM Private Key** (Used to decrypt the incoming webhook)

> **Info**
>
> **Important Security Note:** Because this flow requires the use of a Private PEM Key, the checkout utility must **only** be used on your backend server. Never expose your keys or run these SDK methods in a frontend browser environment (like React, Vue, or plain HTML).