Our DuitNow Component renders DuitNow in your payment form and collects your shopper's selected bank.
Requirements
Select the server-side flow that your integration uses:
Show DuitNow in your payment form
Include DuitNow in the list of available payment methods.
-
Specify in your /paymentMethods request:
- countryCode: MY.
- amount.currency: MYR.
- channel: Specify iOS.
-
Decode the
/paymentMethodsresponse with thePaymentMethodsstructure.let paymentMethods = try JSONDecoder().decode(PaymentMethods.self, from: paymentMethodsResponse)Find
paymentMethods.typeduitnow and put it into an object. For example,duitnowPaymentMethod. -
Create an instance of
APIContextwith the following parameters:Parameter name Required Description clientKey
Your client key. environment
Use test. When you are ready to accept live payments, change the value to one of our live environments. -
Initialize the DuitNow Component:
let duitnowComponent = DuitNowComponent(paymentMethod: duitnowPaymentMethod, apiContext: apiContext) duitnowComponent.delegate = self // In this example, the Pay button will show 10 MYR. // The value is in minor units. Change the currencyCode to the currency for the DuitNow Component. duitnowComponent.payment = Payment(amount: Amount(value: 1000, currencyCode: "MYR")) present(duitnowComponent.viewController, animated: true)
Make a payment
When the shopper proceeds to pay, the Component invokes the didSubmit method containing the data.paymentMethod from the PaymentComponentDelegate.
- Pass the
data.paymentMethodto your server. -
From your server, make a /payments request, specifying:
paymentMethod.type: Thedata.paymentMethodfrom your client app.
The response contains the following data:
resultCode: Pendingaction: Contains the QR codeurlandqrCodeData.
Show the QR code
Use the information in the action object of the /payments response to render the QR code.
action.url: Use this URL to download the QR code.action.qrCodeData: Use this to render the QR code on your checkout page.
The shopper can either scan the QR code, or take a screenshot of the QR code and upload it to their bank app.
Show the payment result
Use the resultCode from the /payments/details response to show the payment outcome on your frontend.
You will also receive the outcome of the payment asynchronously in a webhook.
The resultCode values you can receive for DuitNow are:
| eventCode | success field | Description | Action to take |
|---|---|---|---|
| AUTHORISATION | false | The transaction failed. | Cancel the order and inform the shopper that the payment failed. |
| AUTHORISATION | true | The shopper successfully completed the payment. | Inform the shopper that the payment has been successful and proceed with the order. |
If you are implementing an additional use case, you can make a /payments/details call to receive an immediate response.
Test and go live
You can test your DuitNow integration in two ways: with the Adyen Payment Simulator, or directly with DuitNow.
Test with Adyen
Use the Adyen Payment Simulator to verify that your DuitNow integration works correctly with Adyen. You can test during development, before you go live, and after launch. The simulator does not recreate the shopper's journey through the DuitNow app or website.
This testing option is available by default when you add DuitNow in your test Customer Area. The payment method type is duitnow.
To test a QR code payment:
- Start a payment as usual in your integration. Your integration shows a QR code.
- Scan the QR code as the shopper, then select the payment outcome that you want to test on the Adyen-hosted simulator page.
- Wait for the webhook message with the final payment outcome. There is no shopper redirect and no
/payments/detailsrequest. If you use Drop-in, it refreshes automatically with the outcome that you selected. - Confirm that your integration handles the outcome, and that the payment appears in your Customer Area > Payments > Payment list.
Test directly with DuitNow
You can also test DuitNow payments directly with real payment details and small amounts.
Check the status of direct DuitNow test payments in your Customer Area > Payments > Payment list.
To accept live DuitNow payments, you must contact our Support Team to add DuitNow in your live Customer Area.