Service Address
/DealerSale/AddPaymentPlan
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 |
DealerSaleId (integer) |
Not required if SaleCode is submitted. On the Moka side, it is the Unique ID of the sale. |
SaleCode (string) |
Not required if DealerSaleId is submitted. On the dealer side, it is the code of the sale. |
PaymentDate (string) |
What date to shoot (in "YYYYMMDD" format) |
Amount (decimal) |
Amount to be withdrawn. ( eg: 25.45 ) |
Currency (string) |
It is not a required field. If nothing is sent or an empty string is sent, the default currency is TL. (other values : "USD", "EUR") |
InstallmentNumber (integer) |
Installment amount (1: Single payment, 2: 2 Installments ...) |
Sample Request (JSON)
{
"DealerSaleAuthentication": {
"DealerCode": "xxx",
"Username": "xxx",
"Password": "xxx",
"CheckKey": "aabbccddeeff"
},
"DealerSaleRequest": {
"DealerPaymentPlanId": "1003",
"PaymentDate": "20170825",
"Amount": "1",
"Currency": "TL",
"InstallmentNumber": "1"
}
}
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 |
DealerPaymentPlanId (integer) |
This is the Unique Id given by Moka for this payment step. |
DealerSaleId (integer) |
On the Moka side, it is the Id of the sale to which this payment step is added. |
SaleCode (integer) |
It is the code of the sale to which this payment step is added on the dealer side. |
PaymentDate (string) |
Date of shooting |
Amount (decimal) |
Amount to be withdrawn |
Currency (string) |
Currency unit |
InstallmentNumber (integer) |
Installment information |
HistoryDate (datetime) |
This field will be blank because the payment has not started yet. |
CardToken (guid) |
Token returns empty because no payment has been made yet. |
DealerCustomerTypeId (integer) |
If payment is made by sending a payment request, it will be filled. |
UserPosPaymentId (integer) |
If payment is made by sending a payment request, it will be filled.. |
DealerPaymentId (integer) |
Since this payment step has not turned into a payment yet, the Payment Id returns empty.. |
IsManualPlan (boolean) |
Since this payment step is entered manually, it returns "true". |
PlanStatus (integer) |
When the payment step is created, the first Status is "0". |
Successful Result Example
{
"Data": {
"DealerPaymentPlanId": 1003,
"DealerSaleId": 1003,
"SaleCode": "satis",
"PaymentDate": "20170825",
"Amount": 1,
"Currency": "TL",
"InstallmentNumber": 1,
"HistoryDate": "",
"CardToken": "",
"DealerCustomerTypeId": 0,
"UserPosPaymentId": 0,
"DealerPaymentId": 0,
"IsManualPlan": true,
"PlanStatus": 0
},
"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.AddPaymentPlan.InvalidRequest | The CheckKey may be bad, or the object may be bad, or the JSON may be corrupt. |
DealerSale.AddPaymentPlan.SaleCodeOrDealerSaleIdMustBeGiven | Sales code or dealer sales id must be entered. |
DealerSale.AddPaymentPlan.AmountIsRequired | Amount information required. |
DealerSale.AddPaymentPlan.PaymentDateIsRequired | Date of shooting is required. |
DealerSale.AddPaymentPlan.InvalidInstallmentNumber | The installment number is invalid |
DealerSale.AddPaymentPlan.InvalidDateFormatPaymentDate | The format of the shooting date information is invalid. |
DealerSale.AddPaymentPlan.PaymentDatePassed | The shooting date has passed.. |
DealerSale.AddPaymentPlan.InvalidCurrencyCode | The currency code is invalid. |
DealerSale.AddPaymentPlan.DealerSaleIsNotManualPlan | Dealer sale is not a manual plan. |
DealerSale.AddPaymentPlan.SaleEndDatePassed | The deadline to shoot for the sale has passed |
DealerSale.AddPaymentPlan.PaymentDateMustBeAfterSaleBeginDate | The payment date must be after the start date of the sale. |
DealerSale.AddPaymentPlan.PaymentDateMustBeBeforeSaleEndDate | The payment date must be before the end of the sale. |
EX | An unexpected error has occurred |
Example of Failed Result
{
"Data": null,
"ResultCode": "DealerSale.AddPaymentPlan. DealerSaleIsNotManualPlan",
"ResultMessage": "",
"Exception": null
}