CheatSheet Best Practice

Objective

This is a cheatsheet for those developers who is frustrated by the lengthy official docs and having a hard time on deciding which option is the best approach to fit their integration requirements. This README.md file will be updated from time to time when we discovered new pain point faced by developers during the integration process. We welcome every suggestion or enquiry from developers in the form of posting new issue to this repository.

Tips #1. Various integration method provided by Fiuu

Fiuu provides few of the integration methods to suit every business needs.

i. Hosted Payment Page

A hosted solution where customer will be redirected from merchant site to Fiuu hosted page, channel selection will be done on this page before being redirected to each online banking / ewallet page to proceed with the payment authorization or OTP. After that a success / failure page will be displayed to customer before being redirected back to merchant site.

ii. Seamless Integration

Channel selection will be done in the merchant site which require more integration effort from the developers compared to Hosted Payment Page. For card channel the card number will still be input through Fiuu page hence no PCI compliance is required from merchant.

iii. Inpage Checkout

Similar to seamless integration but only support card channel, and the difference compared to seamless integration is the card number input page will be hosted via iFrame on merchant site instead of a popup window.

iv. Mobile XDK

Best for mobile in-app purchase.

v. Direct Server Integration

No UI will be provided by Fiuu, channel selection and card number input will all be done on merchant site, hence require merchant to be PCI compliant.

vi. Recurring API

No UI will be provided by Fiuu, but it supports recurring payment by any amount at any time.

Comparison Chart

Comparison Chart

Tips #2. The 3 endpoints to update payment status on merchant site

When a payment is done by customer, how do we update the transaction status to the merchant? The 3 endpoints, i.e. Return URL, Notification URL, Callback URL serves as a mechanism to update merchant transaction status.

i. Return URL

Realtime web browser or frontend redirection endpoint for hosted page, seamless integration, and shopping cart module. Impact user's UI/UX or journey in the whole payment process.

ii. Notification URL

Realtime server-to-server or backend endpoint for all kind of integrations and payment channels. Will be triggerred once Fiuu received the payment status from respective online banking / ewallet channels.

iii. Callback URL

Defer update or callback endpoint on non-realtime payment such as Fiuu Cash.

Tips #3. To enable IPN to avoid missing the webhook

IPN (Instant Payment Notification) is a mechanism whereby if enabled, merchant will be required to ACK (acknowledge) on each of the received webhook, i.e. notification and callback URL. In case merchant failed to ACK, we will assume that the previous webhook has failed and we will retry sending the webhook with an interval of 15 minutes until a maximum of 4 retries to the merchant Callback URL endpoint.

Tips #4. Get channel subscribed by using Channel Status API

For those merchant who are using integration type such as Seamless or Direct Server where the channel selection is done on the merchant site, developers are advised to get the channel subscribed by using Channel Status API.

Channel Status API

This API returns the availability of all channels enabled for a particular merchantID.

Request

  • URL: https://pay.fiuu.com/RMS/API/chkstat/channel_status.php
  • Method: POST
Variable / ParameterType Format / Max LengthDescription / Example
merchantIDAlphanumeric, 32 charsMerchant ID in PG system.
datetimeYYYYMMDDHHmmssRequest date & time, e.g. 20161202153423.
skeyAlphanumericFor merchant access verification purpose.

Tips #5. For requery the difference between Direct / Indirect Status Requery

Requery is the API used to check for each transaction status by using Transaction ID or Order ID. But we have 2 different types of requery, i.e. Direct Status Requery and Indirect Status Requery.

i. Direct Status Requery

Fiuu will forward the status enquiry by merchant to the respective online banking / ewallet channel, which help the merchant to get realtime transaction status as aligned with the payment channel itself.

ii. Indirect Status Requery

Fiuu will return the transaction status based on our own status within our system.

Tips #6. For void use Reversal API, for refund use Refund API

We have 2 types of Refund, i.e. Reversal and Full / Partial Refund

i. Reversal

Fiuu will forward the refund request by merchant to the respective online banking / ewallet channel, and proceed to void the transaction, but this is only allowed on the same day as the transaction itself.

ii. Full / Partial Refund

Fiuu will process the refund request by merchant ourselves and allow up to 180 days after the transaction date.

Tips #7. Guest Checkout to disable save card feature

