Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
Build an advanced integration
Build an in-app integration
Payment Methods
Add payment methods
    Overview
    Payment method integration options
    Manage default payment methods in the Dashboard
    Payment method types
    Cards
    Pay with Stripe balance
    Crypto
    Bank debits
    Bank redirects
    Bank transfers
    Credit transfers (Sources)
    Buy now, pay later
    Real-time payments
    Vouchers
    Wallets
      Alipay
      Amazon Pay
      Apple Pay
      Cash App Pay
      Google Pay
      GrabPay
      Link
      MB WAY
        Accept a payment
      MobilePay
      PayPal
      PayPay
      Revolut Pay
      Satispay
      Secure Remote Commerce
      Vipps
      WeChat Pay
    Enable local payment methods by country
    Custom payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Elements
Payment scenarios
Handle multiple currencies
Custom payment flows
Flexible acquiring
Orchestration
In-person payments
Terminal
Beyond payments
Incorporate your company
Crypto
Financial Connections
Climate
HomePaymentsAdd payment methodsWalletsMB WAY

MB WAY paymentsInvite only

Learn how to accept the MB WAY payment method.

MB WAY is a digital wallet payment method in Portugal. When paying with MB WAY, customers initiate payments using their phone number, and authenticate and approve them using their MB WAY app.

You get immediate notification of whether the payment succeeded or failed.

Note

MB WAY supports international phone numbers, but the majority of customers use a Portuguese phone number starting with +351. You can test your integration in a sandbox using test phone numbers.

Set up Stripe
Server-side

First, create a Stripe account or sign in.

Use our official libraries to access the Stripe API from your application:

Command Line
Ruby
# Available as a gem sudo gem install stripe
Gemfile
Ruby
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

Create a PaymentIntent
Server-side

A PaymentIntent is an object that represents your intent to collect a payment from a customer and tracks the payment process. To create a PaymentIntent that accepts a MB WAY payment method, specify the amount to collect, eur as the currency, and mb_way in the payment_method_types list. If you maintain a list of payment method types that you pass when creating a PaymentIntent, add mb_way to it.

Command Line
cURL
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d amount=1000 \ -d currency=eur \ -d "payment_method_types[]"=mb_way

Retrieve the client secret

The PaymentIntent includes a client secret that the client side uses to securely complete the payment process. You can use different approaches to pass the client secret to the client side.

Retrieve the client secret from an endpoint on your server, using the browser’s fetch function. This approach is best if your client side is a single-page application, particularly one built with a modern front-end framework such as React. Create the server endpoint that serves the client secret:

main.rb
Ruby
get '/secret' do intent = # ... Create or retrieve the PaymentIntent {client_secret: intent.client_secret}.to_json end

And then fetch the client secret with JavaScript on the client side:

(async () => { const response = await fetch('/secret'); const {client_secret: clientSecret} = await response.json(); // Render the form using the clientSecret })();

Collect payment method details and submit the payment
Client-side

When you confirm the payment, pass the client secret.

Caution

Handle the client secret carefully, because it allows access to the PaymentIntent. Don’t log it, embed it in URLs, or expose it to anyone but the customer.

Use stripe.confirmMbWayPayment to initiate the payment authorisation with your customer.

The customer receives a notification about the payment request, and authorises or declines the request in their MB WAY app.

script.js
// Inititates the payment request notification to the customer stripe.confirmMbWayPayment( '{{PAYMENT_INTENT_CLIENT_SECRET}}', { payment_method: { billing_details: { // Phone number is required for all MB WAY payment phone: '+351911111111' } } } ).then(function(result) { if (result.error) { // Inform the customer that there was an error. console.log(result.error.message); } });

By default, Stripe.js polls for updates to the PaymentIntent. The promise returned by confirmMbWayPayment resolves when the PaymentIntent reaches the succeeded state, or when the payment fails and the PaymentIntent returns to the requires_payment_method state. See the PaymentIntent lifecycle for details on how these transitions happen.

To poll yourself, disable automatic polling by setting handleActions: false:

script.js
stripe.confirmMbWayPayment( '{{PAYMENT_INTENT_CLIENT_SECRET}}', { payment_method: { billing_details: { phone: '+351911111111' } } } { handleActions: false } // <---- Like this )

In this case, call the PaymentIntents API to fetch status of the PaymentIntent yourself.

Test your integration

Test your MB WAY integration by using the following test phone numbers. Each set of details reproduces a common live mode scenario.

Phone numberDescription
+351911111112The PaymentIntent status transitions from requires_action to succeeded after 15 seconds.
+351911111113The PaymentIntent status transitions from requires_action to requires_payment_method immediately. Stripe returns the payment_method_not_available error code.
+351911111114The PaymentIntent status transitions from requires_action to requires_payment_method immediately. Stripe returns the payment_method_provider_decline error code.
+351911111115The PaymentIntent status transitions from requires_action to requires_payment_method immediately. Stripe returns the payment_intent_payment_attempt_expired error code.
+351911111116The PaymentIntent status transitions from requires_action to requires_payment_method immediately. Stripe returns the payment_method_customer_decline error code.
<any other number>The PaymentIntent status immediately transitions from requires_action to succeeded.

OptionalHandle post-payment events

Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access programme.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc