Get Checkout Page
Before using ECPay’s Embedded Checkout Page, merchant’s server should call ECPay’s API to get a Token. After receiving the token, merchants should set this token onto merchant’s webpage with the integration of ECPay’s JavaScript SDK to access the checkout page.
ECPay.createPayment(Token, Language, callBack(errMsg), Version)
Input
Token String
Required
- A token used to validate merchant’s identity
- The lifespan is 30 minutes.
Language String
Required
To use multilingual function, and Two languages are avaliable:
- ECPay.Language.zhTW : Traditional Chinese
- ECPay.Language.enUS: English
Version String
Required
Fixed V2
callBack description
The callback function after createPayment is completed. For example, if initialization fails, error message received by the callBack.
function (errMsg) {}
Example
ECPay.initialize(serverType, function (errMsg) {
var lang = getCookie("language");
if (!lang) {
lang = ECPay.Language.zhTW;
}
ECPay.createPayment("55a026b8df314f9bb2dc808a5fe21c9d", lang, function (errMsg) {}, V2);
//to do..
};
});