If you choose to use the full redirect flow, this is where you will redirect your customer to after authorizing or canceling within the FPX Online Banking experience.
Step 2: Create an FPX Online Banking source using DigitalRiver.js
Build an FPX Online Baning source request object. Use the DigitalRiver.js library to create and mount elements to the HTML container.
The address object must contain postal code and state/province data thatadheres to a standardized format using the state attribute. Note that the state attribute listed below corresponds to the countrySubdivision attribute used when providing address information. The payment session manages the correct field name on the backend.
var sourceData = {"type":"fpxOnlineBanking","sessionId":"ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f","owner":{"firstName":"John","lastName":"Doe","email":"jdoe@email.com","phoneNumber":"077 1723 6984","address":{"line1":"Prai Industrial Estate, Phase 4","line2":"","city":"Perai","state":"Pulau Pinang","postalCode":"13600","country":"MY" } },"fpxOnlineBanking": {"returnUrl":"https://example.com" }}digitalriver.createSource(sourceData).then(function(result) { if(result.error) {//handle error message var errorMessage = result.error.errors[0].message; } else {//send the source to the back end for processing var source = result.source; }});
When you create an FPX Online Banking source, the customer is redirected to a bank selector age and chooses their preferred bank. They are then redirected to their online bank, where they sign in and review their transaction. The shopper will complete the transaction by authorizing it with an SMS code. You can accomplish this by redirecting the customer to FPX Online Banking.
Redirecting the customer for FPX Online Banking authorization
To redirect your customer use the redirectUrl parameter in your createSource response.
The shopper's online bank will present the shopper with the transaction details where they can authorize or cancel the transaction. The shopper will then complete the transaction by authorizing it with an SMS code to complete the order. A successful authorization redirects the customer to the FPX Online Banking Return URL parameter you specified when you created the source.
Once authorized, the source state will change to chargeable.