SFCC Cartridge
...
Checkout
Split Payments
7 min
split payments overview forter defines a split payment order as an order that includes more than one payment method for instance, if a customer pays for an order partially with gift card and partially with credit card or partially with credit card and partially with formatting split payments in forter's api schema, payment is formatted as an array that can accept multiple payment objects in cases of multiple payments, you should push each payment method into the payment array the nesting within the payment array should look like the following for split payment orders "payment" \[ {}, // first payment method {} // second payment method ] where each object represents a different payment method if the billing details for both payment methods is constant, it only needs to be passed into one of the payment method objects below is an example of a split credit card/gift card order formatting split payments in the sfcc cartridge the specific formatting for split payments can be customized within the forter cartridge based on each merchant's existing architecture for merchants using sfra or controllers based architecture, logic for split payments should be added to the forterorder ds file most merchants add logic to iterate over the paymentinstrument within the forterorder() function to identify all payment methods used in an individual transaction and push each method into the payment array forterorder ds file with logic for split payments (cybersource) note that this file will need to be customized in accordance with your existing checkout flow, gateway authorization response and accepted payment methods sample forterorder ds function function forterorder(args) { var log = new forterlogger("forterorder ds"), order = args order, site = dw\ system site getcurrent(), paymentinstruments = order getpaymentinstruments(), payment = null, authresponse = null, paymentapplepay = \[], paymentgc = \[], authresponsegc = \[], shipment = null; for (var paymentinstrument in paymentinstruments) { if (paymentinstrument paymentmethod == 'credit card') { //todo adjust to the existing payment instruments payment = paymentinstrument; if(!empty(paymentinstrument authdata)) { authresponse = new xml(paymentinstrument authdata); } else if(!empty(paymentinstrument cybersourcetransactionbody)){ 	 authresponse = new xml(paymentinstrument cybersourcetransactionbody\[0]); } 	 } else if (paymentinstrument paymentmethod == 'paypal' || paymentinstrument paymentmethod == 'bml') { //todo adjust to the existing payment instruments payment = paymentinstrument; authresponse = paymentinstrument; } else if (paymentinstrument paymentmethod == 'applepay' || paymentinstrument paymentmethod == 'amazonpay') { payment = paymentinstrument; if (!empty(paymentinstrument authdata)) { authresponse = new xml (paymentinstrument authdata) } } else if (paymentinstrument paymentmethod == 'gift certificate') { // optional if this is an accepted a method in your store //paymentgc = paymentinstrument; paymentgc push(paymentinstrument); if(!empty(paymentinstrument custom cayantransactionitems)) { authresponsegc push(paymentinstrument custom cayantransactionitems\[0]); } else { authresponsegc push(paymentinstrument); } } } } example payment array with split payment { "orderid" "123 abc de45" "payment" \[ // payment array { // first payment object "creditcard" { "nameoncard" "or paul" "bin" "424242", "lastfourdigits" "1111" "countryofissuance" "us", "cardtype" "credit", "expirationmonth" "10", "expirationyear" "2025", "verificationresults" { "authorizationcode" "a", "avsfullresult" "y", "cvvresult" "m", "processorresponsecode" "1683v2" "processorresponsetext" "authorized" } }, "billingdetails" { "personaldetails" { "fullname" "or paul", "email" "or paul\@gmail com" }, "phone" \[], "address" { "zip" "90043", "address1" "123 17th st", "city" "santa monica", "region" "ca", "country" "us" } }, "amount" { "currency" "eur", "amountlocalcurrency" "90 00", "amountusd" "100 00" } }, { // second payment object "giftcard" { "merchnantpaymentid" "eab12 ba9a 367", "value" { "amountusd" "25 00" } }, "amount" { "amountusd" "25 00" } } ] } displaying split orders if the payment method objects are not nested correctly within the payment array, the additional payment methods may not properly display in the portal's detailed transaction view this does not mean that the order was not accurately decisioned by forter's machine learning models however, for optimal transparency and the most accurate data and reporting, we highly recommend that split orders adhere to the correct formatting