MasterCard MoneySend
The use of a AFT (Account Funding Transaction) is not required to conduct a OCT (Original Credit Transaction) and the use of a OCT is not required to conduct a AFT.
When implementing AFTs and/or OCTs for MasterCard you must populate data tags 10 and 11 in AdditionalData.
Trans Type
For OCT the allowed transaction types are 10, 11, 15, 16, 17, 1B. See Transaction types. For AFT use the appropriate transaction type. See Transaction types.
For OCT the parameter OriginalCredit must be assigned 1.
AFT (Account Funding Transaction/Pull Funds)
AFT is a transaction used to "pull" funds from a card account.
MCC codes
There are 4 MCC codes that are supported to AFT.
| MCC | Description |
|---|---|
| 4829 | Money transfer |
| 6538 | Funding Transactions for MoneySend |
| 6540 | Funding Transactions |
| 6051 | Non-financial institutions - foreign or non-fiat currency |
| 6211 | Security Brokers/Dealers |
Transaction Type Identifier (TTI)
The TTI will be added to additional data tag 11.
Allowed TTI's for MCC's in AFT
| Type | TTI | 4829 Money Transfer |
6538 Funding Transactions for MoneySend |
6540 Funding Transaction |
6051 Non-financial - foreign or non-fiat currency |
6211 Security Brokers/Dealers |
|---|---|---|---|---|---|---|
| Transfers Initiated by Consumers | ||||||
| General Person-to-Person Transfer | F07 | X | X | |||
| General Person-to-Person Transfer | C07 | X | ||||
| Person-to-Person Transfer to Card Account | F08 | X | ||||
| Agent C | F53 | X | X | |||
| Agent Cash-Out | C53 | X | ||||
| Transfers Initiated by Consumers or Organizations | ||||||
| Transfer to Own Debit or Prepaid Account | F64 | X | ||||
| Payment of Own Credit Card Bill | F54 | X | ||||
| Payment of Own Credit Card Bill | C54 | X | ||||
| Transfer to Own Staged Digital Wallet Account | F61 | X | X | X | X | |
| General Transfer to Own Account | F52 | X | X | X | ||
| General Transfer to Own Account | C52 | X | ||||
| Transfers Initiated by Organizations | ||||||
| Business Disbursement | F55 | X | ||||
| Business Disbursement | C55 | X | ||||
| Government/Non Profit Disbursement | C56 | X | ||||
| Rapid Merchant Settlement | C57 | X | ||||
| General Business-to-Business Transfer | F65 | X | ||||
| General Business-to-Business Transfer | C65 | X | ||||
| High Risk Securities | P71 | X | X | |||
| Stablecoin / CBDC | P76 | X |
OCT (Payment Transaction/Push Funds)
OCT is a transaction that used to "push" funds to a card account.
MCC codes
Their are 3 MCC codes that are supported to OCT.
| MCC | Description |
|---|---|
| 6536 | Domestic Transactions |
| 6537 | Cross-border Transactions |
| 7995 | Gambling Payout |
Transaction Type Identifier (TTI)
The TTI will be added to additional data tag 11.
Allowed TTI's for MCC's in OCT
| Type | TTI | 6536 Domestic Transactions |
6537 Cross-border Transactions |
7995 Gambling Payout |
|---|---|---|---|---|
| Transfers Initiated by Consumers | ||||
| General Person-to-Person Transfer | C07 | X | X | |
| Agent Cash-Out | C53 | X | X | |
| Transfers Initiated by Consumers or Organizations | ||||
| Payment of Own Credit Card Bill | C54 | X | X | |
| General Transfer to Own Account | C52 | X | X | |
| Transfers Initiated by Organizations | ||||
| Business Disbursement | C55 | X | X | |
| Government/Non Profit Disbursement | C56 | X | X | |
| Rapid Merchant Settlement | C57 | X | X | |
| General Business-to-Business Transfer | C65 | X | X | |
| Gaming Repay | C04 | X |
Fields
For MasterCard Money Send there are 6 subelements which all have subfields. These subelements will be added to additional data tag 10.
| Subelement | Description |
|---|---|
| 01 | Recipient Data |
| 02 | Sender Data |
| 03 | Transaction Reference Data |
| 04 | Language Description |
| 05 | Digital Account Information |
| 06 | QR Dynamic Code Data |
All subelements and subfields are TLV (Tag-Length-Value) parameters.
Tag (subelement or subfield) defined as alphanumerical, two characters long.
Length is defined as a three numerical characters, i.e possible values 001-999.
Value is defined as the format is given in the tables for subfields (Mandatory subfields, Optional subfields).
See examples to see how this is done in more detail.
Mandatory subfields
Mandatory subfields for AFT are the same for domestic and cross-border transactions
M = Mandatory for transaction
| Parameter | Subelement | Subfield | AFT | OCT Domestic Transaction | OCT Cross-Border Transaction |
|---|---|---|---|---|---|
| MCC codes | - | - | 4829, 6538, 6540, 6051, 6211 | 6536, 7995 | 6537, 7995 |
| Recipient's First Name Format: ans...35 |
01 | 01 | M | - | M |
| Recipient's Last Name Format: ans...35 |
01 | 03 | M | - | M |
| Recipient's Country Format: ans-3 |
01 | 07 | M | - | - |
| Recipient's Account Number Format: ans...50 |
01 | 11 | M | - | - |
| Recipient's Account Number Type Format: n-2 |
01 | 18 | M | - | - |
| Sender's First Name Format: ans...35 |
02 | 01 | - | M | M |
| Sender's Last Name Format: ans...35 |
02 | 03 | - | M | M |
| Sender's Street Address Format: ans...50 |
02 | 04 | - | M | M |
| Sender's City Format: ans...25 |
02 | 05 | - | M | M |
| Sender's Country Format: an-3 |
02 | 07 | - | M | M |
| Sender's Account Number Format: ans...50 |
02 | 11 | - | M | M |
| Sender's Account Number Type Format: n-2 |
02 | 18 | - | M | M |
| Unique Transaction Reference Number Format: ans-12 |
03 | 01 | M | M | M |
| Funding Source Format: n-2 |
03 | 03 | - | M | M |
| Transaction Purpose Format: n-2 |
03 | 05 | M | M | M |
Mandatory subfields detailed information
The Recipient’s or Sender's name for the cases where the user is an Organization must be done by coding the name of the Organization in both the first name and in the last name fields.
When registering a country it must be a valid ISO country code, see Mastercard country list, and must not be on the blocked countries list.
The Unique Transaction Reference Number must permit traceability of the Transaction and, when applicable, must link the Funding Transaction to the Payment Transaction. When a Funding Transaction is used to fund a Payment Transaction, the Payment Transaction must contain the same Unique Transaction Reference value as the Funding Transaction.
Valid Unique Transaction Reference Number string will contain:
| Parameter | Format | Example |
|---|---|---|
| Year | n-1 | If year is 2018 it will be 8 |
| Julian Date | n-3 | If date is 12th of January will be 012 (1-356) |
| Time hhmmss | n-6 | If time is 21:53:06 will be 215306 |
| Transaction Sequence Number | n-2 | 01 (01-99) |
If the account type is set as 06 (Bank account number (BAN) + Bank Identification Сode (BIC)) the data in Account number (Recipient's and Sender's) must be separated by '+'.
When the Recipient is intended to receive the funds transferred in cash as in the case of an Agent Cash-Out Transaction, the Recipient Account Number field must contain the code word "#CASH" or 9999999999999995. The Recipient Account Number Type field must be coded with 00 (Other).
For Account number Type (Recipient and Sender) there are 8 options.
- 00 (Other)
- 01 (RTN + Bank Account)
- 02 (IBAN)
- 03 (Card Account)
- 04 (Email)
- 05 (Phone Number)
- 06 (Bank account number (BAN) + Bank Identification Сode (BIC))
- 07 (Wallet ID)
- 08 (Social Network ID)
Funding Source contains the information representing the transaction funding source. For Funding Source their are 8 options.
- 01 (Credit)
- 02 (Debit)
- 03 (Prepaid)
- 04 (Deposit Account)
- 05 (Mobile Money Account)
- 06 (Cash)
- 07 (Other)
For Transaction Purpose there are 16 options (12 in use).
- 00 (Family Support)
- 01 (Regular Labor Transfers)
- 02 (Travel & Tourism)
- 03 (Education)
- 04 (Hospitalization & Medical Treatment)
- 05 (Emergency Need)
- 06 (Savings)
- 07 (Gifts)
- 08 (Other)
- 09 (Salary)
- 10 (Crowd lending)
- 11 (Crypto currency)
- 12 - 15 (Reserved)
- 16 (High Risk Securities)
Optional subfields
These subfields are optional for both OCT and AFT transactions
| Parameter | Subelement | Subfield |
|---|---|---|
| Recipient's Middle Name Format: ans-1 |
01 | 02 |
| Recipient's Street Address Format: ans...50 |
01 | 04 |
| Recipient's City Format: ans...25 |
01 | 05 |
| Recipient's State/Province Code Format: ans...3 |
01 | 06 |
| Recipient's Postal Code Format: ans...10 |
01 | 08 |
| Recipient's Phone Number Format: ans...20 |
01 | 09 |
| Recipient's Date of Birth Format: n-8 |
01 | 10 |
| Recipient's Identification Type Format: n-2 |
01 | 12 |
| Recipient's Identification Number Format: ans...25 |
01 | 13 |
| Recipient's Identification Country Code Format: ans-3 |
01 | 14 |
| Recipient's Identification Expiration Date Format: n-8 |
01 | 15 |
| Recipient's Nationality Format: ans-3 |
01 | 16 |
| Recipient's Country of Birth Format: ans-3 |
01 | 17 |
| Sender's Middle Name Format: ans-1 |
02 | 02 |
| Sender's State/Province Code Format: ans...3 |
02 | 06 |
| Sender's Postal Code Format: ans..10 |
02 | 08 |
| Sender's Phone Number Format: ans..25 |
02 | 09 |
| Sender's Date of Birth Format: n-8 |
02 | 10 |
| Sender's Identification Type Format: n-2 |
02 | 12 |
| Sender's Identification Number Format: ans...25 |
02 | 13 |
| Sender's Identification Country Code Format: ans-3 |
02 | 14 |
| Sender's Identification Expiration Date Format: n-8 |
02 | 15 |
| Sender's Nationality Format: ans-3 |
02 | 16 |
| Sender's Country of Birth Format: ans-3 |
02 | 17 |
| Additional Message Format: ans...138 |
03 | 02 |
| Participation ID Format: ans...30 |
03 | 04 |
| Language Identification Format: ans-3 |
04 | 01 |
| Language Data Format: b...50 |
04 | 02 |
| Digital Account Reference Number Format: n...19 |
05 | 01 |
| Mastercard Merchant Presented QR Receiving Account Number Format: ans...34 |
05 | 02 |
| QR Dynamic Code Data Format: ans...237 |
06 | 01 |
Optional fields detailed information
Recipient's and/or Sender's Identification Type has the following 11 options (6 in use).
- 00 (Passport)
- 01 (National Identification Card)
- 02 (Driver’s License)
- 03 (Government Issued)
- 04 (Other)
- 05–10 (Reserved)
All dates will have to have the format MMDDYYYY
Examples
AFT
This is a correct string for additional data tag 10 for a AFT transaction
100900105601003Jon03007Jonsson07003352110165204730000003033180020303031010128012153054010500208
Lets break it down to understand it better.
additionalDataTag10 = 100900105601003Jon03007Jonsson07003352110165204730000003033180020303031010128012153054010500208
10 090
01 056
01 003 Jon
03 007 Jonsson
07 003 352
11 016 5204730000003033
18 002 03
03 031
01 012 801215305401
05 002 08
Starting with tag 10 and it's value length which is 090 (note the length is always represented with numerical characters of length 3, i.e possible values 001-999). Now lets look at the subfields that belong to subelement 01.
- Recipient's First Name subfield 01 the length of the First Name 003 and value Jon. string subfield01 = 01003Jon
- Recipient's Last Name subfield 03 the length of the Last Name 007 and value Jonsson. string subfield03 = 03007Jonsson
- Recipient's Country subfield 07 the length of the Country 003 and value 352, the country code of Iceland. string subfield07 = 07003352
- Recipient's Account Number subfield 11 the length of the Account Number 016 and value 535144000000000. string subfield11 = 110165204730000003033
- Recipient's Account Number Type subfield 18 the length of the Account Number Type 002 and value 03, 03 means the type is Card Account. Click here to see what types can be choosen. string subfield18 = 1800203
By concatenating these subfields finding the length we can create the string for subelement01. 01003Jon03007Jonsson070033521101652047300000030331800203 has 56 characters so the length will be 056 and we know this belongs to subelement 01. So we get the string: string subelemetn01 = 0105601003Jon03007Jonsson070033521101652047300000030331800203
Next we will look at the subfields that belong to subelement 03.
- Unique Transaction Reference Number subfield 01 with the length of 012 and value 801215305401. Click here for more detail on Unique Transaction Reference Number string subfield01 = 01012801215305401
- Transaction Purpose subfield 05 with the length of 002 and value 08, 08 which means the purpose is Other. Click here to see what types can be used. string subfield03 = 0500208
By concatenating these subfields finding the length we can create the string for subelement03. 0101905555558012153054010500208 has 31 characters so the length will be 031 and we know this belongs to subelement 03. So we get the string: string subelemetn03 = 030310101905555558012153054010500208
Now concatenating subelement01 and subelement03 we can createe the string for additionalDataTag10. 0105601003Jon03007Jonsson070033521101652047300000030331800203030310101905555558012153054010500208 has 97 characters so the length will be 097. This will be the value for additional data tag 10 so we can now get the string: string AdditionalDataTag10 = 100970105601003Jon03007Jonsson070033521101652047300000030331800203030310101905555558012153054010500208.
We now have filled all the mandatory fields for a AFT transaction.
Code Example
// Subelement 01
string recipientFirstName = "Jon";
string recipientLastName = "Jonsson";
string recipientCountry = "352";
string recipientAccountNumber = "5204730000003033";
string recipientAccountType = "03";
string subelement01_subfield01 = "01" + recipientFirstName.Length.ToString().PadLeft(3, '0') + recipientFirstName;
string subelement01_subfield03 = "03" + recipientLastName.Length.ToString().PadLeft(3, '0') + recipientLastName;
string subelement01_subfield07 = "07" + recipientCountry.Length.ToString().PadLeft(3, '0') + recipientCountry;
string subelement01_subfield11 = "11" + recipientAccountNumber.Length.ToString().PadLeft(3, '0') + recipientAccountNumber;
string subelement01_subfield18 = "18" + recipientAccountType.Length.ToString().PadLeft(3, '0') + recipientAccountType;
string subelement01 = subelement01_subfield01 + subelement01_subfield03 + subelement01_subfield07 + subelement01_subfield11 + subelement01_subfield18;
subelement01 = "01" + subelement01.Length.ToString().PadLeft(3, '0') + subelement01;
/// Subelement 03
var dateTime = DateTime.Now;
var year = dateTime.Year.ToString().Substring(3, 1);
var dayOfYear = dateTime.DayOfYear.ToString().PadLeft(3, '0');
var hms = dateTime.ToString("hhmmss");
var transactionSequenceNumber = "01"; //(01-99)
string uniqueTransactionRefrenceNumber = year + dayOfYear + hms + transactionSequenceNumber;
string transactionPurpose = "08";
string subelement03_subfield01 = "01" + uniqueTransactionRefrenceNumber.Length.ToString().PadLeft(3, '0') + uniqueTransactionRefrenceNumber;
string subelement03_subfield05 = "05" + transactionPurpose.Length.ToString().PadLeft(3, '0') + transactionPurpose;
string subelement03 = subelement03_subfield01 + subelement03_subfield05;
subelement03 = "03" + subelement03.Length.ToString().PadLeft(3, '0') + subelement03;
// AdditionalData Tag 10
string additionalDataTag10 = subelement01 + subelement03;
additionalDataTag10 = "10" + additionalDataTag10.Length.ToString().PadLeft(3, '0') + additionalDataTag10;
//Then adding the TTI to additonal data tag 11, see table Allowed TTI's for MCC's in AFT
additionalDataTag11 = "11" + "003" + "C55";
string additionalData = additionalDataTag10 + additionalDataTag11
Request Example
Given that you have created the additionalData string as the examples show above.
// code is compatible with .net8 console app
using System.Web;
using Microsoft.Extensions.DependencyInjection;
var service = new ServiceCollection();
service.AddHttpClient();
var client = service.BuildServiceProvider()
.GetService<IHttpClientFactory>()!
.CreateClient();
var parameters = new Dictionary<string, string>
{
{ "MsgType", "0100" },
{ "MsgSenderID", "[insert your username]" },
{ "MsgSenderAP", "[insert your password]" },
{ "MsgID", "123456" },
{ "MerchantXID", "2995652ABCDEFGH" },
{ "MerchantType", "4829" }, //Possible MCC codes for OCT as shown above
{ "TerminalID", "18101001" },
{ "CardType", "M" },
{ "CardNumber", "4761739001010010" },
{ "CardExpDate", "1812" },
{ "ICCData", "9F0A01019F6E060000000000005F3401059F020600000000010082025C009F360200179F26080D84F11A5CA93C669F2701809F34031E03009F100706010A03A000009F0902008C9F3303E0B8C89F1A020826950500000080005F2A0208269A031309269C01009F370493380C28840D5041592E5359532E4444463031" },
{ "Track2", "5204730000002779D25122010000000000" },
{ "TransType", "45" }, //Use the appropriate transaction type.
{ "TransAmount", "100" },
{ "TransCurrency", "352" },
{ "TransTime", "230101" },
{ "TransDate", "0310" },
{ "MerchantName", "CIP*Billy shoes" },
{ "MerchantCity", "London" },
{ "AdditionalData", additionalData } // additionalData is the parameter created from the example above
};
var request = new HttpRequestMessage(HttpMethod.Post, "https://authorization.acquiring.uat.valitor.com/process")
{
Content = new FormUrlEncodedContent(parameters)
};
HttpResponseMessage response = await client.SendAsync(request);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
var responseParameters = System.Web.HttpUtility.ParseQueryString(content);
// Process responseParameters here
}
else
{
// Handle error
}
OCT
Unlike AFT, OCT slightly differ depending on if it's a domestic or cross-border transaction.
When there is a cross-border OCT the Recipient's First Name and Recipient's Last Name must be present, this is not the case for domestic OCT.
This is a correct string for additional data tag 10 for a OCT domestic transaction.
101330209201004Jona03010Jonsdottir04013Laugarvegur 105009Reykjavik070033521101652047300000030331800203030310101230750103170102002010500208
This is a correct string for additional data tag 10 for a OCT cross-border transaction.
101580102001003Jon03007Jonsson0209201004Jona03010Jonsdottir04013Laugarvegur 105009Reykjavik070033521101652047300000030331800203030310101230751255220102002010500208
Let's break down a cross-border OCT transaction, note this also works for domestic OCT transactions but subelement 01 is not mandatory for them.
additionalDataTag10 = 101580102001003Jon03007Jonsson0209201004Jona03010Jonsdottir04013Laugarvegur 105009Reykjavik070033521101652047300000030331800203030310101230751255220102002010500208
10 158
01 020
01 003 Jon
03 007 Jonsson
02 092
01 004 Jona
03 010 Jonsdottir
04 013 Laugarvegur 1
05 009 Reykjavik
07 003 352
11 016 5204730000003033
18 002 03
03 031
01 012 801215305401
03 002 01
05 002 08
Starting with tag 10 and it's value length which is 158 (note the length is always represented with numerical characters of length 3, i.e possible values 001-999). Now lets look at the subfields that belong to subelement 01 (only Mandatory for cross-border transaction).
- Recipient's First Name subfield 01 the length of the First Name 003 and value Jon. string subfield01 = 01003Jon
- Recipient's Last Name subfield 03 the length of the Last Name 007 and value Jonsson. string subfield03 = 03007Jonsson
By concatenating these subfields finding the length we can create the string for subelement01. 01003Jon03007Jonsson has 20 characters so the length will be 020 and we know this belongs to subelement 01. So we get the string: string subelement01 = 0102001003Jon03007Jonsson
Next we will look at the subfields that belong to subelement 02.
- Sender's First Name subfield 01 the length of the First Name 004 and value Jona. string subfield01 = 01004Jona
- Sender's Last Name subfield 03 the length of the Last Name 010 and value Jonsdottir. string subfield03 = 03010Jonsdottir
- Sender's Sender's Street Address subfield 04 the length of the Street Address 013 and value Laugarvegur 1. string subfield04 = 04013Laugarvegur 1
- Sender's Sender's City subfield 05 the length of the City 009 and value Reykjavkik. string subfield05 = 05009Reykjavkik
- Sender's Sender's Country subfield 07 the length of the City 003 and value 352. string subfield07 = 07003352
- Sender's Account Number subfield 11 the length of the Account Number 016 and value 5204730000003033. string subfield11 = 110165204730000003033
- Sender's Account Number Type subfield 18 the length of the Account Number Type 002 and value 03, 03 means the type is Card Account. Click here to see what types can be choosen. string subfield18 = 1800203
By concatenating these subfields finding the length we can create the string for subelement02. 01004Jona03010Jonsdottir04013Laugarvegur 105009Reykjavik070033521101652047300000030331800203 has 92 characters so the length will be 092 and we know this belongs to subelement 02. So we get the string: string subelement02 = 0209201004Jona03010Jonsdottir04013Laugarvegur 105009Reykjavik0700335211016520473000000303318002
Finally we will look at the subfields that belong to subelement 03.
- Unique Transaction Reference Number subfield 01 with the length of 012 and value 801215305401. Click here for more detail on Unique Transaction Reference Number string subfield01 = 01012801215305401
- Funding Source subfield 03 with the length of 002 and value 01, 01 which means the funding source is Credit. Click here for more detail on Funding Source string subfield02 = 0300201
- Transaction Purpose subfield 05 with the length of 002 and value 08, 08 which means the purpose is Other. Click here to see what types can be used. string subfield03 = 0500208
By concatenating this together finding the length we can create the string for subelement03. 0101230741202560102002010500208 has 31 characters so the length will be 031 and we know this belongs to subelement 03. So we get the string: string subelement03 = 030310101230741202560102002010500208
Now concatenating subelement01, subelement02 and subelement03 we can createe the string for additionalDataTag10. 0102001003Jon03007Jonsson0209201004Jona03010Jonsdottir04013Laugarvegur 105009Reykjavik0700335211016520473000000303318002030303801019055555580121530540103002010500208 has 165 characters so the length will be 165. This will be the value for additional data tag 10 so we can now get the string: string AdditionalDataTag10 = 101580102001003Jon03007Jonsson0209201004Jona03010Jonsdottir04013Laugarvegur 105009Reykjavik070033521101652047300000030331800203030310101230750103170102002010500208
We now have filled all the mandatory fields for a cross-border and domestic OCT transaction (for domestic OCT transaction subelemnt01 is optional).
Code Example
// Subelement 01
string recipientFirstName = "Jon";
string recipientLastName = "Jonsson";
string subelement01_subfield01 = "01" + recipientFirsttName.Length.ToString().PadLeft(3, '0') + recipientFirstName;
string subelement01_subfield03 = "03" + recipientLastName.Length.ToString().PadLeft(3, '0') + recipientLastName;
string subelement01 = subelement01_subfield01 + subelement01_subfield03;
subelement01 = "01" + subelement01.Length.ToString().PadLeft(3, '0') + subelement01;
/// Subelement 02
string senderFirstName = "Jona";
string senderLastName = "Jonsdottir";
string senderStreetAddress = "Laugarvegur 1";
string senderCity = "Reykjavik";
string senderCountry = "352";
string senderAccountNumber = "5204730000003033";
string senderAccountType = "03";
string subelement02_subfield01 = "01" + senderFirstName.Length.ToString().PadLeft(3, '0') + senderFirstName;
string subelement02_subfield03 = "03" + senderLastName.Length.ToString().PadLeft(3, '0') + senderLastName;
string subelement02_subfield04 = "04" + senderStreetAddress.Length.ToString().PadLeft(3, '0') + senderStreetAddress;
string subelement02_subfield05 = "05" + senderCity.Length.ToString().PadLeft(3, '0') + senderCity;
string subelement02_subfield07 = "07" + senderCountry.Length.ToString().PadLeft(3, '0') + senderCountry;
string subelement02_subfield11 = "11" + senderAccountNumber.Length.ToString().PadLeft(3, '0') + senderAccountNumber;
string subelement02_subfield18 = "18" + senderAccountType.Length.ToString().PadLeft(3, '0') + senderAccountType;
string subelement02 = subelement02_subfield01 + subelement02_subfield03 + subelement02_subfield04 + subelement02_subfield05 + subelement02_subfield07 + subelement02_subfield11 + subelement02_subfield18;
subelement02 = "02" + subelement02.Length.ToString().PadLeft(3, '0') + subelement02;
/// Subelement 03
var dateTime = DateTime.Now;
var year = dateTime.Year.ToString().Substring(3, 1);
var dayOfYear = dateTime.DayOfYear.ToString().PadLeft(3, '0');
var hms = dateTime.ToString("hhmmss");
var transactionSequenceNumber = "01"; //(01-99)
string uniqueTransactionRefrenceNumber = year + dayOfYear + hms + transactionSequenceNumber;
string fundingSource = "01";
string transactionPurpose = "08";
string subelement03_subfield01 = "01" + uniqueTransactionRefrenceNumber.Length.ToString().PadLeft(3, '0') + uniqueTransactionRefrenceNumber;
string subelement03_subfield03 = "03" + fundingSource.Length.ToString().PadLeft(3, '0') + fundingSource;
string subelement03_subfield05 = "05" + transactionPurpose.Length.ToString().PadLeft(3, '0') + transactionPurpose;
string subelement03 = subelement03_subfield01 + subelement03_subfield02 + subelement03_subfield05;
subelement03 = "03" + subelement03.Length.ToString().PadLeft(3, '0') + subelement03;
// AdditionalData Tag 10
string additionalDataTag10 = subelement01 + subelement02 + subelement03;
additionalDataTag10 = "10" + additionalDataTag10.Length.ToString().PadLeft(3, '0') + additionalDataTag10;
//Then adding the TTI to additonal data tag 11, see table Allowed TTI's for MCC's in OCT
additionalDataTag11 = "11" + "003" + "C55";
string additionalData = addititonalDataTag10 + additionalDataTag11
Request Example
Given that you have created the additionalData string as the examples show above.
// code is compatible with .net8 console app
using System.Web;
using Microsoft.Extensions.DependencyInjection;
var service = new ServiceCollection();
service.AddHttpClient();
var client = service.BuildServiceProvider()
.GetService<IHttpClientFactory>()!
.CreateClient();
var parameters = new Dictionary<string, string>
{
{ "MsgType", "0100" },
{ "MsgSenderID", "[insert your username]" },
{ "MsgSenderAP", "[insert your password]" },
{ "MsgID", "123456" },
{ "MerchantXID", "2995652ABCDEFGH" },
{ "MerchantType", "7995" }, //Possible MCC codes for OCT as shown above
{ "TerminalID", "18101001" },
{ "CardNumber", "4761739001010010" },
{ "CardType", "M" },
{ "CardExpDate", "1812" },
{ "TransType", "10" }, //Choose the appropriate transtype
{ "TransAmount", "100" },
{ "TransCurrency", "352" },
{ "TransTime", "230101" },
{ "TransDate", "0310" },
{ "MerchantName", "CIP*Billy shoes" },
{ "MerchantCity", "London" },
{ "AdditionalData", additionalData } // additionalData is the parameter created from the example above
};
var request = new HttpRequestMessage(HttpMethod.Post, "https://authorization.acquiring.uat.valitor.com/process")
{
Content = new FormUrlEncodedContent(parameters)
};
HttpResponseMessage response = await client.SendAsync(request);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
var responseParameters = System.Web.HttpUtility.ParseQueryString(content);
// Process responseParameters here
}
else
{
// Handle error
}