Making an AuthOnly transaction and Completing the Sale with Tip

Use Cases

  • Most commonly used in restaurants or QSR (quick service restaurants) where customers pay for their order, the card is charged for the initial amount and then the customer has the option to leave a tip.
  • Service industries such as Salons also tend to use the tip adjustment feature.

This is a typical way to make a tip adjustment for a restaurant scenario where you authorize (hold) an amount first, and then make a final sale completion along with the tip adjustment. Any AuthOnly transaction must be followed by a Sale Completion transaction. Otherwise, the AuthOnly transaction will be removed after 7 days.

  • Setup a POST /payment either with a Keyed or Swiped transaction and add the AuthOnly=true field. This indicates to do an AuthOnly payment and a Sale Completion will be followed with a tip adjustment.
  • Complete the sale with AuthOnly=false, add tip the field, then adjust the total amount to include the tip amount, and finally and most importantly use the previous card account token. Using the previous card account token lets the API know which AuthOnly transaction this sale is for. Otherwise, a new regular sale transaction is created.

Step 1

POST a payment with authOnly set to True

Request URL:https://sandbox.api.mxmerchant.com/checkout/v3/payment?echo=true
Request Method:POST
Authorization:Basic xxxxxxxxxxxxxxxxxxxxxxxx1NQ==
Content-Type:application/json
{
   merchantId :”xxx12345",
   tenderType :"Card",
   amount :"0.01",
   authOnly: true,
   cardAccount :{
       number : “xxxxxxxxxxxxxxxxxx4618",
       expiryMonth : "06",
       expiryyear : "2022",
       cvv : "019",
       avsZip : "30004",
       avsStreet: "2001 Westside"
       }
}
{
	"created": "2014-07-17T17:53:48.74Z",
	"paymentToken": "PZxxxxxxxxxxxxxxxxxxxxxFtYz",
	"id": 2125085,
	"creatorName": "Erick Nguyen",
	"merchantId": xxx12345,
	"tenderType": "Card",
	"currency": "USD",
	"amount": "0.01",
	"meta": "",
	"cardAccount": {
		"hash": "4hhexxxxxxxxxxxxxxxxxxxxxxxxxxxh1I=",
		"cardType": "MasterCard",
		"entryMode": "Keyed",
		"last4": "4618",
		"token": "PZxxxxxxxxxxxxxxxxlMDoPxFtYz",
		"expiryMonth": "06",
		"expiryYear": "22"
	},
	"authOnly": true,
	"authCode": "025349",
	"status": "Approved",
	"fraudScoreMeta": {
		"cvvResponse":"M",
		"avsResponse":"N"
  },
	"requireSignature": false,
	"customerMatches": [],
	"settledAmount": "0",
	"settledCurrency": "USD",
	"cardPresent": false,
	"referenceNumber": "00C9700APHIS",
	"purchases": [],
	"iccRequestData": "",
	"refundedAmount": "0"
}

Step 2

Complete the Sale with a tip adjustment

Request URL:https://sandbox.api.mxmerchant.com/checkout/v3/payment?echo=true
Request Method:POST
Authorization:Basic xxxxxxxxxxxxxxxxxxxxxxxx1NQ==
Content-Type:application/json
{
	merchantId: “xxx12345",
        paymentToken: "PZxxxxxxxxxxxxxxxxxxxxxFtYz",
	tenderType: "Card",
	tip: "0.01",
	amount: "0.02",
 	authCode: "025349",
	authOnly: false,
}
{
	"created": "2014-07-17T18:04:01.457Z",
	"paymentToken": "PvxxxxxxxxxxxxxxxxxxxGFWq",
	"id": 2125266,
	"creatorName": “Erick Nguyen",
	"merchantId": xxx12345,
	"tenderType": "Card",
	"currency": "USD",
	"amount": "0.02",
	"tip": "0.01",
	"meta": "",
	"cardAccount": {
		"hash": “4hhe/xxxxxxxxxxxxxxxxxxxxx/49w3Poh1I=",
		"cardType": "MasterCard",
		"entryMode": "Keyed",
		"last4": "4618",
		"token": "PvKxxxxxxxxxxxxxxxxxxxH8GFWq",
		"expiryMonth": "06",
		"expiryYear": "22"
	},
	"authOnly": false,
	"authCode": "077922",
	"status": "Approved",
	"fraudScoreMeta": "{}",
	"requireSignature": false,
	"customerMatches": [],
	"settledAmount": "0",
	"settledCurrency": "USD",
	"cardPresent": false,
	"referenceNumber": "00C9L006RRQV",
	"purchases": [],
	"iccRequestData": "",
	"refundedAmount": "0"
}