### C# Client Example for BatchFileUpload
Source: https://api.netcash.co.za/inbound-payments/dc/debi-check-2
Example C# code demonstrating how to use the BatchFileUpload method with the Netcash web service client.
```C#
public string BatchFileUpload(string ServiceKey, string File)
{
// initialise client
NIWS_NIF.NIWS_NIFClient client = new NIWS_NIF.NIWS_NIFClient();
// call the BatchFileUpload method equal to a string variable
string Request = client.BatchFileUpload(ServiceKey, File);
// close client after response is received
client.Close();
switch (Request)
{
case "100": // Authentication failure
break;
case "102": // Parameter error
break;
case "200": // General code exception.
break;
default: // successful
return Request;
}
// use response to call RequestFileUploadReport method
return Request;
}
```
--------------------------------
### Key Record Example
Source: https://api.netcash.co.za/inbound-payments/pay-now/billing
Example of a Key record (K) which defines the content, order, and length of the transaction records that follow in the batch file.
```text
K 138 162 165 201 253 254 301 302 303 304
```
--------------------------------
### Key Record Example
Source: https://api.netcash.co.za/inbound-payments/emandate/update-masterfile
Example of a Key record. This record defines the content, order, and length of the subsequent transaction records.
```plaintext
K 101
```
--------------------------------
### Example Input File Format
Source: https://api.netcash.co.za/inbound-payments/pay-now/billing
This is an example of the plain text format for input files used in the BatchFileUpload method. It includes header, transaction, and footer records.
```plaintext
H C74EXXX5-5499-4663-85FB-2A6XXXXFB9EF 1 Invoice March 20150204 24ade73c-98cf-XXXX-XXXX-cc7b867b3080
K 253 254 162 138 301 302 303 201
T AB001123456 Serial no 56789012 150000 Y Jones March Inv123456 ajones@mweb.co.za
T CD001123457 Serial no 23568901 155090 N Brown March Inv123457 sbrown@gmail.com
F 2 170090 9999
```
--------------------------------
### Full Input File Example
Source: https://api.netcash.co.za/inbound-payments/dc/debi-check-2
An example of a complete inbound payment file, including header, key, transaction, and footer records. This format is used for submitting debit order information.
```plaintext
H C74EXXX5-5499-4663-85FB-2A6XXXXFB9EF 1 DebiCheck My Test Batch 20131204 24ade73c-98cf-XXXX-XXXX-cc7b867b3080
K 101 162 232 249 301 302 303
T AB001123456 150000 9 NC00000021 Jones Sept Inv123456
T CD001123457 17500 3 NC00000134 Brown Sept Inv123457
F 2 167500 9999
```
```plaintext
H C74EXXX5-5499-4663-85FB-2A6XXXXFB9EF 1 DebiCheck My Test Batch 20131204 24ade73c-98cf-XXXX-XXXX-cc7b867b3080
K 101 162 232 249 301 302 303
T AB001123456 150000 9 NC00000021 Jones Sept Inv123456
T CD001123457 17500 3 NC00000134 Brown Sept Inv123457
F 2 167500 9999
```
--------------------------------
### Header Record Example
Source: https://api.netcash.co.za/inbound-payments/emandate/emandate-download-mandate-data-pdf
An example of a Header record for the eMandate file upload. It includes the Service Key, version, instruction, batch name, action date, and software vendor code.
```text
H C74EF975-5429-4663-85FB-2A64CA0FB9EF 1 RequestMandatePDF My Test Batch 20201030 24ade73c-98cf-47b3-99be-cc7b867b3080
```
--------------------------------
### Footer Record Example
Source: https://api.netcash.co.za/inbound-payments/emandate/update-masterfile
This is an example of a footer record for a payment file. It indicates the end of the file and includes counts and sums.
```plaintext
F 2 0 9999
```
--------------------------------
### Header Record Example
Source: https://api.netcash.co.za/inbound-payments/pay-now/billing
Example of a Header record (H) for a batch upload file. It includes the Service Key, Version, Instruction, Batch name, Action date, and Software vendor key.
```text
H C74EXXX5-5499-4663-85FB-2A6XXXXFB9EF 1 Invoice My Test Batch 20100331 24ade73c-98cf-47b3-99be-cc7b867b3080
```
--------------------------------
### Header Record Example
Source: https://api.netcash.co.za/inbound-payments/emandate/update-masterfile
An example of a Header record for the mandate update file. Ensure the Service Key, Instruction, and Action Date are correctly formatted.
```plaintext
H C74EF975-5429-4663-85FB-2A64CA0FB9EF 1 MandateToMasterfile My Test Batch 20100331 24ade73c-98cf-47b3-99be-cc7b867b3080
```
--------------------------------
### Successful Upload Report Example
Source: https://api.netcash.co.za/inbound-payments/dc/debi-check-2
This is an example of a successful upload report, indicating no errors were found during the file processing.
```plaintext
###BEGIN MY TEST BATCH SUCCESSFUL 01:59 PM R1.00 20160410
###END 01:59 PM
```
--------------------------------
### Upload Report Example (Successful with Errors)
Source: https://api.netcash.co.za/inbound-payments/dc/debi-check-2
This example shows the expected output format for a successful report upload that contains errors. It details specific line items with validation issues.
```plaintext
###BEGIN MY TEST BATCH SUCCESSFUL WITH ERRORS 01:29 PM R1.00 20160410
Acc Ref :XI5 Line :3 Account details could not be validated. Please check the fields Bank account type, Branch code and Account number.
Acc Ref :XI5 Line :3 Bank account number has incorrect length (min 4, max 11 characters)
Acc Ref :HCOS1 Line :5 Beneficiary statement reference has incorrect length (min 4, max 20 characters)
Acc Ref :HCOZ1 Line :6 Beneficiary statement reference has incorrect length (min 4, max 20 characters)
###END 01:29 PM
```
--------------------------------
### Upload Report Example (Unsuccessful)
Source: https://api.netcash.co.za/inbound-payments/dc/debi-check-2
This example demonstrates the output for an unsuccessful report upload, indicating a system error that requires contacting Netcash support.
```plaintext
###BEGIN MY TEST BATCH UNSUCCESSFUL 01:23 PM R1.00 20160410
###ERROR: A system error occurred. Please contact Netcash R0.00 20160410
###END 01:23 PM
```
--------------------------------
### Signed Mandate PDF URL Example
Source: https://api.netcash.co.za/inbound-payments/emandate/emandate-download-mandate-data-pdf
Example URL format for accessing a signed mandate PDF. Requires your Debit Order service key.
```url
https://short.surf/SPDxxx?PKey=3a9be0d4-9999-8888-7777-05bf64cac464
```
--------------------------------
### Key Record Example
Source: https://api.netcash.co.za/inbound-payments/dc/debi-check-2
The key record (K) is mandatory and defines the content, order, and length of the transaction records that follow. It acts like column headings in a spreadsheet.
```text
K 101 162 232 249 301 302 303
```
--------------------------------
### Transaction Record Example
Source: https://api.netcash.co.za/inbound-payments/dc/debi-check-2
Transaction records (T) must conform to the order and number of fields defined in the key record. Empty fields should be represented by a blank tab or a default value.
```text
T Acc001 AccName001 1 BankAccountName001 1 470010 0 25000000000 100
```
--------------------------------
### DebiCheck Trace API Response Example
Source: https://api.netcash.co.za/inbound-payments/dc/dctrace
This XML snippet shows a sample response from the DebiCheckAuthenticationCurrentStatus web service method, indicating the status of a DebiCheck authentication.
```xml
NC000000004724
Rejected
20230116
000
```
--------------------------------
### Header Record Example
Source: https://api.netcash.co.za/inbound-payments/dc/debi-check-2
The header record (H) is mandatory and must be the first record in the file. It identifies the upload and provides instructions to the Netcash server.
```text
H C74EXXX5-5499-4663-85FB-2A6XXXXFB9EF 1 DebiCheck My Test Batch 20100331 24ade73c-98cf-47b3-99be-cc7b867b3080
```
--------------------------------
### Successful Request Mandate Data Response
Source: https://api.netcash.co.za/inbound-payments/emandate/emandate-download-mandate-data
Example of a successful response from the RequestMandateData method, returning a file token.
```text
20000000.2550236530.0483.2.2
```
--------------------------------
### Call BatchFileUpload Method
Source: https://api.netcash.co.za/inbound-payments/dc/debi-check-2
This C# method demonstrates how to call the BatchFileUpload web service. It initializes the client, sends the ServiceKey and File, and handles potential responses.
```csharp
public string BatchFileUpload(string ServiceKey, string File)
{
// initialise client
NIWS_NIF.NIWS_NIFClient client = new NIWS_NIF.NIWS_NIFClient();
// call the BatchFileUpload method equal to a string variable
string Request = client.BatchFileUpload(ServiceKey, File);
// close client after response is received
client.Close();
switch (Request)
{
case "100": // Authentication failure
break;
case "102": // Parameter error
break;
case "200": // General code exception.
break;
default: // successful
return Request;
}
// use response to call RequestFileUploadReport method
return Request;
}
```
--------------------------------
### Request File Upload Report in C#
Source: https://api.netcash.co.za/inbound-payments/dc/debi-check-2
Initializes a client, calls the RequestFileUploadReport method, and returns the response. Ensure the same service key used for batch file upload is provided.
```csharp
public string RequestFileUploadReport(string ServiceKey,
string FileToken) {
// initialise client
NIWS_NIF.NIWS_NIFClient client = new NIWS_NIF.NIWS_NIFClient();
// call the RequestFileUploadReport method equal to a string variable
// the same service key used for the bactch file upload
string Request = client.RequestFileUploadReport(ServiceKey, FileToken);
// close client after response is received
client.Close();
// use response to output to UI
// service will respond with the result of the file uploaded
return Request;
}
```
--------------------------------
### Request File Upload Report
Source: https://api.netcash.co.za/inbound-payments/emandate
Initializes a client, calls the RequestFileUploadReport method, and returns the result. Ensure the same service key used for batch file upload is used here. The client should be closed after the response is received.
```csharp
public string RequestFileUploadReport(string ServiceKey,
string FileToken) {
// initialise client
NIWS_NIF.NIWS_NIFClient client = new NIWS_NIF.NIWS_NIFClient();
// call the RequestFileUploadReport method equal to a string variable
// the same service key used for the bactch file upload
string Request = client.RequestFileUploadReport(ServiceKey, FileToken);
// close client after response is received
client.Close();
// use response to output to UI
// service will respond with the result of the file uploaded
return Request;
}
```
```csharp
public string RequestFileUploadReport(string ServiceKey, string FileToken) { // initialise client NIWS_NIF.NIWS_NIFClient client = new NIWS_NIF.NIWS_NIFClient(); // call the RequestFileUploadReport method equal to a string variable // the same service key used for the bactch file upload string Request = client.RequestFileUploadReport(ServiceKey, FileToken); // close client after response is received client.Close(); // use response to output to UI // service will respond with the result of the file uploaded return Request; }
```
```csharp
public string RequestFileUploadReport(string ServiceKey,
string FileToken) {
// initialise client
NIWS_NIF.NIWS_NIFClient client = new NIWS_NIF.NIWS_NIFClient();
// call the RequestFileUploadReport method equal to a string variable
// the same service key used for the bactch file upload
string Request = client.RequestFileUploadReport(ServiceKey, FileToken);
// close client after response is received
client.Close();
// use response to output to UI
// service will respond with the result of the file uploaded
return Request;
}
```
--------------------------------
### Load Report Header Structure
Source: https://api.netcash.co.za/inbound-payments/pay-now/billing
Defines the structure of the load report header, which appears once at the start of each report. It includes fields for record identifier, batch name, upload result, and report start time.
```plaintext
###BEGIN {your batch name} SUCCESSFUL / UNSUCCESSFUL / SUCCESSFUL WITH ERRORS HH:MM AM/PM
```
--------------------------------
### POST /PayNow/PayNow.svc - Create Invoice
Source: https://api.netcash.co.za/inbound-payments/pay-now/billing
This web service allows an external system to request an invoice reference for payment and receive an immediate response. It permits only a single request per web service call.
```APIDOC
## POST /PayNow/PayNow.svc - Create Invoice
### Description
This endpoint creates a payment request for a single invoice, returning a reference that can be used for payment.
### Method
POST
### Endpoint
https://ws.Netcash.co.za/PayNow/PayNow.svc
### Parameters
#### Request Body
- **M1** (string) - Required - Your merchant Service Key
- **M2** (string) - Required - Software Vendor Code
- **Amount xx** (decimal) - Required - The amount of the invoice
- **P2** (string) - Required - Unique reference for this invoice
- **P3** (string) - Required - Invoice Description
- **M4** (string) - Optional - Extra data field 1
- **M5** (string) - Optional - Extra data field 2
- **M6** (string) - Optional - Extra data field 3
- **M9** (string) - Optional - Email of the person you are invoicing
- **M10** (string) - Optional - Additional return string data
- **IgnoreAmount** (boolean) - Optional - If True, the amount in the barcode is used; otherwise, the provided Amount xx is used. Default is False.
- **M11** (string) - Optional - Mobile number. Compulsory if M12 is True.
- **M12** (boolean) - Optional - Send SMS. M11 must contain valid data if this field is set to true.
- **M13** (boolean) - Optional - Send eMail. M9 must contain valid data if this field is set to true.
- **M14** (boolean) - Optional - Request credit card token for subscription cards. Default = false
### Request Example
```json
{
"M1": "YOUR_SERVICE_KEY",
"M2": "YOUR_VENDOR_CODE",
"Amount xx": 100.50,
"P2": "INV-12345",
"P3": "Invoice for services rendered",
"M9": "customer@example.com",
"M11": "0712345678",
"M12": true,
"M13": true
}
```
### Response
#### Success Response (200)
An XML string response with the necessary data to populate your invoice. The structure adheres to the XSD at https://www.netcash.co.za/netcash/xsd/invoices.xsd. The response will only include payment types activated in the back office.
#### Error Response
- **100** - Authentication failed
- **103** - Invalid software vendor key
- **200** - Web service error contact support@Netcash.co.za
- **301** - Non unique reference provided
- **310** - Payment request not activated for this account. Contact support@netcash.co.za
### Response Example
(XML structure as per XSD: https://www.netcash.co.za/netcash/xsd/invoices.xsd)
### Retail Barcode
- **Barcode standard:** Code128C
- **Image type:** SVG_VML
- **Image width:** 400px
- **Image height:** 50px
```
--------------------------------
### Configure web.config for Cross-Site Scripting
Source: https://api.netcash.co.za/inbound-payments/dc/debi-check-2
Add these headers to your _web.config_ file to resolve cross-site scripting errors in Safari when using iFrames. Ensure these settings are correctly placed within the system.webServer section.
```xml
```
--------------------------------
### Netcash Payment Form Example
Source: https://api.netcash.co.za/inbound-payments/pay-now/pay-now-ecommerce-backup
This HTML form is used to submit payment details to the Netcash Pay Now service. Ensure all required fields like service key, vendor key, transaction ID, amount, and budget indicator are correctly populated.
```html
```
```html
```
```html