# Integrate Your Way
source: https://developer.mastercard.com/mastercard-gateway/documentation/use-cases/integrate-your-way/index.md

## Direct Payment {#direct-payment}

Merchants can control the checkout and payment flow by collecting card details on their own checkout page and sending them directly to the Mastercard Gateway for processing.

This integration model gives merchants full control over the customer experience while allowing them to process payments using either an authorization-only flow or an immediate payment flow.

### Prerequisites {#prerequisites}

Before you start, ensure that the following prerequisites are met:

* The customer has a valid payment card.
* The merchant is configured for direct card processing.
* Secure transport using TLS is in place.
* The payment amount is known.

### Sequence diagram {#sequence-diagram}

Diagram direct-payment

### Workflow {#workflow}

1. The payer enters card details on the merchant checkout page.
2. The merchant UI submits the card details to the merchant server.
3. The merchant server submits a PAY or AUTHORIZE request containing the card details to the Mastercard Gateway.
4. The Mastercard Gateway submits the payment request to the acquirer for processing.
5. The acquirer returns the payment result to the Mastercard Gateway.
6. The Mastercard Gateway returns the approval or decline result to the merchant server.
7. The merchant server displays the payment outcome in the merchant UI.

### Endpoint {#endpoint}

|     API     | Format | HTTP Method |                                                                            Operation                                                                             |
|-------------|--------|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Transaction | NVP    | POST        | [Pay](https://mtf.gateway.mastercard.com/api/documentation/apiDocumentation/nvp/version/100/operation/Transaction:%20%20Pay.html?locale=en_US)                   |
|             | REST   | PUT         | [Pay](https://mtf.gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/100/operation/Transaction%3a%20%20Pay.html?locale=en_US)           |
|             | NVP    | POST        | [Authorize](https://mtf.gateway.mastercard.com/api/documentation/apiDocumentation/nvp/version/100/operation/Transaction%3a%20%20Authorize.html?locale=en_US)     |
|             | REST   | PUT         | [Authorize](https://mtf.gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/100/operation/Transaction:%20%20Authorize.html?locale=en_US) |

### Error resolution {#error-resolution}

For details on error resolution, explore our [Code and Formats](https://developer.mastercard.com/mastercard-gateway/documentation/code-and-formats/index.md) section.

## Hosted Checkout {#hosted-checkout}

Merchants can accept online payments by redirecting customers to a fully hosted, PCI-compliant checkout page provided by the Mastercard Gateway. This approach minimizes front-end integration effort because the gateway hosts the payment page and securely collects the payment details.

The merchant creates a checkout session, redirects the payer to the hosted payment page, and retrieves the final payment outcome after the payer completes the payment.

### Prerequisites {#prerequisites-1}

Before you start, ensure that the following prerequisites are met:

* The merchant is configured for Hosted Checkout.
* The order details are available.
* The merchant can create checkout sessions.
* Return URLs are configured.

### Sequence diagram {#sequence-diagram-1}

Diagram hosted-checkout

### Workflow {#workflow-1}

1. The payer selects the payment option on the merchant website.
2. The merchant website requests a checkout session from the merchant server.
3. The merchant server initiates a Hosted Checkout session with the Mastercard Gateway.
4. The Mastercard Gateway returns the session identifier and redirect URL to the merchant server.
5. The merchant server returns the redirect instructions to the merchant website.
6. The merchant website redirects the payer to the hosted payment page.
7. The payer enters payment details and confirms the payment on the hosted payment page.
8. The Mastercard Gateway returns the payer to the merchant result page.
9. The merchant website retrieves the payment outcome from the merchant server.
10. The merchant server returns the final payment status to the merchant website.

### Endpoint {#endpoint-1}

|       API       | Format | HTTP Method |                                                                                       Operation                                                                                       |
|-----------------|--------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Hosted Checkout | NVP    | POST        | [Initiate Checkout](https://mtf.gateway.mastercard.com/api/documentation/apiDocumentation/nvp/version/100/operation/Hosted%20Checkout:%20Initiate%20Checkout.html?locale=en_US)       |
|                 | REST   | POST        | [Initiate Checkout](https://mtf.gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/100/operation/Hosted%20Checkout:%20Initiate%20Checkout.html?locale=en_US) |
| Transaction     | NVP    | POST        | [Retrieve Order](https://mtf.gateway.mastercard.com/api/documentation/apiDocumentation/nvp/version/100/operation/Transaction%3a%20%20Retrieve%20Order.html?locale=en_US)              |
|                 | REST   | GET         | [Retrieve Order](https://mtf.gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/100/operation/Transaction:%20%20Retrieve%20Order.html?locale=en_US)          |

### Error resolution {#error-resolution-1}

For details on error resolution, explore our [Code and Formats](https://developer.mastercard.com/mastercard-gateway/documentation/code-and-formats/index.md) section.
