CAPI - Purchase

Introduction

This document guides the developer on how to use CAPI services to purchase a Package. ​ The reader is advised to familiarise himself/herself with the purchase process by reading CReME - Purchase before this. An overview of this process is illustrated in the diagram below. The user is also assumed to be familiar with CAPI - Introduction.

Overview of Purchase Process
1) Display Price List

To display the Price List, the following request is submitted: ​

[
{
"PackageTitle": "CHIPS RM10",
"TargetMarket": "ABC",
"Start": "31 Oct 2019",
"Expiry": "31 Dec 2020",
"PriceByCash": 10,
"PriceByCreditCard": 10,
"PriceByDirectDebit": 10,
"PriceByCHIPS": 10,
"PriceByFundsTransfer": 10,
"PriceByCheque": 10,
"GroupSize": "-"
},
{
"PackageTitle": "CHIPS RM100",
"TargetMarket": "ABC",
"Start": "31 Oct 2019",
"Expiry": "31 Dec 2020",
"PriceByCash": 100,
"PriceByCreditCard": 100,
"PriceByDirectDebit": 100,
"PriceByCHIPS": 100,
"PriceByFundsTransfer": 100,
"PriceByCheque": 100,
"GroupSize": "-"
},
{
"PackageTitle": "PT 1",
"TargetMarket": "ABC",
"Start": "21 Jan 2020",
"Expiry": "31 Dec 2020",
"PriceByCash": 0,
"PriceByCreditCard": 0,
"PriceByDirectDebit": 0,
"PriceByCHIPS": 0,
"PriceByFundsTransfer": 0,
"PriceByCheque": 0,
"GroupSize": "-"
},
{
"PackageTitle": "PT 10",
"TargetMarket": "ABC",
"Start": "01 Aug 2020",
"Expiry": "31 Dec 2020",
"PriceByCash": 520,
"PriceByCreditCard": 500,
"PriceByDirectDebit": 500,
"PriceByCHIPS": 500,
"PriceByFundsTransfer": 510,
"PriceByCheque": 530,
"GroupSize": "-"
},
{
"PackageTitle": "A init",
"TargetMarket": "Current Clubs",
"Start": "01 Jul 2020",
"Expiry": "31 Dec 2021",
"PriceByCash": 300,
"PriceByCreditCard": 300,
"PriceByDirectDebit": 300,
"PriceByCHIPS": 300,
"PriceByFundsTransfer": 300,
"PriceByCheque": 300,
"GroupSize": "1 to 3"
},
{
"PackageTitle": "Promo RM180 int",
"TargetMarket": "Current Clubs",
"Start": "09 Jul 2019",
"Expiry": "31 Dec 2020",
"PriceByCash": 230,
"PriceByCreditCard": 230,
"PriceByDirectDebit": 230,
"PriceByCHIPS": 230,
"PriceByFundsTransfer": 230,
"PriceByCheque": 230,
"GroupSize": "-"
},
{
"PackageTitle": "RM200 package int",
"TargetMarket": "Current Clubs",
"Start": "01 Jul 2020",
"Expiry": "31 Dec 2030",
"PriceByCash": 500,
"PriceByCreditCard": 500,
"PriceByDirectDebit": 500,
"PriceByCHIPS": 500,
"PriceByFundsTransfer": 500,
"PriceByCheque": 500,
"GroupSize": "-"
}
]
2) Display Shopping Cart

To display the Shopping Cart, the following request is submitted: ​

[
{
"Selected": true,
"Id": 1637498,
"PackageTitle": "Promo RM180 int",
"PriceByCash": 243.8,
"PriceByCreditCard": 243.8,
"PriceByDirectDebit": 243.8,
"PriceByCHIPS": 243.8,
"PriceByCheque": 243.8,
"PriceByFundsTransfer": 243.8
},
{
"Selected": null,
"Id": 1637501,
"PackageTitle": "PT 10",
"PriceByCash": 551.2,
"PriceByCreditCard": 530,
"PriceByDirectDebit": 530,
"PriceByCHIPS": 530,
"PriceByCheque": 561.8,
"PriceByFundsTransfer": 540.6
}
]
3a) Adding Packages to the Shopping Cart

