Are you looking for test card numbers?

Would you like to contact support?

No momento, esta página não está disponível em inglês
Payment-method icon

MB WAY Component

Add MB WAY to an existing Components integration.

On this page, you can find additional configuration for adding MB WAY to your Components integration.

Before you begin

Before starting your MB WAY integration:

  1. Make sure you've integrated Components v3.7.0 or later.
  2. Add MB WAY in your test Customer Area.

Initialize the Component

To initialize the payment method Component, you need the decoded payment method object, and the APIContext :

let paymentMethod = paymentMethods?.paymentMethod(ofType: MBWayPaymentMethod.self)
let mbwayComponent = MBWayComponent(paymentMethod: paymentMethod, apiContext: apiContext)
mbwayComponent.delegate = self

// Keep the component instance to avoid it being destroyed after the function is executed.
self.mbwayComponent = mbwayComponent

present(cardComponent.viewController, animated: true)

After the shopper provides their phone number, the Component invokes the didSubmit method from the PaymentComponentDelegate.

Handle the await action

  1. Create and persist an instance of the AdyenActionComponent:

    internal lazy var actionComponent: AdyenActionComponent = {
      let component = AdyenActionComponent(apiContext: apiContext)
      component.delegate = self
      component.presentationDelegate = self
      return component
    }()
  2. Then use it to handle the the action object from /payments response.:

    let action = try JSONDecoder().decode(Action.self, from: actionData)
    actionComponent.handle(action)
  3. Implement a function to present the await UI, shown while the shopper completes the payment in the MB WAY app.

    internal func present(component: PresentableComponent, disableCloseButton: Bool) {
      // present `component.viewController` with a Cancel button that
      // calls `cancelDidPress()` when the shopper dismisses the `component.viewController`
    
      // Keep the component instance to avoid it being destroyed after the function is executed.
      self.currentPresentedComponent = component
      present(navigation, animated: true)
    }
    // If the shopper cancels, stop the component from polling for the payment result.
    func cancelDidPress() {
       self.currentPresentedComponent.cancelIfNeeded()
    }

Test and go live

To test your MB WAY integration, you can use any telephone number, for example +351234567890.
You can trigger a specific resultCode value by appending a code to the shopperStatement value in your /payments request:

resultCode Code to append to shopperStatement
Authorised
default test response
-c1
Pending -c3 and wait 15 minutes
after making the /payments request
Refused -c5

For example, to receive resultCode: Refused, include the following in your /payments request:

{
  // Produce a REFUSED payment result.
  "shopperStatement": "MBWay shopper statement-c5"
}

You can check the status of MB WAY test payments in your Customer Area > Transactions > Payments.

Before you can accept live MB WAY payments, you need to add MB WAY in your live Customer Area.

See also