Making a Payment

Once a payment instrument has been tokenized the payment token (instrumentId) can be used to make a payment through our APIs. The instrumentId representing the tokenized instrument can be used to make payments in the same way regardless of the payment method the token represents.
The payments API will also be used to handle payments for your registered as well as guest customers.

Transaction Types

When making a payment you have the option to apply two different transaction types depending on your business's requirements and use cases.

Pre-auth

The Pre-auth flow allows you to make a purchase and reserve the funds on the customer's card and complete the transaction at a later stage to take the funds or should the need arise voids the full transaction amount. Once a transaction has been completed it can be refunded for either part of or the full transaction amount.

๐Ÿ“˜

Preauth Flow

Pre-authorisation is only applicable to debit and credit cards either in the Wpay wallet and some gift card programs.

Purchase

The Purchase flow allows you to process a transaction where the funds on the customer's card are taken immediately. Once a purchase has been successfully processed you can use refund to refund either part of or the full transaction amount.

Make a Payment

To submit a payment request using an Instrument Id generated during the tokenization process, please call the Payment API below.

curl --location --request POST 'https://{{environment}}.wpay.com.au/wow/v1/pay/instore/customer/payments' \
--header 'X-Api-Key: {{yourAPIKey}}' \
--header 'Authorization: Bearer {{yourBearerToken}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "data": {
    "transactionType": {
      "creditCard": "PREAUTH",
      "giftCard": "PURCHASE",
      "payPal": "PURCHASE",
      "googlePay": {
        "creditCard": "PREAUTH",
        "debitCard": "PURCHASE"
      },
      "applePay": {
        "creditCard": "PREAUTH",
        "debitCard": "PURCHASE"
      }
    },
    "clientReference": "UNIQUE_CLIENT_REFERENCE",
    "orderNumber": "UNIQUE_ORDER_NO",
    "shippingAddress": {
			"firstName": "John",
			"lastName": "Doe",
			"company": "Wpay",
			"extendedAddress": "4th Floor",
			"streetAddress": "407 Elizabeth Street",
			"suburb": "Surry Hills",
			"stateOrTerritory": "NSW",
			"postalCode": "2010",
			"countryCode": "AU"
		},
    "payments": [
      {
        "paymentInstrumentId": "213553",
        "amount": 10.5
      },
       {
        "paymentInstrumentId": "215319",
        "amount": 6.5
      }
    ]
  },
  "meta": {
    "fraud": {
        "provider": "cybersource",
        "version": "CyberSourceTransaction_1.101",
        "format": "XML",
        "responseFormat": "XML",
        "message": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<RequestMessage xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n  <merchantID>TEST_MERCHANT_ID</merchantID>\r\n  <merchantReferenceCode>1234-26IO8JUN</merchantReferenceCode>\r\n  <billTo>\r\n    <firstName>Jane</firstName>\r\n    <lastName>Doe</lastName>\r\n    <street1>407 ELIZABETH STREET</street1>\r\n    <city>SURRY HILLS</city>\r\n    <state>NSW</state>\r\n    <postalCode>2199</postalCode>\r\n    <country>AU</country>\r\n    <phoneNumber>0400000000</phoneNumber>\r\n    <email>[email protected]</email>\r\n    <ipAddress>202.39.111.236</ipAddress>\r\n    <dateOfBirth>1987-02-14</dateOfBirth>\r\n    <customerID>3732442</customerID>\r\n  </billTo>\r\n  <shipTo>\r\n    <firstName>Jane</firstName>\r\n    <lastName>Doe</lastName>\r\n    <phoneNumber>0400000000</phoneNumber>\r\n    <email>[email protected]</email>\r\n  </shipTo>\r\n  <item id=\"0\">\r\n    <unitPrice>7.59</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Mccain Protein Plus Frozen Meal Satay Chicken</productName>\r\n    <productSKU>483660</productSKU>\r\n  </item>\r\n  <item id=\"1\">\r\n    <unitPrice>2.00</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Habee Savers Needles Household Repair</productName>\r\n    <productSKU>159489</productSKU>\r\n  </item>\r\n  <item id=\"2\">\r\n    <unitPrice>6.60</unitPrice>\r\n    <quantity>5</quantity>\r\n    <productName>Chicken Breast Fillet Skinless Small</productName>\r\n    <productSKU>118963</productSKU>\r\n  </item>\r\n  <item id=\"3\">\r\n    <unitPrice>5.43</unitPrice>\r\n    <quantity>5</quantity>\r\n    <productName>Chicken Drumsticks </productName>\r\n    <productSKU>169014</productSKU>\r\n  </item>\r\n  <item id=\"4\">\r\n    <unitPrice>3.50</unitPrice>\r\n    <quantity>4</quantity>\r\n    <productName>Chicken Thigh Cutlets Skinless</productName>\r\n    <productSKU>166830</productSKU>\r\n  </item>\r\n  <item id=\"5\">\r\n    <unitPrice>10.80</unitPrice>\r\n    <quantity>4</quantity>\r\n    <productName>Lamb Diced Heart Smart</productName>\r\n    <productSKU>208970</productSKU>\r\n  </item>\r\n  <item id=\"6\">\r\n    <unitPrice>4.94</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Macro Chicken Lovely Legs Free Range</productName>\r\n    <productSKU>700257</productSKU>\r\n  </item>\r\n  <item id=\"7\">\r\n    <unitPrice>19.64</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Macro Organic Whole Chicken</productName>\r\n    <productSKU>229320</productSKU>\r\n  </item>\r\n  <item id=\"8\">\r\n    <unitPrice>9.60</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Msa Australian Beef Steak Porterhouse</productName>\r\n    <productSKU>208988</productSKU>\r\n  </item>\r\n  <item id=\"9\">\r\n    <unitPrice>15.20</unitPrice>\r\n    <quantity>3</quantity>\r\n    <productName>Roast Pork Shoulder Boneless Small</productName>\r\n    <productSKU>203420</productSKU>\r\n  </item>\r\n  <item id=\"10\">\r\n    <unitPrice>10.80</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Select Corned Beef Silverside </productName>\r\n    <productSKU>148345</productSKU>\r\n  </item>\r\n  <item id=\"11\">\r\n    <unitPrice>13.00</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Clairol Nice N Easy 114a Natural Lightest Golden Brown</productName>\r\n    <productSKU>226536</productSKU>\r\n  </item>\r\n  <purchaseTotals>\r\n    <currency>AUD</currency>\r\n    <grandTotalAmount>298.09</grandTotalAmount>\r\n  </purchaseTotals>\r\n  <merchantDefinedData>\r\n    <mddField id=\"19\">Pickup</mddField>\r\n    <mddField id=\"10\">NO</mddField>\r\n    <mddField id=\"3\">Woolworths WOLLI CREEK, WOLLI CREEK</mddField>\r\n    <mddField id=\"1\">2017-09-22 16:00</mddField>\r\n    <mddField id=\"2\">NSW</mddField>\r\n    <mddField id=\"12\">NO</mddField>\r\n    <mddField id=\"16\">103</mddField>\r\n    <mddField id=\"23\"></mddField>\r\n    <mddField id=\"17\">2017-09-18 12:40</mddField>\r\n    <mddField id=\"18\">2017-09-18 12:40</mddField>\r\n    <mddField id=\"25\">2017-09-22 16:00</mddField>\r\n    <mddField id=\"20\">WEB</mddField>\r\n    <mddField id=\"57\">Normal</mddField>\r\n    <mddField id=\"58\"></mddField>\r\n    <mddField id=\"59\" />\r\n    <mddField id=\"60\">298.09</mddField>\r\n  </merchantDefinedData>\r\n  <afsService run=\"true\" />\r\n  <deviceFingerprintID>18S###-26IO####</deviceFingerprintID>\r\n</RequestMessage>"
    },
    "challengeResponses": [
      {
        "instrumentId": "213553",
        "type": "STEP_UP",
        "token": "55bda344-c0ec-####-####-############"
      },
      {
        "instrumentId": "213553",
        "type": "DEVICE_DATA",
        "token": "<deviceData>"
      }
    ]
  }
}'
var myHeaders = new Headers();
var environment = "substitute environment-value here"
var yourAPIkey = "YOUR-API-KEY";
var accessToken = "ACCESS-TOKEN";
myHeaders.append("Content-Type", "application/json");
myHeaders.append("X-Api-Key", yourAPIkey);
myHeaders.append("Authorization", `Bearer ${accessToken}`);

