Transactions Fees & Discounts
February 14, 2023 at 10:38 AMA transaction can have many fees and/or discounts applied, once a transaction is processed you can have the list of adjustments applied in the response in order to know the real transaction amount.
mutation ($input: SubmitTransactionInput!) {
transactions {
submit(input: $input) {
transaction {
id
number
status
date
grossTotal
adjustments {
name
amount
total
rateMode
isDiscount
}
total
response {
message
}
}
}
}
}
{
"input": {
"product": "ji12sd4c0a3D0=",
"inputs": {
"accountNumber": "+13051231234",
"amount": 50
}
}
}
{
"data": {
"transactions": {
"submit": {
"transaction": {
"id": "VlVkc2R3VlBSRVU5=",
"number": "00830981",
"status": "COMPLETED",
"date": "2018-06-08T21:34:49-04:00",
"grossTotal": 50,
"adjustments": [
{
"name": "E911 User Fee",
"amount": 0.4,
"total": 0.4,
"rateMode": false,
"isDiscount": false
},
{
"name": "Other Fee",
"amount": 2,
"total": 1,
"rateMode": true,
"isDiscount": false
}
],
"total": 51.4,
"response": {
"message": "The phone +13051231234 has been recharged successfully with $50.00."
}
}
}
}
}
}
The above response can be displayed in the final user receipt as:
Ammount: $ 50.00
Adjustments:
E911 User Fee: $ 0.40
Other Fee: $ 1.00 (2%)
------------------------------------
Total: $ 51.40
Getting Adjustments before the process
Commonly you need the list of adjustments applied to a transaction before the transaction is submitted.
Adjustments are applied based on dynamic rules; product, store location, amount to pay, method of payment etc. You must give us the details of the transaction as it is going to be sent to know the adjustments that will be applied.
Then, the place to do this is the validation method. Can send q query like this to get the list of adjustments and the real amount to collect before process the transaction:
mutation validateTransaction($validate: ValidateTransactionInput!) {
transactions {
validate(input: $validate) {
grossTotal
adjustments {
name
amount
total
rateMode
isDiscount
}
total
}
}
}
{
"validate": {
"product": "ji12sd4c0a3D0=",
"inputs": {"accountNumber": "+13051231234"}
}
}
{
"data": {
"transactions": {
"validate": {
"grossTotal": 50,
"adjustments": [
{
"name": "E911 User Fee",
"amount": 0.4,
"total": 0.4,
"rateMode": false,
"isDiscount": false
}
],
"total": 50.4
}
}
}
}
If the validation is success; you get the list of adjustments to apply in the response and the total transaction amount.
Adjustments are calculated based on given information, in this example you get adjustments only for that product, but if the user is paying with Credit Card, must define the payment method in the query.
mutation validateTransaction($validate: ValidateTransactionInput!) {
transactions {
validate(input: $validate) {
grossTotal
adjustments {
name
amount
total
rateMode
isDiscount
}
total
}
}
}
{
"validate": {
"product": "ji12sd4c0a3D0=",
"paymentMethod": "CREDIT_CARD",
"inputs": {"accountNumber": "+13051231234"}
}
}
{
"data": {
"transactions": {
"validate": {
"grossTotal": 50,
"adjustments": [
{
"name": "E911 User Fee",
"amount": 0.4,
"total": 0.4,
"rateMode": false,
"isDiscount": false
},
{
"name": "Issuance Fee",
"amount": 2,
"total": 1,
"rateMode": true,
"isDiscount": false
}
],
"total": 51.4
}
}
}
}
As you can see in the above example the Issuance Fee
has been added to the transaction because the merchant
has a specific fee for credit card transactions.
Some merchants specify a different fee for Credit Card with Card Present and Card Not Present transactions.
In order to get the correct fee, if you are processing a Card Present transaction ensure you set the magData
in the transaction to verify applicable fees.
Example:
mutation validateTransaction($validate: ValidateTransactionInput!) {
transactions {
validate(input: $validate) {
grossTotal
adjustments {
name
amount
total
rateMode
isDiscount
}
total
}
}
}
{
"validate": {
"product": "ji12sd4c0a3D0=",
"paymentMethod": "CREDIT_CARD",
"creditCard": {
"magData": ";5301250070000191=08051010912345678901?3"
},
"inputs": {"accountNumber": "+13051231234"}
}
}
{
"data": {
"transactions": {
"validate": {
"grossTotal": 50,
"adjustments": [
{
"name": "E911 User Fee",
"amount": 0.4,
"total": 0.4,
"rateMode": false,
"isDiscount": false
},
{
"name": "Issuance Fee",
"amount": 1,
"total": 0.5,
"rateMode": true,
"isDiscount": false
}
],
"total": 50.9
}
}
}
}