addCard()
The addCard() method allows for another card to be added to an existing account (and a retail location card replacement option for card programs with a retail integration). Note that addCard() is not intended to add multiple cards to an account.
Please see the Platform Overview (under the Documentation drop down) for information on the Account to Card relationship within the Galileo platform.
Below are a few example scenarios for the use of addCard().
Example (1): Customer has lost their instant issue card and wants a new card immediately at a storefront. The customer has not yet received a personalized card. The addCard() method can be used to assign the instant issue card to the customer.
Example (2): Customer has lost their personalized card and wants a temporary instant issue card to use until a new personalized card arrives in the mail. The addCard() method can be used to assign an instant issue card to their existing personalized product account. The product ID of the personalized account must be passed in in order to override the use of the product ID associated with the instant issue card.
Example (3): Customer has a virtual card account and an additional virtual card (different PAN) is requested.
Example (4): Virtual card lost/stolen: Mark a card lost/stolen using modifyStatus() Type 8 or 9. Make an addCard() call to create a new card number. Note that this is for virtual cards only.
Example (5): Expired virtual card: Make an addCard() call to create a new card number. Note that this is for virtual cards only.
Parameters
The parameters below can be submitted with the method. Note that some parameters are required.
Parameters Required Data type Pattern Notes Example value
transactionId Yes String 60 characters or less A unique system generated ID number that identifies the API transaction with Galileo Processing systems. A UUID is preferred. This must be different for each transaction. 9845dk-39fdk3fj3-4483483478
accountNo Yes String PAN or PRN Can be either a PAN (the 16 digit card number) or PRN (a unique 12 digit account identifier). 074103447228
prodId Yes Integer Integer Product ID 501
newAccountNo No String PAN or PRN or Package ID Can be either a PAN (the 16 digit card number), PRN (a unique product Identifier used for internal Galileo processing and added security), or Package ID (Galileo retail card packaging identifier). 123456789012
sharedBalance No Boolean 0 or 1 Define whether or not an additional account will share the balance with the primary. Should never be set to a value of 1 if the primaryAccount is not passed. 0=false, 1=true 1
creditLimit No Amount Monetary amount greater than 0 Credit limit for card based spending control (currently only available for credit processing). 500.25
singleUse No String Y or N Spending control parameter that flags card for one purchasing transaction (currently only available for credit processing). Y
Status Codes
Codes that define the status of the transaction.
Status Code description
0 Success
2 Invalid parameter(s)
12 Invalid Account
24 Duplicate transaction
442-01 Invalid instant issue account
442-02 This product is not configured to allow shared balances.
442-03 This product is not configured to allow the same product to be added.
-1 Indicates that the application record failed to update or return.
Response
<?xml version="1.0" encoding="UTF-8"?>
<response>
   <status_code>0</status_code>
   <status>Success</status>
   <system_timestamp>2011-03-21 13:40:50</system_timestamp>
   <response_data>
     <pmt_ref_no>074129973470</pmt_ref_no>
     <product_id>1094</product_id>
     <card_id>12345</card_id>
     <galileo_account_number>935686</galileo_account_number>
   </response_data>
   <processing_time>0.796</processing_time>
   <echo>
     <transaction_id>12345a</transaction_id>
     <provider_transaction_id>77bb</provider_transaction_id>
     <provider_timestamp>2013-02-06 10:10:10</provider_timestamp>
   </echo>
</response>
Response Description Example value
status The condition of a process or response (such as embossed card, account, freeze, and so on). Success
status_code The status of the response. 0
system_timestamp A system generated timestamp. 2011-02-02 11:11:12
response_data A structure for the response data. It can be empty but usually will contain information. <response_data>
   <new_account>   </new_account>
</response_data>
pmt_ref_no A Galileo generated account number. 008103023340
product_id Galileo generated integer. 1094
galileo_account_number Galileo generated integer account number, also known as balance ID. 1181464
processing_time The time elapsed in processing the transaction. 1.723
echo A structure that displays transaction ID information. <echo>
  <transaction_id>...</transaction_id>
  <provider_transaction_id>...</provider_transaction_id>
  <provider_timestamp>...</provider_timestamp>
