Accept Hosted Recurring billing - authorize.net

getHostedPaymentPageRequest only provides two types of transaction to generate a token for the form using the following XML.
Two transaction type:
authCaptureTransaction
authOnlyTransaction
<getHostedPaymentPageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>5KP3u95bQpv</name>
<transactionKey>346HZ32z3fP4hTG2</transactionKey>
</merchantAuthentication>
<transactionRequest>
<transactionType>authCaptureTransaction</transactionType>
<amount>20.00</amount>
<profile>
<customerProfileId>123456789</customerProfileId>
</profile>
<customer>
<email>ellen#mail.com</email>
</customer>
<billTo>
<firstName>Ellen</firstName>
<lastName>Johnson</lastName>
<company>Souveniropolis</company>
<address>14 Main Street</address>
<city>Pecan Springs</city>
<state>TX</state>
<zip>44628</zip>
<country>USA</country>
</billTo>
</transactionRequest>
<hostedPaymentSettings>
<setting>
<settingName>hostedPaymentReturnOptions</settingName>
<settingValue>{"showReceipt": true, "url": "https://url-when-continue-button-clicked/receipt", "urlText": "Continue", "cancelUrl": "https://url-when-cancel-button-clicked.com/cancel", "cancelUrlText": "Cancel"}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentButtonOptions</settingName>
<settingValue>{"text": "Pay"}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentStyleOptions</settingName>
<settingValue>{"bgColor": "blue"}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentPaymentOptions</settingName>
<settingValue>{"cardCodeRequired": false, "showCreditCard": true, "showBankAccount": true}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentSecurityOptions</settingName>
<settingValue>{"captcha": false}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentShippingAddressOptions</settingName>
<settingValue>{"show": false, "required": false}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentBillingAddressOptions</settingName>
<settingValue>{"show": true, "required":false}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentCustomerOptions</settingName>
<settingValue>{"showEmail": false, "requiredEmail": false, "addPaymentProfile": true}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentOrderOptions</settingName>
<settingValue>{"show": true, "merchantName": "G and S Questions Inc."}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentIFrameCommunicatorUrl</settingName>
<settingValue>{"url": "https://url-contianing-iframe"}</settingValue>
</setting>
</hostedPaymentSettings>
</getHostedPaymentPageRequest>
How should I modify the XML so that I can get the form for recurring billing? As I did not find any implementation example in accept hosted to get a valid form token for recurring billing. There was not mention of recurring billing the accept hosted documentation.
Also, I am using the redirect method and not the iframe one to display the form which does not return any response as well.

There is no one form for creating a subscription through the hosted form. Fortunately someone already posted how to do this on their forum which I will repost here:
If you are trying to use the Accept hosted forms for creating a
subscription, you actually wouldn't use the hosted payment page,
described here.
The correct workflow is, using the API, make a request for a customer
profile: createCustomerProfileRequest. All you need is their email
address.
After getting the profile id from that call, you make a request for a
token for the accept hosted add profile form. Documentation for
this form and others is here. I didn't even realize these forms
existed. It's hard to find them in google even if you know what you're
looking for.
You need the customer profile id to get the token for the "add payment
profile" form.
You handle the response to this form client-side since you are getting
the response from the IFrameCommunicator page you set up (it works the
same for the payment form or these customer profile type forms).
Here's a sample.
I then called server-side code to create the subscription with the api
- I pass it the customer profile id because honestly I don't know if the form returns the newly created payment profile id. If you have the
customer profile id, you can retrieve any existing payment profiles.
So, using just the customer profile id, I make a call to get the
payment profile id - getCustomerProfileRequest. That call returns
all sorts of stuff including the payment profiles. I just grab the
first one. Now with the customer profile id and the payment profile
id, I can create a subscription - ARBCreateSubscriptionRequest.
There are samples out there to help you form the subscription
properly.
Final note: if you are testing this in the sandbox, you will need to
put a 20 second delay between obtaining a payment profile id and
obtaining a subscription using the api. The sandbox does not have the
resources to handle these transactions real time. Figuring that out
cost me several hours. You can read through this post to confirm, and
though it's older, it is still true:
https://community.developer.authorize.net/t5/Integration-and-Testing/E00040-when-Creating-Subscription-from-Customer-Profile/m-p/59597#M34176

Related

facebook graph api Ad Insights do not return adset_name field

