cancel
Showing results for 
Search instead for 
Did you mean: 

Can't Find getHostedProfilePage within the SDK

Hello,

 

I am trying to develop the CIM for an e-commerce cart. I have everything built except the ability to get the token. The XML documentation says to use the getHostedProfilePageRequest, yet I found none in the PHP SDK.

 

Can anyone tell me if this exists?

 

Thanks,

Nick

bcse_nick
Member
1 ACCEPTED SOLUTION

Accepted Solutions
RaynorC1emen7
Expert
4 REPLIES 4

It not in the SDKs yet. But one of the user post some php code  for it.

 

http://community.developer.authorize.net/t5/Integration-and-Testing/GetHostedProfilePage-API-call-Ho...

RaynorC1emen7
Expert

I'm doing a rails project for a contract and I'm also having the same issues integrating with the hosted version CIM offers.  This is a critical method and the documentation kind of glazes over it and none of the SDK's/sample seem to give an example of calling or support for calling it.  I've figured out how to call it and actually also have found the source to the authorize_net gem (https://github.com/joevandyk/authorize-net) and could integrate it without too much trouble it looks like, however, it looks like the license is pretty restrictive.  

 

What my question is, and this is geared more towards authorize.net legal and/or support:  Is it OK according to the license that I fork the above repository and add the getHostedProfilePage so I can use this with my production app?  I will contribute back the changes so that other users can take advantage of this functionality.

 

For those that have been struggling with this here is a workaround for ruby.  Should be similar in other languages as it's a POX service:

 

 
module HostedCimTransaction
  def get_hosted_profile_page(profile_id, options = {})
    payload = <<END_OF_MESSAGE
<?xml version="1.0" encoding="utf-8"?>
<getHostedProfilePageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
  <merchantAuthentication>
    <name>#{AUTHORIZE_NET_CONFIG['api_login_id']}</name>
    <transactionKey>#{AUTHORIZE_NET_CONFIG['api_transaction_key']}</transactionKey>
  </merchantAuthentication>
  <customerProfileId>#{profile_id}</customerProfileId>
</getHostedProfilePageRequest>
END_OF_MESSAGE
    
    url = URI.parse("#{get_gateway(options)}/getHostedProfilePage")
    request = Net::HTTP::Post.new(url.path)
    request.content_type = 'text/xml'
    request.body = payload
    connection = Net::HTTP.new(url.host, url.port)
    connection.use_ssl = true
    response = HostedCimResponse.new(connection.start {|http| http.request(request)}, nil)
    return response
  end
  def get_gateway(options)
    case options[:gateway]
      when :sandbox, :test
        return 'https://apitest.authorize.net/xml/v1/request.api'
      when :production, :live
        return 'https://api.authorize.net/xml/v1/request.api'
      else
        return options[:gateway]
      end
  end
end

 

class HostedCimResponse < AuthorizeNet::XmlResponse
  def initialize(raw_response, transaction)
    super
    unless connection_failure?
      begin
        @token = node_child_content_unless_nil(@root.at_css('token'))
      rescue
        @raw_response = $!
      end
    end
  end

  def token
    @token
  end
end

 

 
mixin_mobile
Member

Sorry all.  The response class should be this:

 

class HostedCimResponse < AuthorizeNet::XmlResponse
  def initialize(raw_response, transaction)
    puts raw_response
    super
    unless connection_failure?
      begin
        @token = node_content_unless_nil(@root.at_css('token'))
      rescue
        @raw_response = $!
      end
    end
  end

  def token
    @token
  end
end

 

Hi there mixin_mobile,

 

Unfortunately Authorize.Net is prohibited from providing you with any kind of legal advice. We suggest seeking legal guidance to ensure full compliance with the terms of the Software Development Kit License Agreement.

 

Thanks,

 

Michelle

Developer Community Manager