</echo>
transaction_id A number that represents a transaction. 12345a
provider_transaction_id Secondary transaction identifier (generated by a provider). 77bb
provider_timestamp Store a related timestamp for reporting and troubleshooting purposes. 2013-02-06 10:10:10
Code Snippet
                    # The following shell script will use cURL to call addCard
# and return the json response.

curl -d '{"transactionId":"45k-dk3fj3-44478", "accountNo":"074103447228", "prodId":"501"}' \ 
-H "response-content-type: json" \ 
-H "Authorization: Bearer **your-access-token**" \ 
-X POST https://sandbox.galileo-ft.com/intserv/4.0/addCard
                
                    // The following Java code will make a addCard call
// and print the json response.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util. *;

class GalileoAPICall
{
    public static void main(String[] args) {
        try {
            Map<String,Object> params = new LinkedHashMap<>();
           params.put("transactionId", "45k-dk3fj3-44478");
           params.put("accountNo", "074103447228");
           params.put("prodId", "501");
            StringBuilder postData = new StringBuilder();
            for (Map.Entry<String,Object> param : params.entrySet()) {
                if (postData.length() != 0) postData.append('&');
                postData.append(URLEncoder.encode(param.getKey(), "UTF-8"));
                postData.append('=');
                postData.append(URLEncoder.encode(String.valueOf(param.getValue()), "UTF-8"));
            }
            byte[] postDataBytes = postData.toString().getBytes("UTF-8");

            URL url = new URL("https://sandbox.galileo-ft.com/intserv/4.0/addCard");

            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("POST");
            conn.setRequestProperty("response-content-type", "json");
            conn.setRequestProperty("Authorization", "Bearer **your-access-token");
            conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length));
            conn.setDoOutput(true);
            conn.getOutputStream().write(postDataBytes);

            String xmlOutput;

            Reader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
            for (int c; (c = in.read()) >= 0;) {
                System.out.print((char)c);
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
                
                    # The following Python code will call addCard
# and print the json response.

import requests
headers = {'response-content-type': 'json', 'Authorization': 'Bearer {}'.format(**your-access-token**)}
payload = {'transactionId': '45k-dk3fj3-44478', 'accountNo': '074103447228', 'prodId': '501'}
r = requests.post(url='https://sandbox.galileo-ft.com/intserv/4.0/addCard', data=payload, headers=headers)
try:
    print(r.json())
except:
    print(r.status_code)
                
                    // The following PHP code will make a addCard call
// and prints the json response.

$endpoint = 'https://sandbox.galileo-ft.com/intserv/4.0/addCard';
$params = array('transactionId'=>'45k-dk3fj3-44478', 'accountNo'=>'074103447228', 'prodId'=>'501');

$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
curl_setopt($curl, CURLOPT_URL, $endpoint);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'response-content-type: json',
    'Authorization: Bearer **your-access-token**'
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($curl);
curl_close($curl);
$json = new json_decode($result, true);
print_r($json);

                
                    // The following C# code will make a addCard call
// and print the json response.

using System;using System.IO;
using System.Net;
using System.Text;

byte[] data = Encoding.ASCII.GetBytes(
    "transactionId=45k-dk3fj3-44478&accountNo=074103447228&prodId=501");
WebRequest request = WebRequest.Create("https://sandbox.galileo-ft.com/intserv/4.0/addCard");
request.Method = "POST"\;
request.ContentLength = data.Length;
request.Headers.Add("response-content-type", "json");
request.Headers.Add("Authorization","Bearer **your-access-token**");
using (Stream stream = request.GetRequestStream())
{
    stream.Write(data, 0, data.Length);
}
string responseContent = null;
using (WebResponse response = request.GetResponse())
{
    using (Stream stream = response.GetResponseStream())
    {
        using (StreamReader sr = new StreamReader(stream))
        {
            responseContent = sr.ReadToEnd();
        }
    }
}
Console.WriteLine(responseContent);
                
                    # The following Ruby code will make a addCard call
# and print the json response.

require 'uri'
require 'net/http'

uri = URI("https://sandbox.galileo-ft.com/intserv/4.0/addCard")
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request['response-content-type'] = 'json'
request['Authorization'] = 'Bearer **your-access-token**'
request.body = {transactionId: '45k-dk3fj3-44478', accountNo: '074103447228', prodId: '501'}.to_json
response = https.request(request)
puts response