I'm using python for interacting with Facebook Graph API Ad Insights and I'm using a "system user" token to authenticate. I have no problem with any other field but I cannot get data for the adset_name field.
I have "ads_read" permission on my token.
I'm using facebook-business 12.0.1 package.
I'm calling facebook_business.adobjects.adaccount.AdAccount.get_insights_async
And the request params are as below:
fields: ['campaign_name', 'adset_name', 'impressions', 'unique_inline_link_clicks',
'spend', 'actions', 'conversions', 'conversion_values', 'action_values']
params: {'time_range': {'since': '2021-11-16', 'until': '2021-11-18'},
'level': 'campaign',
'export_format': 'csv',
'time_increment': 1,
'action_attribution_windows': '1d_click'}
I'm not posting a response but I can assure you that there is no sign of "adset_name" anywhere. And all the other fields listed here are returning successfully
is this about a lack of permission on my token ?
I just figured out that I cannot receive anything about adset_name or adset_id because of choosing AdsInsights.Level.ad as level. All resolved when I used AdsInsights.Level.ad

Authorize.net Accept Hosted & Customer Profiles

Background:
I'm creating my first Authorize.net Accept Hosted solution. The plan is to use the merchant's custom PHP cart to collect the shipping, billing address then present the hosted form to collect payment. Many of the customers will be 'guest' customers without customer profiles generated in the PHP cart.
I have successfully created an XML token request using CURL and used the return token to request the payment form and populate an iframe.
The Problem:
We'd like to pass the billing/shipping info entered into the cart to Auth.net so the customer does not need to re-enter the information. The documentation/examples I have been able to find require use of the SDK to create a customer profile in order to do this.
Is there an easier way?
My questions:
Can we pass the shipping / billing in the token request?
Can we pass the shipping / billing in the form request?
Any other suggestions on how to pass this billing / shipping info without creating a separate customer profile transaction?
If we have to create a customer profile for each transaction, can we create a customer profile using XML/CURL without incorporating the entire SDK?
Thanks in advance for your help.
Yes, you can pass both billing and shipping address infomation to the token reques, which will then be pre-populated in the form :
<getHostedPaymentPageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>YOUR_LOGIN_ID</name>
<transactionKey>YOUR_TRANSACTION_KEY</transactionKey>
</merchantAuthentication>
<transactionRequest>
<transactionType>authCaptureTransaction</transactionType>
<amount>20.00</amount>
<billTo>
<firstName>Ellen</firstName>
<lastName>Johnson</lastName>
<company>Souveniropolis</company>
<address>14 Main Street</address>
<city>Pecan Springs</city>
<state>TX</state>
<zip>44628</zip>
<country>USA</country>
</billTo>
<shipTo>
<firstName>China</firstName>
<lastName>Bayles</lastName>
<company>Thyme for Tea</company>
<address>12 Main Street</address>
<city>Pecan Springs</city>
<state>TX</state>
<zip>44628</zip>
<country>USA</country>
</shipTo>
</transactionRequest>
<hostedPaymentSettings>
<setting>
<settingName>hostedPaymentBillingAddressOptions</settingName>
<settingValue>{"show": true, "required":true}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentButtonOptions</settingName>
<settingValue>{"text": "Pay"}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentReturnOptions</settingName>
<settingValue>{"url":"https://www.mystore.com/good","urlText":"Continue","cancelUrl":"https://www.mystore.com/cancel","cancelUrlText":"Cancel"}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentShippingAddressOptions</settingName>
<settingValue>{"show": true, "required":true}</settingValue>
</setting>
</hostedPaymentSettings>
</getHostedPaymentPageRequest>
Yes, you can also create a customer profile using XML/CURL without incorporating the entire SDK.

Directory API, User organizations- name field. Where does it come from?

