Authorize.NET 使用 test.authorize.net 创建客户资料?
Authorize.NET create customer profile with test.authorize.net?
在 authorize.net 中,是否可以使用 https://test.authorize.net/gateway/transact.dll 页面(测试模式)创建客户资料 + 客户付款资料?
我需要 return 客户资料 ID 和付款资料 ID 才能进行离线支付。
在使用客户付款配置文件创建客户配置文件并调用 charge customer profile 后,我可以使用 API (C#) 执行此操作。但我不希望用户在我的网站上输入银行卡详细信息,需要使用 Authorize.NET UI 并获得响应。
这可以吗?
是的,可以使用 Authorize.NET 进行令牌 API 信用卡交易。
详细信息可参见 in this CIM guide 文档(第 4 章)。
- 第 1 步 - 使用 API 创建客户资料。 (只是基本客户
详情)
- 第 2 步 - 获取配置文件的令牌*
(getHostedProfilePageRequest)。这就是我卡住的地方,“谜
API 调用”,我在下面分享代码。
- 第 3 步 - 创建一个表单
在下面做一个post。 (这会将客户引导至托管
表格到 add/edit 付款方式或送货地址)
- 第 4 步 - 尝试
查询客户的客户付款资料,您会发现
添加的付款资料。
表格格式,
<form method="post" action="https://test.authorize.net/
profile/manage">
<input type="hidden" name="token"
value="pfGaUNntoTxZYeqqYDjGCQ4qyCHcsXGXLJ2i7MPCEiH6CH5n5qKqcl8EB
iTClxu01BSeH5eZg7LVUVVzw5kJKVMitQ3pyMB5UZCduMWd6Ku9aT2gyFm69EKMG
fyWPmI4p+Bb4XXXXXXXXXXXXWlM6f2xd7aRu1XBn0WXoPxK1j9FMGX2CNCoCB
p3cOXB7"/>
<input type="submit" value="Manage payment and shipping
information"/>
</form>
这是我找到的神秘 API 调用 "getHostedProfilePageRequest" 的代码,它在 Github 的 C# SDK 中不可用。它在 soap 客户端中可用,但此代码只是通过 http 发送 XML 请求(听起来与 Web 服务非常相似)。
public static string GetHostedSessionKey(UInt32 customerProfileID, Uri callingPage)
{
try
{
//build a path to IframeCommunicator from the calling page
string communicatorPath = String.Format("{0}://{1}:{2}", callingPage.Scheme, callingPage.Host, callingPage.Port);
string[] segments = callingPage.Segments;
//replace the very last entry with contentx/IframeCommunicator.html
segments[segments.GetUpperBound(0)] = "/contentx/IframeCommunicator.html";
foreach (string s in segments)
communicatorPath += s;
string requestXML = String.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<getHostedProfilePageRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">" +
"<merchantAuthentication>" +
"<name>{0}</name>" +
"<transactionKey>{1}</transactionKey>" +
"</merchantAuthentication>" +
"<customerProfileId>{2}</customerProfileId>" +
"<hostedProfileSettings>" +
"<setting>" +
"<settingName>hostedProfilePageBorderVisible</settingName>" +
"<settingValue>false</settingValue>" +
"</setting>" +
"<setting>" +
"<settingName>hostedProfileIFrameCommunicatorUrl</settingName>" +
"<settingValue>{3}</settingValue>" +
"</setting>" +
"</hostedProfileSettings>" +
"</getHostedProfilePageRequest>",
{your merchant login ID},
{your merchant transaction key},
customerProfileID,
communicatorPath);
string XMLURL = "https://apitest.authorize.net/xml/v1/request.api";
System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(XMLURL);
req.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
req.KeepAlive = false;
req.Timeout = 30000; //30 seconds
req.Method = "POST";
byte[] byte1 = null;
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte1 = encoding.GetBytes(requestXML);
req.ContentType = "text/xml";
req.ContentLength = byte1.Length;
System.IO.Stream reqStream = req.GetRequestStream();
reqStream.Write(byte1, 0, byte1.Length);
reqStream.Close();
System.Net.WebResponse resp = req.GetResponse();
System.IO.Stream read = resp.GetResponseStream();
System.IO.StreamReader io = new System.IO.StreamReader(read, new System.Text.ASCIIEncoding());
string data = io.ReadToEnd();
resp.Close();
//parse out value
XmlDocument doc = new XmlDocument();
doc.LoadXml(data);
XmlNodeList token = doc.GetElementsByTagName("token");
return token[0].InnerText;
}
catch (System.Exception ex)
{
Utility.NotifyOnException(ex, String.Format("profID={0}", customerProfileID));
return null;
}
}
找到此代码here
在 authorize.net 中,是否可以使用 https://test.authorize.net/gateway/transact.dll 页面(测试模式)创建客户资料 + 客户付款资料? 我需要 return 客户资料 ID 和付款资料 ID 才能进行离线支付。
在使用客户付款配置文件创建客户配置文件并调用 charge customer profile 后,我可以使用 API (C#) 执行此操作。但我不希望用户在我的网站上输入银行卡详细信息,需要使用 Authorize.NET UI 并获得响应。
这可以吗?
是的,可以使用 Authorize.NET 进行令牌 API 信用卡交易。 详细信息可参见 in this CIM guide 文档(第 4 章)。
- 第 1 步 - 使用 API 创建客户资料。 (只是基本客户 详情)
- 第 2 步 - 获取配置文件的令牌* (getHostedProfilePageRequest)。这就是我卡住的地方,“谜 API 调用”,我在下面分享代码。
- 第 3 步 - 创建一个表单 在下面做一个post。 (这会将客户引导至托管 表格到 add/edit 付款方式或送货地址)
- 第 4 步 - 尝试 查询客户的客户付款资料,您会发现 添加的付款资料。
表格格式,
<form method="post" action="https://test.authorize.net/
profile/manage">
<input type="hidden" name="token"
value="pfGaUNntoTxZYeqqYDjGCQ4qyCHcsXGXLJ2i7MPCEiH6CH5n5qKqcl8EB
iTClxu01BSeH5eZg7LVUVVzw5kJKVMitQ3pyMB5UZCduMWd6Ku9aT2gyFm69EKMG
fyWPmI4p+Bb4XXXXXXXXXXXXWlM6f2xd7aRu1XBn0WXoPxK1j9FMGX2CNCoCB
p3cOXB7"/>
<input type="submit" value="Manage payment and shipping
information"/>
</form>
这是我找到的神秘 API 调用 "getHostedProfilePageRequest" 的代码,它在 Github 的 C# SDK 中不可用。它在 soap 客户端中可用,但此代码只是通过 http 发送 XML 请求(听起来与 Web 服务非常相似)。
public static string GetHostedSessionKey(UInt32 customerProfileID, Uri callingPage)
{
try
{
//build a path to IframeCommunicator from the calling page
string communicatorPath = String.Format("{0}://{1}:{2}", callingPage.Scheme, callingPage.Host, callingPage.Port);
string[] segments = callingPage.Segments;
//replace the very last entry with contentx/IframeCommunicator.html
segments[segments.GetUpperBound(0)] = "/contentx/IframeCommunicator.html";
foreach (string s in segments)
communicatorPath += s;
string requestXML = String.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<getHostedProfilePageRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">" +
"<merchantAuthentication>" +
"<name>{0}</name>" +
"<transactionKey>{1}</transactionKey>" +
"</merchantAuthentication>" +
"<customerProfileId>{2}</customerProfileId>" +
"<hostedProfileSettings>" +
"<setting>" +
"<settingName>hostedProfilePageBorderVisible</settingName>" +
"<settingValue>false</settingValue>" +
"</setting>" +
"<setting>" +
"<settingName>hostedProfileIFrameCommunicatorUrl</settingName>" +
"<settingValue>{3}</settingValue>" +
"</setting>" +
"</hostedProfileSettings>" +
"</getHostedProfilePageRequest>",
{your merchant login ID},
{your merchant transaction key},
customerProfileID,
communicatorPath);
string XMLURL = "https://apitest.authorize.net/xml/v1/request.api";
System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(XMLURL);
req.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore);
req.KeepAlive = false;
req.Timeout = 30000; //30 seconds
req.Method = "POST";
byte[] byte1 = null;
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte1 = encoding.GetBytes(requestXML);
req.ContentType = "text/xml";
req.ContentLength = byte1.Length;
System.IO.Stream reqStream = req.GetRequestStream();
reqStream.Write(byte1, 0, byte1.Length);
reqStream.Close();
System.Net.WebResponse resp = req.GetResponse();
System.IO.Stream read = resp.GetResponseStream();
System.IO.StreamReader io = new System.IO.StreamReader(read, new System.Text.ASCIIEncoding());
string data = io.ReadToEnd();
resp.Close();
//parse out value
XmlDocument doc = new XmlDocument();
doc.LoadXml(data);
XmlNodeList token = doc.GetElementsByTagName("token");
return token[0].InnerText;
}
catch (System.Exception ex)
{
Utility.NotifyOnException(ex, String.Format("profID={0}", customerProfileID));
return null;
}
}
找到此代码here