Add Sale

Service Address

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

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

ResultCodeExplanation
DealerSale.AddSale.InvalidRequestThe CheckKey may be bad, or the object may be bad, or the JSON may be corrupt.
DealerSale.AddSale.CustomerCodeOrDealerCustomerIdMustBeGivenCustomer code or dealer customer id must be entered.
DealerSale.AddSale.ProductCodeOrDealerProductIdMustBeGivenProduct code or dealer product id must be entered.
DealerSale.AddSale.SaleDateIsRequiredDate of sale required..
DealerSale.AddSale.AmountIsRequiredAmount information required.
DealerSale.AddSale.DealerSaleScheduleIdIsRequiredTime schedule id required.
DealerSale.AddSale.BeginDateIsRequiredInformation on when the sale will start payments is required.
DealerSale.AddSale.EndDateIsRequiredInformation on the date on which the payments will end is required.
DealerSale.AddSale.DefaultCard1TokenIsRequiredInformation on which card the payment will be made is required.
DealerSale.AddSale.DealerProductIdNotFoundThe customer's product id could not be found.
DealerSale.AddSale.ProductCodeDoesntMatchDealerProductIdThe product code and the dealer product id do not match.
DealerSale.AddSale.DealerCustomerIdNotFoundDealer customer id not found.
DealerSale.AddSale.CustomerCodeDoesntMatchDealerCustomerIdThe customer code and the dealer customer ID do not match.
DealerSale.AddSale.SaleDateAlreadyPassedThe 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.BeginSaleEndDateExceptionStart and end sale date exception.
DealerSale.AddSale.DealerSaleScheduleNotFoundTime program not found.
DealerSale.AddSale.InvalidCardTokenCard Token information is invalid.
DealerSale.AddSale.InvalidDefaultCard2TokenDefault 2nd card Token information is invalid.
DealerSale.AddSale.InvalidDefaultCard3TokenDefault 3rd card Token information is invalid.
DealerSale.AddSale.InvalidDealerCustomerTypeIdCustomer type id is invalid.
DealerSale.AddSale.InvalidCurrencyCodeThe currency code is invalid.
EX An unexpected error has occurred

Example of Failed Result


{
	"Data": null,
	"ResultCode": "DealerSale.AddSale.DefaultCard1TokenIsRequired",
	"ResultMessage": "",
	"Exception": null
}