The Google Directory API https://developers.google.com/admin-sdk/directory/v1/reference/users/get
returns following kind of organizations data for a User. However in the Apps Admin console I can not find where the corresponding organisations name "Company Title" is defined. From where does it come from or how to edit that data? This is also inconsistent, since for some Users in this same domain the "name" field is missing completely?
"organizations": [
{
"name": "Company Title",
"title": "Software Developer",
"primary": true,
"type": "work",
"department": "The SW department"
}
],
I'm not particular about the Apps Admin console but you can update a user account if there are data that has to be changed.
To update a user account, use the following PUT request and include the authorization described in Authorize requests. The userKey can be the user's primary email address, the unique user id, or one of the user's alias email addresses. For the request and response properties, see the API Reference.
PUT https://www.googleapis.com/admin/directory/v1/users/userKey
You can try the REST API to retrieve all or children organization units.
To retrieve all sub-organization units under an organization unit or to retrieve the immediate children sub-organization units under an organization unit, use the following GET request and include the authorization described in Authorize requests. For the request and response properties, see the API Reference.
GET https://www.googleapis.com/admin/directory/v1/customer/my_customer
/orgunits?orgUnitPath=full org unit path&type=all or children
Here is a sample response to the List of Org unit/s
{
"kind": "directory#orgUnit",
"name": "sales",
"description": "The corporate sales team",
"orgUnitPath": "/corp/sales",
"parentOrgUnitPath": "/corp",
"blockInheritance": false
}
You can also try using the Update an organization unit:
To update an organization unit, use the following PUT request and include the authorization described in Authorize requests. For the request and response properties, see the API Reference:
PUT https://www.googleapis.com/admin/directory/v1/customer/customerId/orgunits/orgUnitPath
You can compare the values in the REST API and Admin Console.
Hope it helps!

Sitecore ItemWebApi - "Access to site is not granted"

Sitecore ItemWebApi Gurus,
Why am I getting a response of "Access to site is not granted" every time I attempt to make a Sitecore ItemWebApi request?
Here are the security settings in my Sitecore.ItemWebApi.config
<site name="website">
<patch:attribute name="itemwebapi.mode">StandardSecurity</patch:attribute>
<patch:attribute name="itemwebapi.access">ReadOnly</patch:attribute>
<patch:attribute name="itemwebapi.allowanonymousaccess">false</patch:attribute>
</site>
</sites>
Here's how I'm setting up my ItemWebApi request (please note that I have used a fake username, password, and GUID for the purpose of stack overflow):
var client = new WebClient();
var n = new NameValueCollection();
n["X-Scitemwebapi-Username"] = "extranet\\Sample_Username";
n["X-Scitemwebapi-Password"] = "SamplePassword";
client.Headers.Add(n);
var result = client.DownloadString(
"http://localhost:11111/-/item/v1/?sc_itemid={11111111-1111-1111-1111-111111111111}&scope=c");
The response I get back from my request is always:
Access to site is not granted
I'm using sitecore 7.1.
Turns out I was using the wrong password for the user. The code above in my question is perfectly valid and will return a json response containing the desired information about a sitecore item.
I'd like to also add that you need to verify that the sitecore user which you are trying to authenticate with has been "enabled" in sitecore. I had added a user for my Item Web Api through a sitecore package and wasn't aware that when you do that, sitecore by default disables the user. You actually have to manually "enable" the user before it is active.

Problems with Oracle Membership Provider and Framework 4

I'm having serious problems with creating a Web service in Visual Studio 2010 (Framework 4).
Anyway, I have to use a Oracle membership provider (I have installed "Oracle Providers for ASP.NET 4 11.2.0.2.0', which modifies the framework's machine.config), but I can not connect to the membership.
My code in web.config is as follows:
<configuration>
<connectionStrings>
<remove name="OraAspNetConString"></remove>
<add name="OraAspNetConString" connectionString="User Id=USUARIO;Password=PASSWORD;Data Source=DATABASENAME;" providerName="Oracle.DataAcces.Client"/>
</connectionStrings>
<system.web>
<membership defaultProvider="OracleMembershipProvider" userIsOnlineTimeWindow="30"/>
<roleManager defaultProvider="OracleRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All"/>
<authentication mode="None"/>
<authorization>
<allow users="*"/>
</authorization>
I also added the reference 'System.Web.ApplicationServices' to my project.
To test the connection to the membership of Oracle I have put this code in one of the OperationContract that has my web service:
MembershipUserCollection userC = Membership.GetAllUsers();
sample.StringValue += " - " + userC.Count;
bool resp = Membership.ValidateUser(id, id2);
The obtained MembershipUserCollection always appears without users. UserC.Count always equals zero.
The parameters 'id' and 'id2', username and password respectively, are used to validate (that is a poor use, I know) but always returns false.
Anybody can help me with this?
Thanks a lot.
PD: Authentication mode is 'None', I've tried with 'Forms' and still not working.
Problem solved.
I needed to put the name of the application (applicationName) on the label of the membership and role manager providers (in the file machine.config).
:-)