var raw = JSON.stringify({
  "data": {
    "transactionType": {
      "creditCard": "PREAUTH",
      "giftCard": "PURCHASE",
      "payPal": "PURCHASE",
      "googlePay": {
        "creditCard": "PREAUTH",
        "debitCard": "PURCHASE"
      },
      "applePay": {
        "creditCard": "PREAUTH",
        "debitCard": "PURCHASE"
      }
    },
    "clientReference": "UNIQUE_CLIENT_REFERENCE",
    "orderNumber": "UNIQUE_ORDER_NO",
    "shippingAddress": {
			"firstName": "John",
			"lastName": "Doe",
			"company": "Wpay",
			"extendedAddress": "4th Floor",
			"streetAddress": "407 Elizabeth Street",
			"suburb": "Surry Hills",
			"stateOrTerritory": "NSW",
			"postalCode": "2010",
			"countryCode": "AU"
		},
    "payments": [
      {
        "paymentInstrumentId": "213553",
        "amount": 10.5
      },
       {
        "paymentInstrumentId": "215319",
        "amount": 6.5
      }
    ]
  },
  "meta": {
    "fraud": {
        "provider": "cybersource",
        "version": "CyberSourceTransaction_1.101",
        "format": "XML",
        "responseFormat": "XML",
        "message": "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<RequestMessage xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n  <merchantID>woolworths_online</merchantID>\r\n  <merchantReferenceCode>1234-26IO8JUN</merchantReferenceCode>\r\n  <billTo>\r\n    <firstName>Raja</firstName>\r\n    <lastName>Saravanan</lastName>\r\n    <street1>210</street1>\r\n    <city>MINTO</city>\r\n    <state>NSW</state>\r\n    <postalCode>2566</postalCode>\r\n    <country>AU</country>\r\n    <phoneNumber>0469813438</phoneNumber>\r\n    <email>[email protected]</email>\r\n    <ipAddress>202.39.218.236</ipAddress>\r\n    <dateOfBirth>1987-02-14</dateOfBirth>\r\n    <customerID>3732442</customerID>\r\n  </billTo>\r\n  <shipTo>\r\n    <firstName>Raja</firstName>\r\n    <lastName>Saravanan</lastName>\r\n    <phoneNumber>0442911234</phoneNumber>\r\n    <email>[email protected]</email>\r\n  </shipTo>\r\n  <item id=\"0\">\r\n    <unitPrice>7.59</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Mccain Protein Plus Frozen Meal Satay Chicken</productName>\r\n    <productSKU>483660</productSKU>\r\n  </item>\r\n  <item id=\"1\">\r\n    <unitPrice>2.00</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Habee Savers Needles Household Repair</productName>\r\n    <productSKU>159489</productSKU>\r\n  </item>\r\n  <item id=\"2\">\r\n    <unitPrice>6.60</unitPrice>\r\n    <quantity>5</quantity>\r\n    <productName>Chicken Breast Fillet Skinless Small</productName>\r\n    <productSKU>118963</productSKU>\r\n  </item>\r\n  <item id=\"3\">\r\n    <unitPrice>5.43</unitPrice>\r\n    <quantity>5</quantity>\r\n    <productName>Chicken Drumsticks </productName>\r\n    <productSKU>169014</productSKU>\r\n  </item>\r\n  <item id=\"4\">\r\n    <unitPrice>3.50</unitPrice>\r\n    <quantity>4</quantity>\r\n    <productName>Chicken Thigh Cutlets Skinless</productName>\r\n    <productSKU>166830</productSKU>\r\n  </item>\r\n  <item id=\"5\">\r\n    <unitPrice>10.80</unitPrice>\r\n    <quantity>4</quantity>\r\n    <productName>Lamb Diced Heart Smart</productName>\r\n    <productSKU>208970</productSKU>\r\n  </item>\r\n  <item id=\"6\">\r\n    <unitPrice>4.94</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Macro Chicken Lovely Legs Free Range</productName>\r\n    <productSKU>700257</productSKU>\r\n  </item>\r\n  <item id=\"7\">\r\n    <unitPrice>19.64</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Macro Organic Whole Chicken</productName>\r\n    <productSKU>229320</productSKU>\r\n  </item>\r\n  <item id=\"8\">\r\n    <unitPrice>9.60</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Msa Australian Beef Steak Porterhouse</productName>\r\n    <productSKU>208988</productSKU>\r\n  </item>\r\n  <item id=\"9\">\r\n    <unitPrice>15.20</unitPrice>\r\n    <quantity>3</quantity>\r\n    <productName>Roast Pork Shoulder Boneless Small</productName>\r\n    <productSKU>203420</productSKU>\r\n  </item>\r\n  <item id=\"10\">\r\n    <unitPrice>10.80</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Select Corned Beef Silverside </productName>\r\n    <productSKU>148345</productSKU>\r\n  </item>\r\n  <item id=\"11\">\r\n    <unitPrice>13.00</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Clairol Nice N Easy 114a Natural Lightest Golden Brown</productName>\r\n    <productSKU>226536</productSKU>\r\n  </item>\r\n  <purchaseTotals>\r\n    <currency>AUD</currency>\r\n    <grandTotalAmount>298.09</grandTotalAmount>\r\n  </purchaseTotals>\r\n  <merchantDefinedData>\r\n    <mddField id=\"19\">Pickup</mddField>\r\n    <mddField id=\"10\">NO</mddField>\r\n    <mddField id=\"3\">Woolworths WOLLI CREEK, WOLLI CREEK</mddField>\r\n    <mddField id=\"1\">2017-09-22 16:00</mddField>\r\n    <mddField id=\"2\">NSW</mddField>\r\n    <mddField id=\"12\">NO</mddField>\r\n    <mddField id=\"16\">103</mddField>\r\n    <mddField id=\"23\"></mddField>\r\n    <mddField id=\"17\">2017-09-18 12:40</mddField>\r\n    <mddField id=\"18\">2017-09-18 12:40</mddField>\r\n    <mddField id=\"25\">2017-09-22 16:00</mddField>\r\n    <mddField id=\"20\">WEB</mddField>\r\n    <mddField id=\"57\">Normal</mddField>\r\n    <mddField id=\"58\"></mddField>\r\n    <mddField id=\"59\" />\r\n    <mddField id=\"60\">298.09</mddField>\r\n  </merchantDefinedData>\r\n  <afsService run=\"true\" />\r\n  <deviceFingerprintID>18SJBB-26IO8JUN</deviceFingerprintID>\r\n</RequestMessage>"
    },
    "challengeResponses": [
      {
        "instrumentId": "213553",
        "type": "STEP_UP",
        "token": "55bda344-c0ec-####-####-############"
      },
      {
        "instrumentId": "213553",
        "type": "DEVICE_DATA",
        "token": "<deviceData>"
      }
    ]
  }
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch(`https://${environment}.wpay.com.au/wow/v1/pay/instore/customer/payments`, requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

let yourAPIkey = "YOUR-API-KEY";
let environment = "substitute environment-value here"
let accessToken = "ACCESS-TOKEN";
let parameters = """
{\
	\"data\": {\
    \"transactionType\": {\
      \"creditCard\": \"PREAUTH\",\
      \"giftCard\": \"PURCHASE\",\
      \"payPal\": \"PURCHASE\",\
      \"googlePay\": {\
        \"creditCard\": \"PREAUTH\",\
        \"debitCard\": \"PURCHASE\"\
      },\
      \"applePay\": {\
        \"creditCard\": \"PREAUTH\",\
        \"debitCard\": \"PURCHASE\"\
      }\
    },\
    \"clientReference\": \"UNIQUE_CLIENT_REFERENCE\",\
    \"orderNumber\": \"UNIQUE_ORDER_NO\",\
		\"shippingAddress\": {\
			"firstName\": \"John\",\
			\"lastName\": \"Doe\",\
			\"company\": \"Wpay\",\
			\"extendedAddress\": \"4th Floor\",\
			\"streetAddress\": \"407 Elizabeth Street\",\
			\"suburb\": \"Surry Hills\",\
			\"stateOrTerritory\": \"NSW\",\
			\"postalCode\": \"2010\",\
			\"countryCode\": \"AU\"\
		},\
    \"payments\": [\
      {\
        \"paymentInstrumentId\": \"213553\",\
        \"amount\": 10.5\
      },\
       {\
        \"paymentInstrumentId\": \"215319\",\
        \"amount\": 6.5\
      }\
    ]\
  },\
  \"meta\": {\
    \"fraud\": {\
        \"provider\": \"cybersource\",\
        \"version\": \"CyberSourceTransaction_1.101\",\
        \"format\": \"XML\",\
        \"responseFormat\": \"XML\",\
        \"message\": \"<?xml version=\\"1.0\\" encoding=\\"Windows-1252\\"?>\r\n<RequestMessage xmlns:xsd=\\"http://www.w3.org/2001/XMLSchema\\" xmlns:xsi=\\"http://www.w3.org/2001/XMLSchema-instance\\">\r\n  <merchantID>woolworths_online</merchantID>\r\n  <merchantReferenceCode>1234-26IO8JUN</merchantReferenceCode>\r\n  <billTo>\r\n    <firstName>Raja</firstName>\r\n    <lastName>Saravanan</lastName>\r\n    <street1>210</street1>\r\n    <city>MINTO</city>\r\n    <state>NSW</state>\r\n    <postalCode>2566</postalCode>\r\n    <country>AU</country>\r\n    <phoneNumber>0469813438</phoneNumber>\r\n    <email>[email protected]</email>\r\n    <ipAddress>202.39.218.236</ipAddress>\r\n    <dateOfBirth>1987-02-14</dateOfBirth>\r\n    <customerID>3732442</customerID>\r\n  </billTo>\r\n  <shipTo>\r\n    <firstName>Raja</firstName>\r\n    <lastName>Saravanan</lastName>\r\n    <phoneNumber>0442911234</phoneNumber>\r\n    <email>[email protected]</email>\r\n  </shipTo>\r\n  <item id=\\"0\\">\r\n    <unitPrice>7.59</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Mccain Protein Plus Frozen Meal Satay Chicken</productName>\r\n    <productSKU>483660</productSKU>\r\n  </item>\r\n  <item id=\\"1\\">\r\n    <unitPrice>2.00</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Habee Savers Needles Household Repair</productName>\r\n    <productSKU>159489</productSKU>\r\n  </item>\r\n  <item id=\\"2\\">\r\n    <unitPrice>6.60</unitPrice>\r\n    <quantity>5</quantity>\r\n    <productName>Chicken Breast Fillet Skinless Small</productName>\r\n    <productSKU>118963</productSKU>\r\n  </item>\r\n  <item id=\\"3\\">\r\n    <unitPrice>5.43</unitPrice>\r\n    <quantity>5</quantity>\r\n    <productName>Chicken Drumsticks </productName>\r\n    <productSKU>169014</productSKU>\r\n  </item>\r\n  <item id=\\"4\\">\r\n    <unitPrice>3.50</unitPrice>\r\n    <quantity>4</quantity>\r\n    <productName>Chicken Thigh Cutlets Skinless</productName>\r\n    <productSKU>166830</productSKU>\r\n  </item>\r\n  <item id=\\"5\\">\r\n    <unitPrice>10.80</unitPrice>\r\n    <quantity>4</quantity>\r\n    <productName>Lamb Diced Heart Smart</productName>\r\n    <productSKU>208970</productSKU>\r\n  </item>\r\n  <item id=\\"6\\">\r\n    <unitPrice>4.94</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Macro Chicken Lovely Legs Free Range</productName>\r\n    <productSKU>700257</productSKU>\r\n  </item>\r\n  <item id=\\"7\\">\r\n    <unitPrice>19.64</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Macro Organic Whole Chicken</productName>\r\n    <productSKU>229320</productSKU>\r\n  </item>\r\n  <item id=\\"8\\">\r\n    <unitPrice>9.60</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Msa Australian Beef Steak Porterhouse</productName>\r\n    <productSKU>208988</productSKU>\r\n  </item>\r\n  <item id=\\"9\\">\r\n    <unitPrice>15.20</unitPrice>\r\n    <quantity>3</quantity>\r\n    <productName>Roast Pork Shoulder Boneless Small</productName>\r\n    <productSKU>203420</productSKU>\r\n  </item>\r\n  <item id=\\"10\\">\r\n    <unitPrice>10.80</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Select Corned Beef Silverside </productName>\r\n    <productSKU>148345</productSKU>\r\n  </item>\r\n  <item id=\\"11\\">\r\n    <unitPrice>13.00</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Clairol Nice N Easy 114a Natural Lightest Golden Brown</productName>\r\n    <productSKU>226536</productSKU>\r\n  </item>\r\n  <purchaseTotals>\r\n    <currency>AUD</currency>\r\n    <grandTotalAmount>298.09</grandTotalAmount>\r\n  </purchaseTotals>\r\n  <merchantDefinedData>\r\n    <mddField id=\\"19\\">Pickup</mddField>\r\n    <mddField id=\\"10\\">NO</mddField>\r\n    <mddField id=\\"3\\">Woolworths WOLLI CREEK, WOLLI CREEK</mddField>\r\n    <mddField id=\\"1\\">2017-09-22 16:00</mddField>\r\n    <mddField id=\\"2\\">NSW</mddField>\r\n    <mddField id=\\"12\\">NO</mddField>\r\n    <mddField id=\\"16\\">103</mddField>\r\n    <mddField id=\\"23\\"></mddField>\r\n    <mddField id=\\"17\\">2017-09-18 12:40</mddField>\r\n    <mddField id=\\"18\\">2017-09-18 12:40</mddField>\r\n    <mddField id=\\"25\\">2017-09-22 16:00</mddField>\r\n    <mddField id=\\"20\\">WEB</mddField>\r\n    <mddField id=\\"57\\">Normal</mddField>\r\n    <mddField id=\\"58\\"></mddField>\r\n    <mddField id=\\"59\\" />\r\n    <mddField id=\\"60\\">298.09</mddField>\r\n  </merchantDefinedData>\r\n  <afsService run=\\"true\\" />\r\n  <deviceFingerprintID>18SJBB-26IO8JUN</deviceFingerprintID>\r\n</RequestMessage>\"\
    },\
    \"challengeResponses\": [\
      {\
        \"instrumentId\": \"213553\",\
        \"type\": \"STEP_UP\",\
        \"token\": \"55bda344-c0ec-####-####-############\"\
      },\
      {\
        \"instrumentId\": \"213553\",\
        \"type\": \"DEVICE_DATA\",\
        \"token\": \"<deviceData>\"\
      }\
    ]\
  }\
}\
"""
let postData = parameters.data(using: .utf8)

var request = URLRequest(
  url: URL(string: "https://\(environment).wpay.com.au/wow/v1/pay/instore/customer/payments")!,
  timeoutInterval: Double.infinity
)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue(yourAPIkey, forHTTPHeaderField: "X-Api-Key")
request.addValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()
var environment = "substitute environment-value here"
var yourAPIkey = "YOUR-API-KEY";
var accessToken = "ACCESS-TOKEN";
      
val response = khttp.post(
  url = "https://$environment" + 
        ".wpay.com.au/wow/v1/pay/instore/customer/payments",
  headers = mapOf("Content-Type" to "application/json",
                  "X-Api-Key" to yourAPIkey,
                  "Authorization" to "Bearer $accessToken"),
  json = mapOf(
    "data" to mapOf(
      "transactionType" to mapOf(
        "creditCard" to "PREAUTH",
      	"giftCard" to "PURCHASE",
      	"payPal" to "PURCHASE",
      	"googlePay" to mapOf(
          "creditCard" to "PREAUTH",
        	"debitCard" to "PURCHASE"
      	),
        "applePay" to mapOf(
          "creditCard" to "PREAUTH",
          "debitCard" to "PURCHASE"
        )
    	),
      "clientReference" to "UNIQUE_CLIENT_REFERENCE",
      "orderNumber" to "UNIQUE_ORDER_NO",
      "shippingAddress" to mapOf (
				"firstName" to "John",
			  "lastName" to "Doe",
			  "company" to "Wpay",
			  "extendedAddress" to  "4th Floor",
			  "streetAddress" to "407 Elizabeth Street",
			  "suburb" to "Surry Hills",
			  "stateOrTerritory" to "NSW",
			  "postalCode" to "2010",
			  "countryCode" to "AU"
		  ),
      "payments" to arrayOf(
        mapOf(
          "paymentInstrumentId" to "213553",
          "amount" to 10.5
        ),
        mapOf(
          "paymentInstrumentId" to "215319",
          "amount" to 6.5
        )
      )
    ),
    "meta" to mapOf(
      "fraud" to mapOf(
          "provider" to "cybersource",
          "version" to "CyberSourceTransaction_1.101",
          "format" to "XML",
          "responseFormat" to "XML",
          "message" to "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n<RequestMessage xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n  <merchantID>woolworths_online</merchantID>\r\n  <merchantReferenceCode>1234-26IO8JUN</merchantReferenceCode>\r\n  <billTo>\r\n    <firstName>Raja</firstName>\r\n    <lastName>Saravanan</lastName>\r\n    <street1>210</street1>\r\n    <city>MINTO</city>\r\n    <state>NSW</state>\r\n    <postalCode>2566</postalCode>\r\n    <country>AU</country>\r\n    <phoneNumber>0469813438</phoneNumber>\r\n    <email>[email protected]</email>\r\n    <ipAddress>202.39.218.236</ipAddress>\r\n    <dateOfBirth>1987-02-14</dateOfBirth>\r\n    <customerID>3732442</customerID>\r\n  </billTo>\r\n  <shipTo>\r\n    <firstName>Raja</firstName>\r\n    <lastName>Saravanan</lastName>\r\n    <phoneNumber>0442911234</phoneNumber>\r\n    <email>[email protected]</email>\r\n  </shipTo>\r\n  <item id=\"0\">\r\n    <unitPrice>7.59</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Mccain Protein Plus Frozen Meal Satay Chicken</productName>\r\n    <productSKU>483660</productSKU>\r\n  </item>\r\n  <item id=\"1\">\r\n    <unitPrice>2.00</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Habee Savers Needles Household Repair</productName>\r\n    <productSKU>159489</productSKU>\r\n  </item>\r\n  <item id=\"2\">\r\n    <unitPrice>6.60</unitPrice>\r\n    <quantity>5</quantity>\r\n    <productName>Chicken Breast Fillet Skinless Small</productName>\r\n    <productSKU>118963</productSKU>\r\n  </item>\r\n  <item id=\"3\">\r\n    <unitPrice>5.43</unitPrice>\r\n    <quantity>5</quantity>\r\n    <productName>Chicken Drumsticks </productName>\r\n    <productSKU>169014</productSKU>\r\n  </item>\r\n  <item id=\"4\">\r\n    <unitPrice>3.50</unitPrice>\r\n    <quantity>4</quantity>\r\n    <productName>Chicken Thigh Cutlets Skinless</productName>\r\n    <productSKU>166830</productSKU>\r\n  </item>\r\n  <item id=\"5\">\r\n    <unitPrice>10.80</unitPrice>\r\n    <quantity>4</quantity>\r\n    <productName>Lamb Diced Heart Smart</productName>\r\n    <productSKU>208970</productSKU>\r\n  </item>\r\n  <item id=\"6\">\r\n    <unitPrice>4.94</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Macro Chicken Lovely Legs Free Range</productName>\r\n    <productSKU>700257</productSKU>\r\n  </item>\r\n  <item id=\"7\">\r\n    <unitPrice>19.64</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Macro Organic Whole Chicken</productName>\r\n    <productSKU>229320</productSKU>\r\n  </item>\r\n  <item id=\"8\">\r\n    <unitPrice>9.60</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Msa Australian Beef Steak Porterhouse</productName>\r\n    <productSKU>208988</productSKU>\r\n  </item>\r\n  <item id=\"9\">\r\n    <unitPrice>15.20</unitPrice>\r\n    <quantity>3</quantity>\r\n    <productName>Roast Pork Shoulder Boneless Small</productName>\r\n    <productSKU>203420</productSKU>\r\n  </item>\r\n  <item id=\"10\">\r\n    <unitPrice>10.80</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Select Corned Beef Silverside </productName>\r\n    <productSKU>148345</productSKU>\r\n  </item>\r\n  <item id=\"11\">\r\n    <unitPrice>13.00</unitPrice>\r\n    <quantity>2</quantity>\r\n    <productName>Clairol Nice N Easy 114a Natural Lightest Golden Brown</productName>\r\n    <productSKU>226536</productSKU>\r\n  </item>\r\n  <purchaseTotals>\r\n    <currency>AUD</currency>\r\n    <grandTotalAmount>298.09</grandTotalAmount>\r\n  </purchaseTotals>\r\n  <merchantDefinedData>\r\n    <mddField id=\"19\">Pickup</mddField>\r\n    <mddField id=\"10\">NO</mddField>\r\n    <mddField id=\"3\">Woolworths WOLLI CREEK, WOLLI CREEK</mddField>\r\n    <mddField id=\"1\">2017-09-22 16:00</mddField>\r\n    <mddField id=\"2\">NSW</mddField>\r\n    <mddField id=\"12\">NO</mddField>\r\n    <mddField id=\"16\">103</mddField>\r\n    <mddField id=\"23\"></mddField>\r\n    <mddField id=\"17\">2017-09-18 12:40</mddField>\r\n    <mddField id=\"18\">2017-09-18 12:40</mddField>\r\n    <mddField id=\"25\">2017-09-22 16:00</mddField>\r\n    <mddField id=\"20\">WEB</mddField>\r\n    <mddField id=\"57\">Normal</mddField>\r\n    <mddField id=\"58\"></mddField>\r\n    <mddField id=\"59\" />\r\n    <mddField id=\"60\">298.09</mddField>\r\n  </merchantDefinedData>\r\n  <afsService run=\"true\" />\r\n  <deviceFingerprintID>18SJBB-26IO8JUN</deviceFingerprintID>\r\n</RequestMessage>"
      ),
      "challengeResponses" to arrayOf(
        mapOf(
          "instrumentId" to "213553",
          "type" to "STEP_UP",
          "token" to "55bda344-c0ec-####-####-############"
        ),
        mapOf(
          "instrumentId" to "213553",
          "type" to "DEVICE_DATA",
          "token" to "<deviceData>"
        )
      )
    )
  )
)

if(response.statusCode == 200) {
  val obj : JSONObject = response.jsonObject
    print(obj["allowedPaymentMethods"])
} else {
  handleError(response)
}

Where:

  • transactionType is the method by which you want to process the transaction, either as a pre-auth or as a straight purchase.
  • clientReference is your application specific reference number. This number should uniquely identify the transaction in your system
  • orderNumber is your order number of the transaction as generated during the order creation.
  • shippingAddress is the customer's shipping address.
  • paymentInstrumentId is the tokenized payment instrument with which you want to make the payment. This is either from the frames SDK response or the list payment instruments response.
  • fraud is the CyberSource fraud payload for the transaction. Please see Fraud Detection for more information around the fraud payload.
  • challengeResponses contains the payment challenge data such as the step-up token for CVV capture or PayPal Seller Protection deviceData. See PayPal Seller Protection for more information.

Split Payments

Wpay also supports split payments across multiple instruments in our Payments API. When you choose to enable this option in your store, the customer may be presented a checkout page with all available payment instruments and this allows them to pay using some or all instruments in a single payment request.

Supported schemes:

  • Payment split across multiple debit/credit cards.
  • Payment split across multiple gift cards.
  • Payment split across multiple debit/credit cards + multiple gift cards.

๐Ÿ“˜

A note on Split Payments

If part of the split payment is rejected (e.g. not enough funds in one of the gift cards), Wpay will return partialSuccess as true in the payment response. Wpay will attempt to roll back the already completed transactions and the status of this rollback can be seen in the rollback field. Should this be FAILED you will need to work out how to handle this as part of your process internally. Some possible options would be to submit a Refund or Void payment requests or manually handling the partial rejection through manual process.

Challenge Responses During Payments

A challenge-response may be required during payments based on various factors such as the payment instrument type being used or whether 3DS has been invoked.

Step Up Tokens

A step up token is a token linked to the CVV which is captured as part of the card tokenization process. CVV's are not stored within the vault due to PCI compliance legislation and as such a temporary token is given when a CVV is captured. See the Step Up Token Process for more information on generating a step up token.

A step up token is usually required:

  • On un-verified cards i.e. on cards where a transaction has not yet been completed (either a $0.01 pre-auth or a full transaction).
  • Where your merchant settings indicate that a CVV is always required.
  • When setting up a payment agreement (recurring payment).

A step up token is not required:

  • For a short period after the card has been captured and tokenized as the step-up token from the card capture will still be valid.
  • When your merchant settings indicate that a CVV is not required on verified cards saved in your customer's wallets.
  • When charging a payment agreement as part of a recurring payment.

๐Ÿ“˜

3DS2 Integration

If you are interested in 3DS2, please review the 3D Secure (3DS).

Transaction Outcomes

After a payment has been processed you will receive a detailed response showing the outcome of the payment request.

{
    "data": {
        "transactionId": "75a37436-6f59-475c-b915-b370ab5bf513",
        "paymentRequestId": "12e4623d-af7e-4bfd-9cab-070ccd3bbd52",
        "type": "PAYMENT",
        "status": "APPROVED",
        "grossAmount": 17,
        "executionTime": "2021-09-27T23:13:00.857Z",
        "merchantId": "10001",
        "merchantReferenceId": "20170505065",
        "clientReference": "T5ESYRPWJKPHk997",
        "instruments": [
            {
                "paymentInstrumentId": "215319",
                "instrumentType": "CREDIT_CARD",
                "transactions": [
                    {
                        "type": "PREAUTH",
                        "executionTime": "2021-09-27T23:13:01.379Z",
                        "paymentTransactionRef": "1000000007817560",
                        "status": "APPROVED",
                        "amount": 6.5
                    }
                ]
            },
            {
                "paymentInstrumentId": "215318",
                "instrumentType": "CREDIT_CARD",
                "transactions": [
                    {
                        "type": "PREAUTH",
                        "executionTime": "2021-09-27T23:13:01.379Z",
                        "paymentTransactionRef": "1000000007817559",
                        "status": "APPROVED",
                        "amount": 10.5
                    }
                ]
            }
        ],
        "subTransactions": [
            {
                "transactionReceipt": "1000000007817558",
                "partialSuccess": false,
                "fraudResponse": {
                    "clientId": "6327843829656897803007",
                    "reasonCode": "481",
                    "decision": "REJECT"
                },
                "paymentResponses": [
                    {
                        "paymentInstrumentId": "215319",
                        "paymentToken": "de770338-5fde-4e15-a232-5efd1246ef62",
                        "paymentTransactionRef": "1000000007817560",
                        "threeDS": {
                            "sli": null,
                            "car": null,
                            "dsTransID": null
                        },
                        "receiptData": {
                            "scheme": "VISA",
                            "expiryMonth": "02",
                            "cardSuffix": "0608",
                            "expiryYear": "23"
                        },
                        "extendedTransactionData": [
                            {
                                "field": "bin",
                                "value": "456004"
                            },
                            {
                                "field": "stan",
                                "value": "016894"
                            },
                            {
                                "field": "rrn",
                                "value": "000000016894"
                            },
                            {
                                "field": "mid",
                                "value": "611000602008843"
                            },
                            {
                                "field": "terminalId",
                                "value": "W8843100"
                            }
                        ],
                        "externalServiceCode": "00",
                        "externalServiceMessage": "APPROVED",
                        "handlingInstructions": [
                            {
                                "instructionCode": "120",
                                "instructionMessage": "Delayed Completion"
                            }
                        ],
                        "paymentInstrumentType": "CREDIT_CARD"
                    },
                    {
                        "paymentInstrumentId": "215318",
                        "paymentToken": "c930a4bf-19b9-4443-8b79-9ac6991010a8",
                        "paymentTransactionRef": "1000000007817559",
                        "threeDS": {
                            "sli": null,
                            "car": null,
                            "dsTransID": null
                        },
                        "receiptData": {
                            "cardSuffix": "0407",
                            "expiryYear": "23",
                            "scheme": "MASTERCARD",
                            "expiryMonth": "01"
                        },
                        "extendedTransactionData": [
                            {
                                "field": "bin",
                                "value": "512899"
                            },
                            {
                                "field": "stan",
                                "value": "016895"
                            },
                            {
                                "field": "rrn",
                                "value": "000000016895"
                            },
                            {
                                "field": "mid",
                                "value": "611000602008843"
                            },
                            {
                                "field": "terminalId",
                                "value": "W8843100"
                            }
                        ],
                        "externalServiceCode": "00",
                        "externalServiceMessage": "APPROVED",
                        "handlingInstructions": [
                            {
                                "instructionCode": "120",
                                "instructionMessage": "Delayed Completion"
                            }
                        ],
                        "paymentInstrumentType": "CREDIT_CARD"
                    }
                ]
            }
        ]
    },
    "meta": {}
}

Transaction Outcomes

The status of your payment request is provided in the response and can be seen at both the overall transaction as well as sub-transaction level. The outcome of a payment can either be APPROVED or REJECTED.

Transaction Reference

The transaction ID transactionId is returned as part of a payment response and is a unique reference to the full payment request. A payment can be made up of multiple sub-transactions each with a paymentTransactionRef which is the unique reference of the sub-transaction.

The transactionId and paymentTransactionRef are important as these will be a required piece of information when either completing a pre-authorised transaction, voiding the transaction or processing a refund.

Fraud Outcomes

Should you use the fraud services of Wpay the fraud outcome (fraudResponse) in the payment response will give you the outcome of the fraud decision manager check. This can be Accept, Reject or Review.

  • Accept: No fraud detected. Advice is that payment can proceed.
  • Reject: Fraud likely. Advice is that payment should be voided or refunded.
  • Review: Fraud potential. Payment should be manually reviewed to determine fraud decision.