# MB WAY for Payment Setup API To accept MB WAY payments, you must: 1. Create a payment setup. 2. Confirm the payment. 3. Redirect the customer to MB WAY. --- ## Create a payment setup Call the [Create a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/createAPaymentSetup) endpoint. > **Information** > > Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md). **Production** `POST` `https://{prefix}.api.checkout.com/payments/setups` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payments/setups` ### Request example ```json { "amount": 1000, "currency": "EUR", "reference": "ORD-5023-4E89", "customer": { "phone": { "country_code": "351", "number": "912345678" } }, "settings": { "success_url": "https://example.com/payments/success", "failure_url": "https://example.com/payments/failure" } } ``` In the request body, provide the following: | Field | Description | | --- | --- | | `amount`
`number` | The payment amount, in the [minor currency unit](https://www.checkout.com/docs/payments/accept-payments/format-the-amount-value).

Minimum: 1

**Required** | | `currency`
`string` | Three-letter ISO 4217 [currency code](https://www.checkout.com/docs/developer-resources/codes/currency-codes.md).

Supported value: `EUR`

**Required** | | `customer.phone`
`object` | The customer's phone number.

**Required** | | `customer.phone.country_code`
`string` | The country calling code for the customer's phone number.

Min length: 1

Max length: 7

**Required** | | `customer.phone.number`
`string` | The customer's phone number.

Max length: 25

**Required** | | `reference`
`string` | A unique reference for the payment.

Max length: 80

**Required** | | `settings.failure_url`
`string` | The URL to redirect the customer to if the payment fails.

Format: URI

Max length: 1024

**Required** | | `settings.success_url`
`string` | The URL to redirect the customer to if the payment is successful.

Format: URI

Max length: 1024

**Required** | | `customer.name`
`string` | The customer's full name.

Max length: 225 | | `description`
`string` | A description of the payment.

Max length: 100 | ### Response example ```json { "id": "set_rcmepwrchqab2wsergcafvijfy", "processing_channel_id": "pc_mbwayrv3wxetbjo2mybygeszy", "amount": 1000, "currency": "EUR", "payment_type": "Regular", "reference": "ORD-5023-4E89", "description": "MB WAY payment", "payment_methods": { "mbway": { "status": "ready", "flags": [] } }, "available_payment_methods": [ "mbway" ], "settings": { "success_url": "https://example.com/payments/success", "failure_url": "https://example.com/payments/failure" } } ``` The response returns a `payment_methods` object, which contains the payment methods enabled on your account. When all required fields are present, the `payment_methods.mbway` object shows a `ready` [status](https://www.checkout.com/docs/payments/accept-payments/accept-a-payment-using-the-payment-setup-api.md#Payment_method_status). --- ## Confirm the payment Confirm the payment by calling the [Confirm a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/confirmAPaymentSetup) endpoint and provide: - The payment setup `id` as the `{id}` path parameter. - `mbway` as the `{payment_method_name}` path parameter. ### Request example **Production** `POST` `https://{prefix}.api.checkout.com/payments/setups/{id}/confirm/mbway` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payments/setups/{id}/confirm/mbway` ### Response example ```json { "id": "pay_7ehiotldrlvujfpiyeo42i2roe", "status": "Pending", "reference": "ORD-5023-4E89", "customer": { "id": "cus_urx7wggzcpzufjjynbn7t6l5mq", "phone": { "country_code": "351", "number": "912345678" } }, "_links": { "self": { "href": "https://{prefix}.api.checkout.com/payments/pay_7ehiotldrlvujfpiyeo42i2roe" }, "redirect": { "href": "https://example.com/mbway/redirect" } } } ``` --- ## Redirect the customer Redirect the customer to the `_links.redirect.href` URL from the response. The customer completes the payment in the MB WAY app and is then redirected back to your `settings.success_url` or `settings.failure_url`.