1. have written procedure to get token
2. Included Ordertype for orderNo
3. included customeraddresstype to have billing information sent to form so user will not have to retype information that is stored in a database.
How do you have the form have the information show for the user?
08-17-2017 09:47 AM
First populate your token request XML or JSON with the customer billing information within the transactionRequest ...
<transactionRequest> ... <billTo> <firstName>Bub</firstName> <lastName>Jones</lastName> </billTo> </transactionRequest>
Then post your token to to the appropriate endpoint with something loke the following:
<form target="payframe" id="send_hptoken" action="https://test.authorize.net/payment/payment" method="post"> <input type="hidden"" name="token" value/><input type="submit" value="Get Accept Hosted page"/> </form>
08-17-2017 10:46 AM
i am not sure where to but what you suggesed the code i am using which is c# is as follows
this is all the code if have to get the token.
Where does the billing address go
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
{
name = "",
ItemElementName = ItemChoiceType.transactionKey,
Item = "",
};
settingType[] settings = new settingType[2];
settings[0] = new settingType();
settings[0].settingName = settingNameEnum.hostedPaymentButtonOptions.ToString();
settings[0].settingValue = "{\"text\": \"Pay\"}";
settings[1] = new settingType();
settings[1].settingName = settingNameEnum.hostedPaymentOrderOptions.ToString();
settings[1].settingValue = "{\"show\": false}";
var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authOnlyTransaction.ToString(), // authorize only
amount = amount,
};
var order = new orderType
{
invoiceNumber = OrderNo
};
var customer = new customerAddressType
{
email = email,
firstName = firstname,
lastName = lastname,
address = address,
city = city,
state = state,
zip = Zip
};
const SslProtocols _Tls12 = (SslProtocols)0x00000C00;
const SecurityProtocolType Tls12 = (SecurityProtocolType)_Tls12;
ServicePointManager.SecurityProtocol = Tls12;
var request = new getHostedPaymentPageRequest();
request.transactionRequest = transactionRequest;
request.hostedPaymentSettings = settings;
var controller = new getHostedPaymentPageController(request);
controller.Execute();
var response = controller.GetApiResponse();
string token = response.token;
return token;
08-17-2017 11:42 AM
var billingAddress = new customerAddressType { email =email, firstName = firstname, lastName = lastname, address = address, city = city, state = state, zip = Zip };
var transactionRequest = new transactionRequestType { transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), // authorize capture only amount = amount, //amount billTo = billingAddress };
08-17-2017 12:24 PM