E-commerce module

This module provides payment services via supported payment gateways.

URL Format

You can use GET or POST variables in your requests.

baseUrl/ecommerce.php?action=ACTION&params...

When the visitor token is required, add

&token=TOKEN_HERE

Reference

Some responses may return defined objects inside the JSON that refer to existing classes.

See related:

List of actions

The parameter "action" determines the action you would like to match. See below list.

list_payments

List all payments done successfully by this visitor.

Parameters:

Return:

{
    data: {
            [ Payment object, ... ]
        }
}        

list_user_purchases

List all items purchased by this user.

Parameters:

Return:

{
    data: {
            [ User_Purchase object, ... ]
        }
}        

products

List all products in the system. If you do not specify a category ID, the API will dump all available products. This is not recommended for large catalogues.

Parameters:

Return:

{
    data: {
            [ Product object, ... ]
        }
}        

buy_itunes

To effect a payment done via iTunes (App Store payment).

Parameters:

Return:

{
    data: {
        "visitor": Visitor object,
        "token": string,
        }
}        

buy_google

To effect a payment done via Google Play Store.

Parameters:

Return:

{
    data: {
        "visitor": Visitor object,
        "token": string,
        }
}        

buy_mastercard

To initialize a payment via Mastercard MPGS.

Parameters:

Return:

{
    data: {
        "paymentId": int (local payment ID),
        "currency": string (payment currency to send to MPGS),
        "amount": float (payment price),
        "mastercard_sessionId": string (the session ID to send to MPGS)
        }
}        

buy_mastercard_return

To return a payment response from Mastercard MPGS in case of success, fail, or cancel.

Parameters:

Return:

{
    success: true/false,
    data: {
            "visitor": Visitor object,
            "token": string,
            "payment": Payment object
        }
}