Working with authorized .net payment gateway in ios - iphone

i am working with authorized .net payement gateway in ios
In the following method
(void) createTransaction {
AuthNet *an = [AuthNet getInstance];
[an setDelegate:self];
CreditCardType *creditCardType = [CreditCardType creditCardType];
creditCardType.cardNumber = #"4111111111111111";
NSLog(#"babul cardNumber is %#",creditCardType.cardNumber);
creditCardType.cardCode = #"100";
NSLog(#"babul cardCode is %#",creditCardType.cardCode);
creditCardType.expirationDate = #"1212";
NSLog(#"babul expirationDate is %#",creditCardType.expirationDate);
PaymentType *paymentType = [PaymentType paymentType];
paymentType.creditCard = creditCardType;
ExtendedAmountType *extendedAmountTypeTax = [ExtendedAmountType extendedAmountType];
extendedAmountTypeTax.amount = #"0";
extendedAmountTypeTax.name = #"Tax";
ExtendedAmountType *extendedAmountTypeShipping = [ExtendedAmountType extendedAmountType];
extendedAmountTypeShipping.amount = #"0";
extendedAmountTypeShipping.name = #"Shipping";
LineItemType *lineItem = [LineItemType lineItem];
lineItem.itemName = #"Soda";
lineItem.itemDescription = #"Soda";
lineItem.itemQuantity = #"1";
lineItem.itemPrice = #"1.00";
lineItem.itemID = #"1";
TransactionRequestType *requestType = [TransactionRequestType transactionRequest];
requestType.lineItems = [NSArray arrayWithObject:lineItem];
requestType.amount = #"1.00";
requestType.payment = paymentType;
requestType.tax = extendedAmountTypeTax;
requestType.shipping = extendedAmountTypeShipping;
CreateTransactionRequest *request = [CreateTransactionRequest createTransactionRequest];
request.transactionRequest = requestType;
request.transactionType = AUTH_ONLY;
request.anetApiRequest.merchantAuthentication.mobileDeviceId =
[[[UIDevice currentDevice] uniqueGlobalDeviceIdentifier]
stringByReplacingOccurrencesOfString:#"-" withString:#"_"];
request.anetApiRequest.merchantAuthentication.sessionToken = sessionToken;
[an purchaseWithRequest:request];
}
i am getting the response as
Create Transaction response
2012-07-26 19:14:00.131 Authorized[2355:207] ErrorE00003The element 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'mobileDeviceId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'name, transactionKey, sessionToken, password' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
namespace warning : xmlns: URI AnetApi/xml/v1/schema/AnetApiSchema.xsd is not absolute
ttp://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"
^
2012-07-26 19:14:00.131 Authorized[2355:207] Error = (null)
2012-07-26 19:14:00.247 Authorized[2355:207] babul output is Message.code = E00003
Message.text = The element 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'mobileDeviceId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'name, transactionKey, sessionToken, password' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
Is there any alternative to the above problem and how the transactions are going to be stored in authorized .net
(i created my test account, i am giving those credentials, i approved my device but later i am getting the above error)
Thanks in advance

I think you need to go for in app purchase because Apple will not approve application payment through any web service or API.

Related

Is there a web redirect method or example using an application gateway using terraform?

im trying to create a service for web redirect through the application gateway using terraform.
I would like to authenticate the application gateway sl with the free certified (azurm_app_service_managed_certified) of the azure app service plan, is there an example?
Currently, thinking about the composition as follows. However, azurem_application_gateway is demanding ssl certification, so I don't know how to work.
Please let me know if there's a way to solve the problem in that way or in another way.
The problem with the script below is that if you want to use https in the application gateway, you have to use certificate, and I want to make and use free certificated in the service plan.
resource "azurerm_application_gateway" "app_gateway" {
provider = azurerm.generic
name = "${local.service_name}-app-gateway"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
enable_http2 = true
sku {
name = "Standard_Small"
tier = "Standard" # v1
capacity = 2
}
gateway_ip_configuration {
name = "${local.service_name}-ip-config"
subnet_id = azurerm_subnet.front_subnet.id
}
frontend_port {
name = local.frontend_port_name
port = 80
}
frontend_port {
name = local.backend_port_name
port = 443
}
frontend_ip_configuration {
name = local.frontend_ip_configuration_name
public_ip_address_id = azurerm_public_ip.pub_ip.id
}
backend_address_pool {
name = "${azurerm_virtual_network.vn.name}-beap"
fqdns = [local.host_name]
}
backend_http_settings {
name = local.http_setting_name
cookie_based_affinity = "Disabled"
port = 443
protocol = "Https"
request_timeout = 60
host_name = local.host_name
}
http_listener {
name = "${local.listener_name}-http"
frontend_ip_configuration_name = local.frontend_ip_configuration_name
frontend_port_name = local.frontend_port_name
protocol = "Http"
}
http_listener {
name = "${local.listener_name}-https"
frontend_ip_configuration_name = local.frontend_ip_configuration_name
frontend_port_name = local.backend_port_name
protocol = "Https"
}
request_routing_rule {
name = "${local.request_routing_rule_name}-http"
rule_type = "Basic"
http_listener_name = "${local.listener_name}-http"
backend_address_pool_name = local.backend_address_pool_name
backend_http_settings_name = local.http_setting_name
}
redirect_configuration {
name = local.redirect_configuration_name
redirect_type = "Permanent"
include_path = false
include_query_string = false
target_listener_name = "${local.listener_name}-https"
}
request_routing_rule {
name = "${local.request_routing_rule_name}-https"
rule_type = "Basic"
http_listener_name = "${local.listener_name}-https"
redirect_configuration_name = local.redirect_configuration_name
}
lifecycle {
ignore_changes = [
backend_address_pool,
backend_http_settings,
frontend_port,
http_listener,
request_routing_rule,
ssl_certificate,
redirect_configuration
]
}
}
resource "azurerm_dns_zone" "zone" {
provider = azurerm.generic
for_each = toset(local.dns_zone_names)
name = each.key
resource_group_name = azurerm_resource_group.rg.name
}
resource "azurerm_app_service_plan" "service_plan" {
provider = azurerm.generic
name = "${local.service_name}-service-plan"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
sku {
tier = "Basic"
size = "B1"
}
}
resource "azurerm_app_service" "service" {
provider = azurerm.generic
name = "${local.service_name}-service"
app_service_plan_id = azurerm_app_service_plan.service_plan.id
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
}
resource "azurerm_app_service_custom_hostname_binding" "service_host_bind" {
provider = azurerm.generic
count = length(local.dns_zone_names)
hostname = "${local.dns_zone_names[count.index]}"
app_service_name = azurerm_app_service.service.name
resource_group_name = azurerm_resource_group.rg.name
lifecycle {
ignore_changes = [ssl_state, thumbprint]
}
depends_on = [
azurerm_app_service.service,
azurerm_resource_group.rg
]
}
resource "azurerm_app_service_managed_certificate" "service_manage_cert" {
provider = azurerm.generic
count = length(local.dns_zone_names)
custom_hostname_binding_id = azurerm_app_service_custom_hostname_binding.service_host_bind[count.index].id
}
resource "azurerm_app_service_certificate_binding" "service_certi_bind" {
provider = azurerm.generic
count = length(local.dns_zone_names)
hostname_binding_id = azurerm_app_service_custom_hostname_binding.service_host_bind[count.index].id
certificate_id = azurerm_app_service_managed_certificate.service_manage_cert[count.index].id
ssl_state = "SniEnabled"
}
i want a service that simply directs to another website through dns using terraform, and if there is any other way, please let us know. (include http to https)
To protect and prevent website abuse, we would like to redirect multiple domains to one website.
ex : (adomain.net -> www.target.com, adomain.tv -> www.target.com, bdomain.net -> www.target.com)
Fist of all there is no support for app services managed certificate with application gateway as of now.
Yes, you can do redirection from multiple domains to one domain using system.webserver rewrite rule either inside app services web.config file or application gateway rewrite rule.

Updating MGTwitterEngine to New Twitter API v1.1

I am currently updating my app to .json from xml for Twitters new API v1.1. I currently have .json working and can log on, get me timelines, mentions, but when trying to get direct messages, lists, or user info it seems its looking for "cookies" but it is not stored.
This is the error message received by twitter when trying to make a simple GET user/show call:
Twitter request failed: 08AD12D3-0044-49AB-8D3D-4E61D8398550 with error:Error Domain=HTTP
Code=400 "The operation couldn’t be completed. (HTTP error 400.)" UserInfo=0xce90540
{response=<NSHTTPURLResponse: 0xce94bd0> { URL:
https://api.twitter.com/1.1/users/show.json?screen_name=FreeAppl3 } { status code: 400,
headers {
"Content-Encoding" = gzip;
"Content-Type" = "application/json; charset=utf-8";
Date = "Fri, 14 Jun 2013 09:25:40 UTC";
Server = tfe;
"Set-Cookie" = "guest_id=v1%3A137120194019582695; Domain=.twitter.com; Path=/;
Expires=Sun, 14-Jun-2015 09:25:40 UTC";
"Strict-Transport-Security" = "max-age=631138519";
"Transfer-Encoding" = Identity;
} }, body={"errors":[{"message":"Bad Authentication data","code":215}]}hjD4nzoeOUaTQ1Q%3D}
When I call [twitterEngine isAuthorized]; is returns YES and if I check for my access token string, I receive what was stored on initial login. I have searched and searched as to what is happening or how to fix the issues, but am simply stuck and any help would be greatly appreciated.
Twitter API - https://dev.twitter.com/docs/api/1.1/get/users/show
Twitter Error Codes - https://dev.twitter.com/docs/error-codes-responses
refer FHSTwitterEngine you can use newly FHSTwitterEngine and if you request this method without autenticating, the users status is removed... you need to send consumer key and token along with screen_name..
In FHSTwitterEngine
//get username pass to method. In Dictionary you can get all info
NSString *username = [[FHSTwitterEngine sharedEngine]loggedInUsername];
NSDictionary *data=[[FHSTwitterEngine sharedEngine]getUserProfile:username];
// method to get all user info
-(id)getUserProfile:(NSString *)username
{
if (username.length == 0) {
return getBadRequestError();
}
NSURL *baseURL = [NSURL URLWithString:url_users_show];
OAMutableURLRequest *request = [OAMutableURLRequest requestWithURL:baseURL consumer:self.consumer token:self.accessToken];
OARequestParameter *usernameP = [OARequestParameter requestParameterWithName:#"screen_name" value:username];
NSArray *params = [NSArray arrayWithObjects:usernameP, nil];
id userShowReturn = [self sendGETRequest:request withParameters:params];
return userShowReturn;
}

CreateRecurringPaymentsProfile giving Error 11502: Invalid Token

I keep getting the Invalid Token Error when i call the CreateRecurringPaymentsProfile NVP API.
Please find the sequence of my API calls below:
SetExpressCheckout
METHOD = SetExpressCheckout
VERSION = 98
PWD = <pwd>
USER = <user>
SIGNATURE = <signature>
ReturnUrl = http://google.com
CANCELURL = http://google.com
PAYMENTREQUEST_0_PAYMENTACTION = Authorization
PAYMENTREQUEST_0_AMT = 100.00
PAYMENTREQUEST_0_CURRENCYCODE = USD
L_PAYMENTREQUEST_0_NAME0 = Item1
L_PAYMENTREQUEST_0_QTY0 = 1
L_PAYMENTREQUEST_0_AMT0 = 100.00
PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID = rahul.katikineni#sap.com
LOCALECODE = US
L_BILLINGTYPE0 = RecurringPayments
L_BILLINGAGREEMENTDESCRIPTION0 = SameEveryTime
I get back a token with ACK=*Success* as response. I then navigate to the paypal website using the URL [https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=token] and login with a paypal account and click on "Agree and Continue".
After agreeing and successfully redirecting to the redirect URL, I make the GetExpressCheckoutDetails API call with the following parameters
METHOD = GetExpressCheckoutDetails
VERSION = 98
PWD = <pwd>
USER = <user>
SIGNATURE = <signature>
TOKEN = <token from the SetExpressCheckout response>
After successfully getting the the payer details as response, i make the DoExpressCheckoutPayment API call
METHOD = DoExpressCheckoutPayment
VERSION = 98
PWD = <pwd>
USER = <user>
SIGNATURE = <signature>
TOKEN = <token from the SetExpressCheckout response>
PAYERID = <payer ID from the GetExpressCheckoutDetails response>
PAYMENTREQUEST_0_AMT = 100
PAYMENTREQUEST_0_PAYMENTACTION = Sale
PAYMENTREQUEST_0_CURRENCYCODE = USD
L_PAYMENTREQUEST_0_NAME0 = Item1
L_PAYMENTREQUEST_0_QTY0 = 1
L_PAYMENTREQUEST_0_AMT0 = 100.00
PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID = rahul.katikineni#sap.com
I now make the CreateRecurringPaymentsProfile API call
METHOD = CreateRecurringPaymentsProfile
VERSION = 98
PWD = <pwd>
USER = <user>
SIGNATURE = <signature>
TOKEN = <token from the SetExpressCheckout response>
PAYERID = <payer ID from the GetExpressCheckoutDetails response>
DESC = SameEveryTime
BILLINGPERIOD = Month
BILLINGFREQUENCY = 1
PROFILESTARTDATE = 2013-05-16T00:00:00Z
MAXFAILEDPAYMENTS = 1
AMT = 100.00
CURRENCYCODE = USD
L_PAYMENTREQUEST_0_NAME0 = Item1
L_PAYMENTREQUEST_0_QTY0 = 1
L_PAYMENTREQUEST_0_AMT0 = 100.00
AUTOBILLAMT = AddToNextBilling
I keep getting the following response
TIMESTAMP = 2013-04-17T05:31:24Z
CORRELATIONID = d2c1d30c1d31
ACK = Failure
VERSION = 98
BUILD = 5650305
L_ERRORCODE0 = 11502
L_SHORTMESSAGE0 = Invalid Token
L_LONGMESSAGE0 = The token is invalid
L_SEVERITYCODE0 = Error
I have tried looking for a solution in many forums but could not figure out if i have missed any parameters.
Can anyone help me on this?
Thanks in advance,
Rahul
This error returned by Paypal is vague. Most common reason for this error is discrepancy between BillingDescription value in SetExpressCheckout call and ScheduleDEtails.Description in CreateRecurringprofile call. Make sure these two are exactly the same for this to work.
Eg:
public CreateRecurringPaymentsProfileResponseType createRecurringProfile(string tokenin){
var scheduleDetails = new ScheduleDetailsType();
scheduleDetails.PaymentPeriod = paymentPeriod;
scheduleDetails.Description = "RecurringBilling";
}
public SetExpressCheckoutResponseType setExpressCheckout()
{
....
var billingAgreement = new BillingAgreementDetailsType();
billingAgreement.BillingAgreementDescription = "RecurringBilling";
billingAgreement.BillingType = BillingCodeType.RECURRINGPAYMENTS;
billingAgreement.PaymentType = MerchantPullPaymentCodeType.ANY;
ecDetails.BillingAgreementDetails.Add(billingAgreement);
...
}

Paypal DoDirectPaymentRequest returning NULL

I am using Paypal's classic API to do a Direct Payment. Here's the code:
require('merchant-sdk-php-master/samples/PPBootStrap.php');
$logger = new PPLoggingManager('DoDirectPayment');
$address = new AddressType();
$address->Name = $full_name;
$address->Street1 = $address_1;
$address->Street2 = $address_2;
$address->CityName = $city;
$address->StateOrProvince = $province;
$address->PostalCode = $postal_code;
$address->Country = $country;
$address->Phone = $phone;
$paymentDetails = new PaymentDetailsType();
$paymentDetails->ShipToAddress = $address;
$paymentDetails->OrderTotal = new BasicAmountType('CAD', $amount);
$personName = new PersonNameType();
$personName->FirstName = $first_name;
$personName->LastName = $last_name;
$payer = new PayerInfoType();
$payer->PayerName = $personName;
$payer->Address = $address;
$payer->PayerCountry = $country;
$cardDetails = new CreditCardDetailsType();
$cardDetails->CreditCardNumber = $card_number;
$cardDetails->CreditCardType = $card_type;
$cardDetails->ExpMonth = $expiry_month;
$cardDetails->ExpYear = $expiry_year;
$cardDetails->CVV2 = $cvv;
$cardDetails->CardOwner = $payer;
$ddReqDetails = new DoDirectPaymentRequestDetailsType();
$ddReqDetails->CreditCard = $cardDetails;
$ddReqDetails->PaymentDetails = $paymentDetails;
$ddReqDetails->PaymentAction = 'Sale';
$ddReqDetails->IPAddress = $ip_address;
$ddReqDetails->ReturnFMFDetails = true;
$doDirectPaymentReq = new DoDirectPaymentReq();
$doDirectPaymentReq->DoDirectPaymentRequest = new DoDirectPaymentRequestType($ddReqDetails);
$logger->info("created doDirectPaymentReq Object");
$paypalService = new PayPalAPIInterfaceServiceService();
try{
$doDirectPaymentResponse = $paypalService->DoDirectPayment($doDirectPaymentReq);
var_dump($doDirectPaymentResponse);
}
catch (Exception $ex){
var_dump($ex);
}
This is the object it returns:
object(DoDirectPaymentResponseType)#84 (15) { ["Amount"]=> NULL ["AVSCode"]=> NULL ["CVV2Code"]=> NULL ["TransactionID"]=> NULL ["PendingReason"]=> NULL ["PaymentStatus"]=> NULL ["FMFDetails"]=> NULL ["ThreeDSecureResponse"]=> NULL ["PaymentAdviceCode"]=> NULL ["Timestamp"]=> NULL ["Ack"]=> NULL ["CorrelationID"]=> NULL ["Errors"]=> NULL ["Version"]=> NULL ["Build"]=> NULL } ­
I'm Canadian so I can't use the new API's because they're not available here yet. I'm stuck with the classic API. Why am I getting this result?
Any help is appreciated!
For some reason, yesterday I was getting an object of NULL values. However, today I am getting an error message. I fixed the error and received a success.
Why it was showing me the error message today and not yesterday, I do not know. I never changed any of the code so it must have been something on Paypal's end.
Still have no idea what was wrong, but that's that.

Getting Error in "Create Transaction response"

i am working with authorized .net in ios
The mobile device is approved fine but i am getting the following error in "createTransaction" even i am not sending ant transaction key also
Create Transaction response
2012-07-26 18:23:40.600 Authorized[2095:207] <?xml version="1.0" encoding="utf-8"?><ErrorResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Error</resultCode><message><code>E00003</code><text>The element 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'name, transactionKey, sessionToken, password' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.</text></message></messages></ErrorResponse>
namespace warning : xmlns: URI AnetApi/xml/v1/schema/AnetApiSchema.xsd is not absolute
ttp://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"
^
2012-07-26 18:23:40.601 Authorized[2095:207] Error = (null)
2012-07-26 18:23:40.601 Authorized[2095:207] Message:
Message.code = E00003
Message.text = The element 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'name, transactionKey, sessionToken, password' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
Message.description = (null)
2012-07-26 18:23:40.601 Authorized[2095:207] Messages:
Messages.resultCode = Error
Messages.message = (
"Message.code = E00003\nMessage.text = The element 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'name, transactionKey, sessionToken, password' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.\nMessage.description = (null)\n"
)
2012-07-26 18:23:40.635 Authorized[2095:207] Messages:
Messages.resultCode = (null)
Messages.message = (
)
2012-07-26 18:23:40.636 Authorized[2095:207] SplitTenderPayment = SplitTenderPayment.transId = (null)
SplitTenderPayment.responseCode = (null)
SplitTenderPayment.responseToCustomer = (null)
SplitTenderPayment.authCode = (null)
SplitTenderPayment.accountNumber = (null)
SplitTenderPayment.accountType = (null)
SplitTenderPayment.requestedAmount = (null)
SplitTenderPayment.approvedAmount = (null)
SplitTenderPayment.balanceOnCard = (null)
2012-07-26 18:23:40.637 Authorized[2095:207] CreateTransactionResponse: createTransactionResponse.anetAPIResponse = ANetApiResponse.refId = (null)
ANetApiResponse.messages = Messages.resultCode = Error
Messages.message = (
"Message.code = E00003\nMessage.text = The element 'merchantAuthentication' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'name, transactionKey, sessionToken, password' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.\nMessage.description = (null)\n"
)
as Sandchitsignh points out, this looks like you are processing a response, that are not a fully valid xml response. Check the response thoroughly, and make sure no hidden, corrupt or unescaped characters have snuck their way in.