To add Packages from the Price List to the Shopping Cart, the following request is submitted: ​

{
"Code": "84.50.0",
"Description": "Package successfully assigned to Person",
"Payload": "1637910"
}

The function returns a Status object with the PersonPackageHistoryId of the newly added Package in the Payload.

Calling the "ShoppingCart/Read" function shows the ShoppingCart with the newly added Package:

[
{
"Selected": true,
"Id": 1637498,
"PackageTitle": "Promo RM180 int",
"PriceByCash": 243.8,
"PriceByCreditCard": 243.8,
"PriceByDirectDebit": 243.8,
"PriceByCHIPS": 243.8,
"PriceByCheque": 243.8,
"PriceByFundsTransfer": 243.8
},
{
"Selected": null,
"Id": 1637501,
"PackageTitle": "PT 10",
"PriceByCash": 551.2,
"PriceByCreditCard": 530,
"PriceByDirectDebit": 530,
"PriceByCHIPS": 530,
"PriceByCheque": 561.8,
"PriceByFundsTransfer": 540.6
},
{
"Selected": null,
"Id": 1637910,
"PackageTitle": "A init",
"PriceByCash": 253.05,
"PriceByCreditCard": 253.05,
"PriceByDirectDebit": 253.05,
"PriceByCHIPS": 253.05,
"PriceByCheque": 253.05,
"PriceByFundsTransfer": 253.05
}
]
3b) Deleting Packages from the Shopping Cart

To delete Packages from the Shopping Cart, the following request is submitted: ​

{
"Code": "84.200.0",
"Description": "Item successfully removed in PersonPackageHistory",
"Payload": "1637910"
}

Calling the "ShoppingCart/Read" function shows the ShoppingCart minus the Package.

4) Selecting/Deselecting Shopping Cart Items

To perform selection/deselection of ShoppingCart items, the following function is called:

{
"Code": "84.151.0",
"Description": "PersonPackageHistory successfully selected",
"Payload": ""
}

The Selection Modeparameter can take on either of the following values:

For an explanation of these parameters, please refer to CReME - Purchase

5) Process Payment

At the Checkout page, the value of selected items is shown below the ShoppingCart. To obtain the value of all selected items in the ShoppingCart, the following function is called:

{
"Code": "",
"Description": "Value of shopping cart items successfully calculated",
"Payload": "243.80"
}

The value of the selected items appears in the Payload of the returned Status object.

The values for PayByCreditCard, PayByDirectDebit and PayByCHIPS can only be "True" or "False". Also, they are case-sensitive which means "True" is acceptable but "true" is not. The following table provides the recommended values:

Input Values
Payment Method PayByCreditCard PayByDirectDebit PayByCHIPS
1) PayByCreditCard True False False
2) PayByDirectDebit False True False
3) PayByCHIPS False False True

For the time being only option 2 has been enabled. Option 1 and 3 are not yet enabled.

ActivationOn is specified as d/M/yyyy. It is usually the current date. One way to make things easier for the user would be to fix this as always the current date.

Warning! Changing the ActivationOn will change the value of v1/ShoppingCart/Value so be sure to call this function to obtain the correct value.

When the user is ready, the payment process is initiated by calling the following function:

{
"Code": "",
"Description": "Payment is being processed",
"Payload": "1637932"
}

Note that the pattern for CreditCardAmount, DirectDebitAmount and CHIPSamount must follow the pattern for PayByCreditCard, PayByDirectDebit and PayByCHIPS in ShoppingCart/SelectedItems/Value. SInce the pattern for PayByCreditCard, PayByDirectDebit and PayByCHIPS was False-True-False, therefore the pattern for CreditCardAmount, DirectDebitAmount and CHIPSamount must follow (zero-nonZero-zero).

The value for PayByDirectDebit must be equal to or greater than the value in ShoppingCart/SelectedItems/Value. It cannot be less.

The value returned in Payload is the PaymentRequestId of the Payment that has just been created.

