Service Address
/DealerSale/AddSale
Request Parameters
DealerSaleAuthentication
Parameter |
Explanation |
DealerCode(string) |
Dealer code issued by the Moka system |
Username (string) |
Api username given by Moka system |
Password (string) |
Api password given by Moka system |
CheckKey (string) |
The control key (DealerCode + "MK" + Username + "PD" + Password) is created by passing this information, combined as a String, through the SHA-256 hash algorithm.
Click here to go to the trial screen. |
DealerSaleRequest
Parameter |
Explanation |
CustomerCode (string) |
Not required if DealerCustomerId is sent. The sale will be made to this customer. |
DealerCustomerId (integer) |
Not required if CustomerCode is sent. |
ProductCode (string) |
Not required if DealerProductId is sent. |
DealerProductId (integer) |
(integer) Not required if ProductCode is submitted. |
SaleCode (string) |
Not required, if not sent new guid will be created (Max 100 chars) |
SaleCode (string) |
Not required, if not sent new guid will be created (Max 100 chars) |
Amount (decimal) |
The amount to be charged on each payment. (Note: it is not the total sales amount!) (For example: It is written in 25.45 format.) |
Currency (string) |
Not mandatory, if not sent, TL is accepted (TL, USD, EUR) |
InstallmentNumber (integer) |
Not mandatory, if not sent, one shot is accepted (1..12) |
DealerSaleScheduleId (integer) |
The ID of the time program (If PlanType : 2 is to be given, the system will reset it to zero even if the value is entered in this field, so it will work even if it is not sent at all) |
SaleDate (date) |
Date of sale (in YYYYMMDD format, ex: "20170918") |
BeginDate (date) |
From what date will the payments for this sale begin? (in YYYYMMDD format, ex: "20170918") |
EndDate (date) |
What date will the payments for this sale end? If an end date is not given (an empty string is sent or this field is not sent at all), regular withdrawals will continue until the sale is deleted or the EndDate is updated (in YYYYMMDD format, eg "19901218") |
HowManyTrial (integer) |
Not required, 1 is accepted if not submitted. (How many more days will be attempted if the card is unsuccessful) |
Description (string) |
Not required, description detail field (Max 200 chars) |
PlanType (integer) |
It is not mandatory, it is accepted as 1 if it is not sent (1: Payment steps are created automatically according to the given time schedule, 2: Payment steps must be created manually, 3: Payment steps can be created both manually and automatically.) If the payment step is to be created manually, this service will be DealerSaleScheduleId : 0 pulls to . |
DealerCustomerTypeId (integer) |
If payment is to be made by sending a payment request to the customer, not from a hidden card, the customer type ID is entered in this field. The Dealer-specific Customer type is created by Moka and this Id is forwarded to the dealer who will send the payment request in advance. |
DefaultCard1Token (guid) |
From which card will the payment be made? |
DefaultCard2Token (guid) |
If payment cannot be made from the first card, which card will be tried. |
DefaultCard3Token (guid) |
If the first 2 cards do not work, which card will be tried last. |
Sample Request (JSON)
{
"DealerSaleAuthentication": {
"DealerCode": "xxx",
"Username": "xxx",
"Password": "xxx",
"CheckKey": "aabbccddeeff"
},
"DealerSaleRequest": {
"CustomerCode": "Customer",
"DealerCustomerId": "",
"ProductCode": "Product01",
"DealerProductId": "",
"SaleCode": "satis",
"Amount": "0.01",
"Currency": "TL",
"InstallmentNumber": "1",
"DealerSaleScheduleId": "1005",
"BeginDate": "20170821",
"EndDate": "20171230",
"HowManyTrial": "1",
"Description": "",
"PlanType": "1",
"DealerCustomerTypeId": "",
"DefaultCard1Token": "{9DE41BB0-E82F-4670-B36B-D71FF27A3111}",
"DefaultCard2Token": "",
"DefaultCard3Token": "",
"SaleDate": "20170821"
}
}
Successful Request Result
If the sent request data has been processed successfully in Moka, "Success" information is written in the "ResultCode" field of the return object . The "Data" field contains the result of the returned operation. You can continue your flows by checking the information in "Data" .
After the sale is added, Moka will automatically charge the card according to the specified schedule.
Collection attempts are made 2 times a day , and if you wish, you can send these withdrawal results to your own server immediately by notifying Moka with a URL. All information about this payment step will be sent as TEXT POST to the URL you provide.
The parameters to be sent and their explanations are as follows:
Post Area |
Explanation |
DealerPaymentPlanHistoryId |
Each withdrawal attempt for the payment step generates a HistoryId |
DealerPaymentPlanId |
Payment step ID. Each automatic or manually generated payment step generates an ID. |
DealerCustomerId |
This is the ID of the customer (card holder) of the previously added workplace on the Moka side to make the withdrawal |
CustomerCode |
It is the code of the workplace's customer on the workplace side |
DeaerSaleId |
This is the Moka side ID of the pre-added sale so that the withdrawal can be made. |
SaleCode |
This is the workplace-side code of the sale |
DealerPaymentId |
It is the Payment ID generated as a result of the withdrawal process. |
DealerId |
It is the ID of the workplace that performs the shooting. |
Amount |
The withdrawal amount |
HistoryStatus |
Indicates the status of this shooting operation. 0: Failed Capture 1: Successful Capture |
VirtualPosOrderId |
This is the payment number of the withdrawal returned from the bank. Payment can be canceled or refund requested using this ID. |
ResultCode |
This is the error code that Moka will return if an error is received. |
ResultMessage |
This is the error message that Moka will return if an error is received. |
PostToken |
This is the code to be used to generate the HashInfo |
HashInfo |
SHA256(DealerCode + Username + Password + PostToken)
Workplace puts its API access information and PostToken field into a SHA256 function by String Concatenate and generates a Hash code. The resulting hash code is checked to see if it is the same as the value in this field. If the value is the same, make sure this POST is sent by Moka |
Parameter |
Explanation |
DealerSaleId (integer) |
On the Moka side, it is the Unique ID of the sale. |
SaleCode (string) |
On the dealer side, it is the code of the sale. |
CustomerCode (string) |
On the dealer side, it's the customer's code. Not required if DealerCustomerId is sent. |
DealerCustomerId (integer) |
On the Moka side, it is the Unique ID of the customer. Not required if CustomerCode is sent. |
ProductCode (string) |
On the dealer side, it is the code of the product. Not required if DealerProductId is sent. |
DealerProductId (integer) |
On the Moka side, it is the Unique ID of the product. Not required if ProductCode is submitted |
SaleCode (string) |
Not required, if not sent new guid will be created (Max 100 chars) |
Amount (decimal) |
The amount to be charged on each payment. (Note: it is not the total sales amount!) (For example: It is written in 25.45 format.) |
Currency (string) |
Not mandatory, if not sent, TL is accepted (TL, USD, EUR) |
InstallmentNumber (integer) |
Not mandatory, if not sent, one shot is accepted (1..12) |
DealerSaleScheduleId (integer) |
The ID of the time program (If PlanType : 2 is to be given, the system will reset it to zero even if the value is entered in this field, so it will work even if it is not sent at all) |
SaleDate (date) |
Date of sale (in YYYYMMDD format, ex: "20170918") |
BeginDate (date) |
From what date will the payments for this sale begin? (in YYYYMMDD format, ex: "20170918") |
EndDate (date) |
What date will the payments for this sale end? If an end date is not given (an empty string is sent or this field is not sent at all), regular withdrawals will continue until the sale is deleted or the EndDate is updated (in YYYYMMDD format, eg "19901218") |
HowManyTrial (integer) |
Not required, 1 is accepted if not submitted. (How many more days will be attempted if the card is unsuccessful) |
Description (string) |
Not required, description detail field (Max 200 chars) |
PlanType (integer) |
It is not mandatory, it is accepted as 1 if it is not sent (1: Payment steps are created automatically according to the given time schedule, 2: Payment steps must be created manually, 3: Payment steps can be created both manually and automatically.) If the payment step is to be created manually, this service will be DealerSaleScheduleId : 0 pulls to . |
DealerCustomerTypeId (integer) |
If payment is to be made by sending a payment request to the customer, not from a hidden card, the customer type ID is entered in this field. The Dealer-specific Customer type is created by Moka and this Id is forwarded to the dealer who will send the payment request in advance. |
DefaultCard1Token (guid) |
From which card will the payment be made? |
DefaultCard2Token (guid) |
If payment cannot be made from the first card, which card will be tried. |
DefaultCard3Token (guid) |
If the first 2 cards do not work, which card will be tried last. |
Successful Result Example
{
"Data": {
"DealerSaleId": 1003,
"SaleCode": "satis",
"DealerCustomerId": 1034,
"CustomerCode": "Customer",
"DealerProductId": 1009,
"ProductCode": "Product01",
"Amount": 0.01,
"Currency": "TL",
"InstallmentNumber": 1,
"DealerSaleScheduleId": 1005,
"SaleDate": "20170821",
"BeginDate": "20170821",
"EndDate": "20171230",
"HowManyTrial": 1,
"Description": "",
"PlanType": 1,
"DealerCustomerTypeId": 0,
"DefaultCard1Token": "9de41bb0-e82f-4670-b36b-d71ff27a3111",
"DefaultCard2Token": "",
"DefaultCard3Token": ""
},
"ResultCode": "Success",
"ResultMessage": "",
"Exception": null
}
Failed Request Result
If the sent request data could not be processed in Moka streams, the "ResultCode" field of the return object contains one of the error codes in the table below.
When an unexpected software error occurs, EX is written in the "ResultCode" field and the error message (Exception) is displayed in the "ResultMessage" field
In both cases, the "Data" object arrives as null.
ResultCode | Explanation |
DealerSale.AddSale.InvalidRequest | The CheckKey may be bad, or the object may be bad, or the JSON may be corrupt. |
DealerSale.AddSale.CustomerCodeOrDealerCustomerIdMustBeGiven | Customer code or dealer customer id must be entered. |
DealerSale.AddSale.ProductCodeOrDealerProductIdMustBeGiven | Product code or dealer product id must be entered. |
DealerSale.AddSale.SaleDateIsRequired | Date of sale required.. |
DealerSale.AddSale.AmountIsRequired | Amount information required. |
DealerSale.AddSale.DealerSaleScheduleIdIsRequired | Time schedule id required. |
DealerSale.AddSale.BeginDateIsRequired | Information on when the sale will start payments is required. |
DealerSale.AddSale.EndDateIsRequired | Information on the date on which the payments will end is required. |
DealerSale.AddSale.DefaultCard1TokenIsRequired | Information on which card the payment will be made is required. |
DealerSale.AddSale.DealerProductIdNotFound | The customer's product id could not be found. |
DealerSale.AddSale.ProductCodeDoesntMatchDealerProductId | The product code and the dealer product id do not match. |
DealerSale.AddSale.DealerCustomerIdNotFound | Dealer customer id not found. |
DealerSale.AddSale.CustomerCodeDoesntMatchDealerCustomerId | The customer code and the dealer customer ID do not match. |
DealerSale.AddSale.SaleDateAlreadyPassed | The date of the sale has passed.. |
DealerSale.AddSale.BeginDateAlreadyPassed | The date on which the payments for the sale began has passed.td> |
DealerSale.AddSale.EndDateAlreadyPassed | The payment due date has passed. |
DealerSale.AddSale.BeginSaleEndDateException | Start and end sale date exception. |
DealerSale.AddSale.DealerSaleScheduleNotFound | Time program not found. |
DealerSale.AddSale.InvalidCardToken | Card Token information is invalid. |
DealerSale.AddSale.InvalidDefaultCard2Token | Default 2nd card Token information is invalid. |
DealerSale.AddSale.InvalidDefaultCard3Token | Default 3rd card Token information is invalid. |
DealerSale.AddSale.InvalidDealerCustomerTypeId | Customer type id is invalid. |
DealerSale.AddSale.InvalidCurrencyCode | The currency code is invalid. |
EX | An unexpected error has occurred |
Example of Failed Result
{
"Data": null,
"ResultCode": "DealerSale.AddSale.DefaultCard1TokenIsRequired",
"ResultMessage": "",
"Exception": null
}