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¶ms...
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:
- token
Return:
{
data: {
[ Payment object, ... ]
}
}
list_user_purchases
List all items purchased by this user.
Parameters:
- token
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:
- token
- categoryId: int (optional, the category ID to filter by)
Return:
{
data: {
[ Product object, ... ]
}
}
buy_itunes
To effect a payment done via iTunes (App Store payment).
Parameters:
- token
- page (string, a page that the user came from)
- button (string, a button that the user clicked)
- id (string, the Product Item ID being purchased)
- receipt (string, the receipt from Apple)
- trial (int 1/0, whether the user is eligible for an introductory offer)
- price_trial (double, required when trial=1, the introductory price presented by iTunes)
- currency_trial (string, required when trial=1, the currency presented by iTunes, eg: USD)
- price (double, required when trial=0, the price presented by iTunes)
- currency (string, required when trial=0, the currency presented by iTunes, eg: USD)
Return:
{
data: {
"visitor": Visitor object,
"token": string,
}
}
buy_google
To effect a payment done via Google Play Store.
Parameters:
- token
- page (string, a page that the user came from)
- button (string, a button that the user clicked)
- id (string, the Product Item ID being purchased)
- receipt (string, the receipt from Google)
Return:
{
data: {
"visitor": Visitor object,
"token": string,
}
}
buy_mastercard
To initialize a payment via Mastercard MPGS.
Parameters:
- token
- page (string, a page that the user came from)
- button (string, a button that the user clicked)
- id (string, the Product Item ID being purchased)
- quantity (int, the quantity of the product you wish to purchase)
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:
- token
- paymentId (string, the local payment ID)
- authorization (optional string, in case the payment was successful, supply the resultIndicator here)
- cancel (optional, set to any value, in case of cancellation by user)
- error (json string, the error response from MPGS as a JSON string)
Return:
{
success: true/false,
data: {
"visitor": Visitor object,
"token": string,
"payment": Payment object
}
}