The ShoppingCart has been emptied of all selected Packages. Packages that were not selected remain. This can be seen by running ShoppingCart/Read.

6) Select Bank

The status of the Payment is currently "unconfirmed" and is ready to be sent to the bank for confirmation.

So far, all the processing has been carried out on the "Pre-CReME Webpage" as shown in the diagram below.

Communication between Systems

Now, the Pre-CReME Webpage will call the RequestForm in CReME to select the Bank that will process this payment request.

The URL required to call the RequestForm is:

https://office.creme.my/p/InstantPay.aspx?
SessionKey=4NMD34KWRFC33JHRSQC8KNS3&PaymentRandomKey=694N89WWYPBQFA8BAE8X9JJS
&ShowRequestForm=1&ShowResponseForm=1&BankCode=TEST0021&PostCReMEurl=https://xyz.com/postcreme/

The various parts of this URL are explained below:

Part of URL Value to Use Description
Base Address always https://office.creme.my/p/InstantPay.aspx? Used by all Channels - both test and live
SessionKey Obtained at Login For more information, please refer to CAPI - Introduction
PaymentRandomKey obtained by calling v1/Payment/Read/PaymentRequestId. Each PaymentRequestId will have one unique and permanent PaymentRandomKey.
ShowRequestForm 0=do not show, 1=show If ShowRequestForm=0, the RequestForm will not appear. Instead, the user sees Pre-CReME Webpage followed by FPX Login page. If this option is chosen, the Bank Code must be defined at the Pre-CReME webpage.
If ShowRequestForm=1, the RequestForm will appear, allowing the user to select the BankCode. The Pre-CReME Webpage need not define the BankCode.
For more information on how to obtain the list of Bank Codes, please refer to the Curlec documentation.
ShowResponseForm 0=do not show, 1=show If ShowResponseForm=1, the ResponseForm (https://office.creme.my/curlec/CurlecCallbackInstantPay.aspx) appears after the FPX Confirmation Webpage. If this option is chosen, the PostCReMEurl value can be empty.
If ShowResponseForm=0, the user sees the Post-CReME Webpage immediately after the FPX Confirmation Webpage. If this option is chosen, the PostCReMEurl must be defined.
BankCode Selected from list of bank codes and bank names For more information on how to obtain the list of Bank Codes, please refer to the Curlec documentation.
PostCReMEurl defined by Website developer The Webpage displayed by the Website after the Payment Process is completed for example, "https://www.abc.com/somepage.html". CReME will append 3 parameters to this: PaymentRandomKey, StatusCode and StatusDescription so the full url looks like https://www.abc.com/somepage.html?PaymentRandomKey=DK4F4HM9YKFZZFVU89S83K5E&StatusCode=00&StatusDescription=SomeDescription
If ShowResponseForm=0, this page will appear. If ShowResponseForm=1, this page will not be called.
7) Login and 8) Confirm Transaction

These are pages from the online banking system.

9) Display Transaction Result

The transaction result can be displayed in either of two ways:

If method A is required, simply ensure ShowResponseForm=1.

If method B is required, ShowResponseForm=0 and PostCReMEurl=[] where [] leads to a valid webpage that is able to process the paramaters mentioned in the table above.

If the information provided by the 3 parameters is insufficient and the developer would like to display more transaction information, this can be obtained by calling the following function:

{
"RequestId": 1637932,
"Reference": "A/20/08/00020",
"CreditCardAmount": 0,
"DirectDebitAmount": 243.8,
"ChipsAmount": 0,
"CashAmount": 0,
"ChequeAmount": 0,
"FundsTransferAmount": 0,
"CreditByEmployeeAmount": 0,
"CreditByEmployeeReason": "",
"Overpayment": 0,
"RandomKey": "694N89WWYPBQFA8BAE8X9JJS",
"SubmittedOn": "2020-08-20T19:50:58",
"PersonIdPayer": 30001,
"FullnamePayer": "Ali Wan",
"DefaultChannelKey": "CEV75FGS6TA2VMYHF6G9MKV7",
"Status": {
"Code": "6.110.0",
"Description": "Payment ReadOne successful",
"Payload": ""
}
}