Fiuu provides save card features by requiring customer's basic info like billing name, mobile number and email. With that being said, this feature is only eligible for a registered user of the merchant's website. But there are also some checkout where merchant does not hold the customer's basic contact info, which is also known as a guest checkout. To disable save card feature for a guest user, merchant can pass the parameter bill_name=guest&bill_email=&bill_mobile= (case insensitive) to our payment page.

Guest Checkout

Tips #8. x-www-form-urlencoded instead of JSON

Most of our API is accepting POST request in the format of x-www-form-urlencoded instead of JSON, please make sure you are using the correct format when submitting the request. Meanwhile, if you are submitting the request with both GET (query string) and POST (x-www-form-urlencoded) parameters, please bear in mind that by default the POST parameters will always overwrite the GET parameters. For e.g. in PHP if the script is written as $REQUEST['param1'], this will always prioritize $POST['param1'] rather than $GET['param1'].

Form URL Encoded

Tips #9. Domain name whitelisting (domain registration) required when using seamless integration

If you are using our seamless integration where the checkout page is hosted under your domain, you will need to register your domain name by sending an email to [email protected], alternatively you can also register your domain name in merchant portal (Merchant Profile -> Profile Settings). But this is subjected to approval by our operation team. Multiple subdomains are accepted but only one domain is allowed per Merchant ID. On top of that, embeded page (iFrame) is not allowed for seamless integration type.

Domain Registration

Tips #10. Environment IP whitelisting required when testing payment in demo bank page under sandbox environment

