# SDK Reference source: https://developer.mastercard.com/bill-payment-validator/documentation/sdk-reference/index.md **RPPSPaymentValidatorAPI** Bill Payment Validator performs real time transaction validation against the specified Biller ID's account masks, account check digits and all other registered RPPS processing parameters. **Java** ```Java /** * * Script-Name: example_billpay_routing_validation_request */ import com.mastercard.api.core.ApiConfig; import com.mastercard.api.core.exception.*; import com.mastercard.api.core.model.*; import com.mastercard.api.core.model.map.*; import com.mastercard.api.core.security.oauth.OAuthAuthentication; import java.io.*; import com.mastercard.api.billpayapi.*; public class example_billpay_routing_validation_request { public static void main(String[] args) throws Exception { String consumerKey = "your consumer key"; // You should copy this from "My Keys" on your project page e.g. UTfbhDCSeNYvJpLL5l028sWL9it739PYh6LU5lZja15xcRpY!fd209e6c579dc9d7be52da93d35ae6b6c167c174690b72fa String keyAlias = "keyalias"; // For production: change this to the key alias you chose when you created your production key String keyPassword = "keystorepassword"; // For production: change this to the key alias you chose when you created your production key InputStream is = new FileInputStream("path to your .p12 private key file"); // e.g. /Users/yourname/project/sandbox.p12 | C:\Users\yourname\project\sandbox.p12 ApiConfig.setAuthentication(new OAuthAuthentication(consumerKey, is, keyAlias, keyPassword)); // You only need to set this once ApiConfig.setDebug(true); // Enable http wire logging ApiConfig.setSandbox(true); // For production: use ApiConfig.setSandbox(false); //ApiConfig.setEnvironment(Environment.SANDBOX); try { RequestMap map = new RequestMap(); map.set("BillPayAccountValidation.RppsId", "99887761"); map.set("BillPayAccountValidation.BillerId", "9998887771"); map.set("BillPayAccountValidation.AccountNumber", "1234567890"); map.set("BillPayAccountValidation.TransactionAmount", "250.00"); map.set("BillPayAccountValidation.CustomerIdentifier1", ""); map.set("BillPayAccountValidation.CustomerIdentifier2", ""); map.set("BillPayAccountValidation.CustomerIdentifier3", ""); map.set("BillPayAccountValidation.CustomerIdentifier4", ""); map.set("BillPayAccountValidation.ResponseString", ""); RPPSPaymentValidatorAPI response = RPPSPaymentValidatorAPI.create(map); out(response, "BillPayAccountValidation.RppsId"); //-->99887761 out(response, "BillPayAccountValidation.BillerId"); //-->9998887771 out(response, "BillPayAccountValidation.AccountNumber"); //-->1234567890 out(response, "BillPayAccountValidation.TransactionAmount"); //-->250.00 out(response, "BillPayAccountValidation.ResponseString"); //-->Successful } catch (ApiException e) { err("HttpStatus: "+e.getHttpStatus()); err("Message: "+e.getMessage()); err("ReasonCode: "+e.getReasonCode()); err("Source: "+e.getSource()); } } public static void out(SmartMap response, String key) { System.out.println(key+"-->"+response.get(key)); } public static void out(Map map, String key) { System.out.println(key+"--->"+map.get(key)); } public static void err(String message) { System.err.println(message); } } ``` **C#** ```C# /// /// /// Script-Name: example_billpay_routing_validation_request /// using System; using System.Collections.Generic; using MasterCard.Core; using MasterCard.Core.Exceptions; using MasterCard.Core.Model; using MasterCard.Core.Security.OAuth; namespace MasterCard.Api.BillpayAPI { public class RPPSPaymentValidatorAPITest { public static void Main() { string consumerKey = "your consumer key"; // You should copy this from "My Keys" on your project page e.g. UTfbhDCSeNYvJpLL5l028sWL9it739PYh6LU5lZja15xcRpY!fd209e6c579dc9d7be52da93d35ae6b6c167c174690b72fa string keyAlias = "keyalias"; // For production: change this to the key alias you chose when you created your production key string keyPassword = "keystorepassword"; // For production: change this to the key alias you chose when you created your production key var path = MasterCard.Core.Util.GetCurrenyAssemblyPath(); // This returns the path to your assembly so it be used to locate your cert string certPath = "path to your .p12 private key file"; // e.g. /Users/yourname/project/sandbox.p12 | C:\Users\yourname\project\sandbox.p12 ApiConfig.SetAuthentication(new OAuthAuthentication(consumerKey, certPath, keyAlias, keyPassword)); // You only need to set this once ApiConfig.SetDebug(true); // Enable http wire logging ApiConfig.SetSandbox(true); try { RequestMap map = new RequestMap(); map.Set ("BillPayAccountValidation.RppsId", "99887761"); map.Set ("BillPayAccountValidation.BillerId", "9998887771"); map.Set ("BillPayAccountValidation.AccountNumber", "1234567890"); map.Set ("BillPayAccountValidation.TransactionAmount", "250.00"); map.Set ("BillPayAccountValidation.CustomerIdentifier1", ""); map.Set ("BillPayAccountValidation.CustomerIdentifier2", ""); map.Set ("BillPayAccountValidation.CustomerIdentifier3", ""); map.Set ("BillPayAccountValidation.CustomerIdentifier4", ""); map.Set ("BillPayAccountValidation.ResponseString", ""); RPPSPaymentValidatorAPI response = RPPSPaymentValidatorAPI.Create(map); Out(response, "BillPayAccountValidation.RppsId"); //-->99887761 Out(response, "BillPayAccountValidation.BillerId"); //-->9998887771 Out(response, "BillPayAccountValidation.AccountNumber"); //-->1234567890 Out(response, "BillPayAccountValidation.TransactionAmount"); //-->250.00 Out(response, "BillPayAccountValidation.ResponseString"); //-->Successful } catch (ApiException e) { Err("HttpStatus: {0}", e.HttpStatus.ToString()); Err("Message: {0}", e.Message); Err("ReasonCode: {0}", e.ReasonCode); Err("Source: {0}", e.Source); } } public static void Err(String message, String value) { Console.Error.WriteLine(message, value); } public static void Err(SmartMap response, String key) { Console.Error.WriteLine(key+"---> "+response[key]); } public static void Out(SmartMap response, String key) { Console.WriteLine(key+"---> "+response[key]); } public static void Out(Dictionary response, String key) { Console.WriteLine(key+"---> "+response[key]); } } } ``` **NodeJS** ```NodeJS /** * * Script-Name: example_billpay_routing_validation_request */ var billpayapi = require('mastercard-billpayapi'); var MasterCardAPI = billpayapi.MasterCardAPI; var consumerKey = "your consumer key"; // You should copy this from "My Keys" on your project page e.g. UTfbhDCSeNYvJpLL5l028sWL9it739PYh6LU5lZja15xcRpY!fd209e6c579dc9d7be52da93d35ae6b6c167c174690b72fa var keyStorePath = "path to your .p12 private key file"; // e.g. /Users/yourname/project/sandbox.p12 | C:\Users\yourname\project\sandbox.p12 var keyAlias = "keyalias"; // For production: change this to the key alias you chose when you created your production key var keyPassword = "keystorepassword"; // For production: change this to the key alias you chose when you created your production key // You only need to do initialize MasterCardAPI once // var authentication = new MasterCardAPI.OAuth(consumerKey, keyStorePath, keyAlias, keyPassword); MasterCardAPI.init({ sandbox: true, debug: true, authentication: authentication }); var requestData = { "BillPayAccountValidation": { "RppsId": "99887761", "BillerId": "9998887771", "AccountNumber": "1234567890", "TransactionAmount": "250.00", "CustomerIdentifier1": "", "CustomerIdentifier2": "", "CustomerIdentifier3": "", "CustomerIdentifier4": "", "ResponseString": "" } }; billpayapi.RPPSPaymentValidatorAPI.create(requestData , function (error, data) { if (error) { err("HttpStatus: "+error.getHttpStatus()); err("Message: "+error.getMessage()); err("ReasonCode: "+error.getReasonCode()); err("Source: "+error.getSource()); err(error); } else { out(data.BillPayAccountValidation.RppsId); //-->99887761 out(data.BillPayAccountValidation.BillerId); //-->9998887771 out(data.BillPayAccountValidation.AccountNumber); //-->1234567890 out(data.BillPayAccountValidation.TransactionAmount); //-->250.00 out(data.BillPayAccountValidation.ResponseString); //-->Successful } }); function out(value) { console.log(value); } function outObj(item, key) { console.log(item[key]); } function err(value) { console.error(value); } ``` **PHP** ```PHP set("BillPayAccountValidation.RppsId", "99887761"); $map->set("BillPayAccountValidation.BillerId", "9998887771"); $map->set("BillPayAccountValidation.AccountNumber", "1234567890"); $map->set("BillPayAccountValidation.TransactionAmount", "250.00"); $map->set("BillPayAccountValidation.CustomerIdentifier1", ""); $map->set("BillPayAccountValidation.CustomerIdentifier2", ""); $map->set("BillPayAccountValidation.CustomerIdentifier3", ""); $map->set("BillPayAccountValidation.CustomerIdentifier4", ""); $map->set("BillPayAccountValidation.ResponseString", ""); $response = RPPSPaymentValidatorAPI::create($map); out($response, "BillPayAccountValidation.RppsId"); //-->99887761 out($response, "BillPayAccountValidation.BillerId"); //-->9998887771 out($response, "BillPayAccountValidation.AccountNumber"); //-->1234567890 out($response, "BillPayAccountValidation.TransactionAmount"); //-->250.00 out($response, "BillPayAccountValidation.ResponseString"); //-->Successful } catch ( ApiException $e ) { err("HttpStatus: ".$e->getHttpStatus()); err("Message: ".$e->getMessage()); err("ReasonCode: ".$e->getReasonCode()); err("Source: ".$e->getSource()); print_r($e); } function out($response, $key) { echo "$key-->{$response->get($key)}\n"; } function outObj($response, $key) { echo "$key-->{$response[$key]}\n"; } function errObj($response, $key) { echo "$key-->{$response->get($key)}\n"; } function err($message) { echo "$message \n"; } ``` **Python** ```Python #!/usr/bin/env python # -*- coding: utf-8 -*- # # # Script-Name: example_billpay_routing_validation_request # from __future__ import absolute_import from __future__ import print_function from mastercardapicore import RequestMap, Config, APIException, OAuthAuthentication from os.path import dirname, realpath, join from mastercardbillpayapi import RPPSPaymentValidatorAPI def main(): consumerKey = "your consumer key" # You should copy this from "My Keys" on your project page e.g. UTfbhDCSeNYvJpLL5l028sWL9it739PYh6LU5lZja15xcRpY!fd209e6c579dc9d7be52da93d35ae6b6c167c174690b72fa keyStorePath = "path to your .p12 private key file" # e.g. /Users/yourname/project/sandbox.p12 | C:\Users\yourname\project\sandbox.p12 keyAlias = "keyalias" # For production: change this to the key alias you chose when you created your production key keyPassword = "keystorepassword" # For production: change this to the key alias you chose when you created your production key auth = OAuthAuthentication(consumerKey, keyStorePath, keyAlias, keyPassword) Config.setAuthentication(auth) Config.setDebug(True) # Enable http wire logging Config.setSandbox(True) try: mapObj = RequestMap() mapObj.set("BillPayAccountValidation.RppsId", "99887761") mapObj.set("BillPayAccountValidation.BillerId", "9998887771") mapObj.set("BillPayAccountValidation.AccountNumber", "1234567890") mapObj.set("BillPayAccountValidation.TransactionAmount", "250.00") mapObj.set("BillPayAccountValidation.CustomerIdentifier1", "") mapObj.set("BillPayAccountValidation.CustomerIdentifier2", "") mapObj.set("BillPayAccountValidation.CustomerIdentifier3", "") mapObj.set("BillPayAccountValidation.CustomerIdentifier4", "") mapObj.set("BillPayAccountValidation.ResponseString", "") response = RPPSPaymentValidatorAPI.create(mapObj) out(response, "BillPayAccountValidation.RppsId"); #-->99887761 out(response, "BillPayAccountValidation.BillerId"); #-->9998887771 out(response, "BillPayAccountValidation.AccountNumber"); #-->1234567890 out(response, "BillPayAccountValidation.TransactionAmount"); #-->250.00 out(response, "BillPayAccountValidation.ResponseString"); #-->Successful except APIException as e: err("HttpStatus: %s", e.getHttpStatus()) err("Message: %s", e.getMessage()) err("ReasonCode: %s", e.getReasonCode()) err("Source: %s",e.getSource()) def out(response, key): print("%s--> %s" % (key, response.get(key))) def err(message, value): print(message % (value)) def errObj(response, key): print("%s--> %s" % (key, response.get(key))) if __name__ == "__main__": main() ``` **Ruby** ```Ruby # # # Script-Name: example_billpay_routing_validation_request # require 'mastercard_billpayapi' include MasterCard::Security::OAuth include MasterCard::Core include MasterCard::Core::Model include MasterCard::Core::Exceptions include MasterCard::API::BillpayAPI def main consumerKey = "your consumer key" # You should copy this from "My Keys" on your project page e.g. UTfbhDCSeNYvJpLL5l028sWL9it739PYh6LU5lZja15xcRpY!fd209e6c579dc9d7be52da93d35ae6b6c167c174690b72fa keyFile = "path to your .p12 private key file" # e.g. /Users/yourname/project/sandbox.p12 | C:\Users\yourname\project\sandbox.p12 keyAlias = "keyalias" # For production: change this to the key alias you chose when you created your production key keyPassword = "keystorepassword" # For production: change this to the key alias you chose when you created your production key auth = OAuth::OAuthAuthentication.new(consumerKey, keyFile, keyAlias, keyPassword) Config.setAuthentication(auth) Config.setDebug(true) # Enable http wire logging Config.setSandbox(true) begin mapObj = RequestMap.new mapObj.set("BillPayAccountValidation.RppsId", "99887761") mapObj.set("BillPayAccountValidation.BillerId", "9998887771") mapObj.set("BillPayAccountValidation.AccountNumber", "1234567890") mapObj.set("BillPayAccountValidation.TransactionAmount", "250.00") mapObj.set("BillPayAccountValidation.CustomerIdentifier1", "") mapObj.set("BillPayAccountValidation.CustomerIdentifier2", "") mapObj.set("BillPayAccountValidation.CustomerIdentifier3", "") mapObj.set("BillPayAccountValidation.CustomerIdentifier4", "") mapObj.set("BillPayAccountValidation.ResponseString", "") response = RPPSPaymentValidatorAPI.create(mapObj) out(response, "BillPayAccountValidation.RppsId"); #-->99887761 out(response, "BillPayAccountValidation.BillerId"); #-->9998887771 out(response, "BillPayAccountValidation.AccountNumber"); #-->1234567890 out(response, "BillPayAccountValidation.TransactionAmount"); #-->250.00 out(response, "BillPayAccountValidation.ResponseString"); #-->Successful rescue APIException => ex err("HttpCode: #{ex.getHttpCode()}") err("Message: #{ex.getMessage()}") err("ReasonCode: #{ex.getReasonCode()}") err("Message: #{ex.getSource()}") end end def out(response, key) puts "#key-->#{response.get(key)}" end def outObj(response, key) puts "#key-->#{response[key]}" end def err(message) puts message end def errObj(response, key) puts "#key-->#{response.get(key)}" end main ``` ## Next Steps {#next-steps} * [Testing](https://developer.mastercard.com/bill-payment-validator/documentation/testing/index.md) --- sandbox test data for positive and negative validation scenarios * [API Basics](https://developer.mastercard.com/bill-payment-validator/documentation/api-basics/index.md) --- OAuth 1.0a authentication and credential setup * [Code and Formats](https://developer.mastercard.com/bill-payment-validator/documentation/code-and-formats/index.md) --- error code reference and resolution steps * [Reference App](https://developer.mastercard.com/bill-payment-validator/documentation/reference-app/index.md) --- full Java reference application for end-to-end integration