Weiter zum Inhalt
Konto erstellen
oder
anmelden
Das Logo der Stripe-Dokumentation
/
KI fragen
Konto erstellen
Anmelden
Jetzt starten
Zahlungen
Revenue
Plattformen und Marktplätze
Geldmanagement
Entwickler-Tools
Übersicht
Informationen zu Stripe Payments
Aktualisieren Sie Ihre Integration
Zahlungsanalysefunktionen
Online-Zahlungen
ÜbersichtIhren Use case findenZahlungen verwalten
Payment Links verwenden
Bezahlseite erstellen
Erweiterte Integration erstellen
In-App-Integration erstellen
Zahlungsmethoden
Zahlungsmethoden hinzufügen
    Übersicht
    Optionen für die Integration von Zahlungsmethoden
    Standardzahlungsmethoden im Dashboard verwalten
    Arten von Zahlungsmethoden
    Karten
    Mit Stripe-Guthaben bezahlen
    Lastschriften
    Bank Redirect
    Banküberweisungen
    Überweisungen (Sources)
    Jetzt kaufen, später bezahlen
    Zahlungen in Echtzeit
    Gutscheine
    Geldbörsen
      Alipay
      Amazon Pay
      Apple Pay
      Cash App Pay
      Google Pay
      GrabPay
      Link
      MB WAY
        Zahlung annehmen
      MobilePay
      PayPal
      PayPay
      Revolut Pay
      Satispay
      Secure Remote Commerce
      Vipps
      WeChat Pay
    Lokale Zahlungsmethoden nach Land aktivieren
    Nutzerdefinierte Zahlungsmethoden
Zahlungsmethoden verwalten
Schnellerer Bezahlvorgang mit Link
Zahlungsschnittstellen
Payment Links
Checkout
Web Elements
In-App-Elements
Zahlungsszenarien
Nutzerdefinierte Zahlungsabläufe
Flexibles Acquiring
Orchestrierung
Präsenzzahlungen
Terminal
Andere Stripe-Produkte
Financial Connections
Krypto
Climate
StartseiteZahlungenAdd payment methodsWalletsMB WAY

Notiz

Bis jetzt ist diese Seite noch nicht in dieser Sprache verfügbar. Wir arbeiten aber verstärkt daran, unsere Dokumentation in weiteren Sprachen bereitzustellen, und werden die Übersetzung sofort anzeigen, sobald diese verfügbar ist.

MB WAY paymentsNur auf Einladung

Learn how to accept the MB WAY payment method.

Seite kopieren

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.

Notiz

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.

Vorsicht

Stripe automatically presents your customers payment method options by evaluating their currency, payment method restrictions, and other parameters. We recommend that you configure your payment methods from the Stripe Dashboard using the instructions in Accept a payment.

If you want to continue manually configuring the payment methods you present to your customers with Checkout, use this guide. Otherwise, update your integration to configure payment methods in the Dashboard.

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 frontend framework like 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 details
Client-side

Collect payment details on the client with the Payment Element. The Payment Element is a prebuilt UI component that simplifies collecting payment details for a variety of payment methods.

The Payment Element contains an iframe that securely sends payment information to Stripe over an HTTPS connection. Avoid placing the Payment Element within another iframe because some payment methods require redirecting to another page for payment confirmation.

The checkout page address must start with https:// rather than http:// for your integration to work. You can test your integration without using HTTPS, but remember to enable it when you’re ready to accept live payments.

Set up Stripe.js

The Payment Element is automatically available as a feature of Stripe.js. Include the Stripe.js script on your checkout page by adding it to the head of your HTML file. Always load Stripe.js directly from js.stripe.com to remain PCI compliant. Don’t include the script in a bundle or host a copy of it yourself.

checkout.html
<head> <title>Checkout</title> <script src="https://js.stripe.com/v3/"></script> </head>

Create an instance of Stripe with the following JavaScript on your checkout page:

checkout.js
// Set your publishable key: remember to change this to your live publishable key in production // See your keys here: https://dashboard.stripe.com/apikeys const stripe = Stripe(
'pk_test_TYooMQauvdEDq54NiTphI7jx'
, { betas: 'mb_way_pm_beta_1', });

Add the Payment Element to your payment page

The Payment Element needs a place to live on your payment page. Create an empty DOM node (container) with a unique ID in your payment form:

checkout.html
<form id="payment-form"> <div id="payment-element"> <!-- Elements will create form elements here --> </div> <button id="submit">Submit</button> <div id="error-message"> <!-- Display error message to your customers here --> </div> </form>

When the previous form loads, create an instance of the Payment Element and mount it to the container DOM node. Pass the client secret from the previous step into options when you create the Elements instance:

Handle the client secret carefully because it can complete the charge. Don’t log it, embed it in URLs, or expose it to anyone but the customer.

checkout.js
const options = { clientSecret: '{{CLIENT_SECRET}}', // Fully customizable with appearance API. appearance: {/*...*/}, }; // Set up Stripe.js and Elements to use in checkout form, passing the client secret obtained in a previous step const elements = stripe.elements(options); // Optional: Autofill user's saved payment methods. If the customer's // email is known when the page is loaded, you can pass the email // to the linkAuthenticationElement on mount: // // linkAuthenticationElement.mount("#link-authentication-element", { // defaultValues: { // email: 'jenny.rosen@example.com', // } // }) // Create and mount the Payment Element const paymentElementOptions = { layout: 'accordion'}; const paymentElement = elements.create('payment', paymentElementOptions); paymentElement.mount('#payment-element');

Submit the payment to Stripe
Client-side

Use stripe.confirmPayment to complete the payment using details from the Payment Element. This sends an authorization request to the buyer.

Notiz

stripe.confirmPayment might take several seconds to complete while waiting for customers to authorize the payment. During that time, disable your form from being resubmitted and show a waiting indicator like a spinner. If you receive an error, show it to the customer, re-enable the form, and hide the waiting indicator.

checkout.js
const form = document.getElementById('payment-form'); form.addEventListener('submit', async (event) => { event.preventDefault(); const {error, paymentIntent} = await stripe.confirmPayment({ //`Elements` instance that was used to create the Payment Element elements, redirect: 'if_required', }); const message = document.querySelector('#message') if (error) { // This point will only be reached if there is an immediate error when // confirming the payment. Show error to your customer (for example, payment // details incomplete) message.innerText = error.message; } else { // This will execute if the confirm request is successful, or if the // payment fails asynchronously. switch (paymentIntent.status) { case 'succeeded': message.innerText = 'Success! Payment received.'; break; case 'requires_payment_method': message.innerText = 'Payment failed. Please try another payment method.'; // Redirect your user back to your payment page to attempt collecting // payment again break; default: message.innerText = 'Something went wrong.'; break; } } });

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

War diese Seite hilfreich?
JaNein
Benötigen Sie Hilfe? Kontaktieren Sie den Kundensupport.
Nehmen Sie an unserem Programm für frühzeitigen Zugriff teil.
Schauen Sie sich unser Änderungsprotokoll an.
Fragen? Sales-Team kontaktieren.
LLM? Lesen Sie llms.txt.
Unterstützt von Markdoc