In order to prevent merchant from accidentally deploying sandbox (demo bank) into their production environment and let customers pay with dummy account, we have applied some measures like a protected username and password for the demo bank, and also the requirement to whitelist your environment IP address (usually it's an IP address which belongs to your working space), under sandbox merchant portal (Merchant Profile -> Profile Settings).

IP Whitelisting

Tips #11. Applying Static QR-Code Generator for offline and online use case

Online payment refer to ecommerce payment, like shopping cart checkout. While offline payment refer to terminal payment, or kiosk payment.

For offline payment use case, merchants are advised to generate one QR code for each vending machine respectively. All customers can scan the same QR code to make payment. For the amount, if merchant pre-set the amount before generating the QR code, customers can only pay with the specific amount. If the amount is left empty, then customers are allowed to enter the amount themselves.

For online payment use case, this solution is also a viable option. But there are few limitations that you need to take into consideration:

  1. Merchants will only receive the notification URL webhook after customer completed payment successfully.
  2. For static QR, merchants will receive a similar response as online payment.
  3. Merchants will not know how much customers has paid until payment completed (in case the static QR is not pre-set with any fixed amount).
  4. Order ID will be always static.

Static QR-Code Generator

For merchant to generate static QR code of e-wallet.

Request
URL: https://api.fiuu.com/RMS/API/staticqr/index.php
Method: POST or GET

Field NameData Type (Size)M/ODescription
merchantIDAlphanumeric, 32 charsMMerchant ID provided by PG.
channelAlphanumeric, 32 charsMChannel requested:
AlipaySQR – Alipay Static QR
WeChatPaySQR – WeChat Pay Static QR
DuitNowSQR – DuitNow Static QR
orderidAlphanumeric, 40 charsMItem ID, e.g. S001.
currencyAlphabet, 3 charsMISO-4217 currency code.
amountNumericCTotal amount to be paid in one purchase order. Supports 2 decimal points; comma (,) is not allowed. Mandatory except for DuitNowSQR.
bill_nameAlphanumeric, 128 charsMItem name.
bill_descTextMItem description.
checksumAlphanumeric, 32 charsMRequest integrity protection hash string.

Checksum Formula

Checksum = md5({merchantID}{channel}{orderid}{currency}{amount}{verify_key})

Tips #12. Further explanation and ability for retry for each error codes from capture and refund API (response)

Capture API's List of Error Codes

Error CodeError DescriptionFurther ExplanationCan Retry?
00SuccessCapture is successfulNo, this is the final result
11FailureCapture has failedNo, this is the final result, could due to rejection by channel or bank
12Invalid or unmatched security hash stringskey calculation incorrectYes, can retry after amending the skey by following the correct formula and algorithm
13Not a credit card transactionThe transaction channel does not allow to captureNo, check the transaction ID passed does it belong to a card transaction?
15Requested day is on settlement dayNot allowed to capture if same day as settlement dayYes, can retry after start of next day of the week
16Forbidden transactionThe transaction channel does not allow partial captureYes, can retry after change the amount to full amount
17Transaction not foundTransaction ID not found in Fiuu's databaseNo, check the transaction ID passed does it belong to a valid Fiuu transaction?
18Missing required parameterMandatory parameter are not passedYes, can retry after amending the missing parameter
19Domain not foundMerchant ID not found in Fiuu's databaseNo, check the merchant ID passed does it belong to Fiuu?
20Temporary out of serviceDue to Fiuu's internal error or service interuptionYes, can retry after Fiuu fix the intermittent issue at their system
21Authorization expiredExceeded the max period allowed to capture the transactionNo, need to make sure the request is sent within the allowable time frame
23Not allowed to perform partial captureThe transaction channel does not allow partial captureYes, can retry after change the amount to full amount
24Transaction has already been capturedThe transaction ID passed has already been capturedNo, this is the final result
25Amount requested more than available capture amountThe amount passed exceeded the authorized or original amountYes, can retry after amending the amount to be less than the authorized or original amount
99General Error (Please check with PG Support)Due to Fiuu's internal error or service interuptionYes, can retry after Fiuu fix the intermittent issue at their system

Refund API's List of Error Codes

Error CodeError DescriptionFurther ExplanationCan Retry?
PR001Refund Type not foundInvalid refund type passedYes, can retry after amending the refund type parameter
PR002MerchantID field is mandatoryMandatory parameter are not passedYes, can retry after amending the missing parameter
PR003RefID field is mandatoryMandatory parameter are not passedYes, can retry after amending the missing parameter
PR004TxnID field is mandatoryMandatory parameter are not passedYes, can retry after amending the missing parameter
PR005Amount field is mandatoryMandatory parameter are not passedYes, can retry after amending the missing parameter
PR006Signature field is mandatoryMandatory parameter are not passedYes, can retry after amending the missing parameter
PR007Merchant ID not foundMerchant ID not found in Fiuu's databaseNo, check the merchant ID passed does it belong to Fiuu?
PR008Invalid SignatureSignature calculation incorrectYes, can retry after amending the Signature by following the correct formula and algorithm
PR009Txn ID not foundTransaction ID not found in Fiuu's databaseNo, check the transaction ID passed does it belong to a valid Fiuu transaction?
PR010Transaction must be in authorized/captured/settled status. Current transaction is in TRANSACTION_STATUS statusThe transaction ID passed is not in a refundable statusYes, can retry if the current TRANSACTION_STATUS is "pending", no if the current TRANSACTION_STATUS is already "cancelled"
PR011Exceed refund amount for this transactionThe amount passed exceeded the original transaction amountYes, can retry after amending the amount to be lower than or equal to the original transaction amount
PR012Bank information is not applicable for credit channel transactionCard transaction does not require beneficiary bank account informationYes, can retry after removing the beneficiary bank account information
PR013BankCode not found in our database, please contact supportThe bank code passed is not found in Fiuu's databaseYes, can retry after amending the bank code
PR014Bank information is mandatory for non-credit channel transactionNon-card transaction require beneficiary bank account informationYes, can retry after adding the beneficiary bank account information
PR015Server is busy, try again laterDue to Fiuu's internal error or service interuptionYes, can retry after Fiuu fix the intermittent issue at their system
PR016Duplicate RefID found, please provide a unique RefIDFiuu's system does not allow duplicated RefIDYes, can retry after amending RefID to become unique
PR017Refund request for transaction that is out of the allowed periodExceeded the max period allowed to refund the transactionNo, need to make sure the request is sent within the allowable time frame
PR018BeneficiaryName cannot contain non-alphanumeric charactersInvalid beneficiary bank account information passedYes, can retry after amending the beneficiary name
PR019Refund is not allowed / Only partial refund is allowed / Only full refund is allowedThe transaction channel does not allow full/partial refundYes, can retry after amending the amount
PR020Insufficient balance to refundNot enough account balance left for your current account in Fiuu's systemYes, can retry after more account balance increased as the result of more incoming transactions being captured