copyCustomer

Copy customer from one merchant to another.

Description

This method allows you to copy a customer record from one merchant to another. This method is only available to merchants who have a master user setup to access both accounts.

Syntax

CustNum copyCustomer, (ueSecurityToken Token, string CustNum, ueSecurityToken Token)

Arguments

Type Name Description
ueSecurityToken FromToken Merchant security token: used to identify the merchant that the customer is being copied from.
string CustNum The gateway assigned customer number for the the customer to be copied.
ueSecurityToken Token Merchant security token: used to identify the merchant that the customer is being copied to.

Return Value

Type Description
string Returns gateway assigned Customer Number of the new customer.

Examples

PHP

For directions on how to set up the WSDL link, create "$token" and "$client", go to PHP Soap How-to.


    try {

      // CustNum for Customer to Copy  
      $CustNum="12345678";

      // $toMerchToken is setup with sourcekey
      // for merchant being copied to
      $NewCustNum=$client->copyCustomer($token, $CustNum,$toMerchToken);

    } catch(Exception $e)  {

      echo 'Error: ' . $e->getMessage();

    }

Java

This example uses the Newtek Gateway Java library. For directions on how to install the library and create the token/client objects, go to the Java JAX-WS Howto.

    try {

      //CusNum From Customer to copy
      BigInteger CustNum = BigInteger("12345678");

      // toMerchToken is the token setup with a source key
      // for the merchant being copied to.
      BigInteger NewCustNum = client.copyCustomer(token, CustNum, toMerchToken);

    } catch (Exception e) {
      System.out.println("Soap Exception: " + e.getMessage());
    }

.NET VB

    Dim token1 As newtek.ueSecurityToken
            Dim token2 As newtek.ueSecurityToken

            token1 = Me.CreateToken("source key of the merchant1", "1234")
            token2 = Me.CreateToken("source key of the merchant2", "1234")

            Dim custNum As String
            custNum = "103125"
            Dim NewCust As String

            NewCust = client.copyCustomer(token1, custNum, token2)
            MsgBox(NewCust)

.NET C

For directions on how to set up the WSDL link and create the "token" and "client" variables, go to the C Sharp .Net Soap How-to.

    newtek.ueSecurityToken totoken = new newtek.ueSecurityToken();
                newtek.ueHash hash = new newtek.ueHash();
                string sourcekey = "NEW SOURCE KEY";
                string pin = "new pin";
                totoken.SourceKey = sourcekey;

                hash.Type = "md5";
                hash.Seed = Guid.NewGuid().ToString();

                string prehashvalue = string.Concat(token.SourceKey, hash.Seed, pin);
                hash.HashValue = GenerateHash(prehashvalue);

                totoken.PinHash = hash;

                string CustNum = "89147";
                string NewCust;

                try
                {
                    NewCust = client.copyCustomer(token, CustNum, totoken);
                    MessageBox.Show(string.Concat(NewCust));
                }

                catch (Exception err)
                {
                        MessageBox.Show(err.Message);
                }

Change History

Version Change
1.7 Changed ReturnValue to type string