Skip to content

Commit 9c9bec8

Browse files
committed
Update README.md
1 parent 1938ef3 commit 9c9bec8

File tree

1 file changed

+18
-153
lines changed

1 file changed

+18
-153
lines changed

README.md

Lines changed: 18 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ To install AuthorizeNet, run the following command in the Package Manager Consol
1919

2020

2121
## Usage
22+
Apart from this README, you can find details and examples of using the SDK in the following places:
23+
24+
- [Github Sample Code Repository](https://github.com/AuthorizeNet/sample-code-csharp)
25+
- [Developer Center Reference](http://developer.authorize.net/api/reference/index.html)
26+
27+
### Charging a Credit Card
2228
````csharp
29+
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
30+
2331
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
2432
{
2533
name = ApiLoginID,
@@ -62,62 +70,11 @@ To install AuthorizeNet, run the following command in the Package Manager Consol
6270
}
6371
````
6472

65-
## Registration & Configuration
66-
67-
All the tests can be run against a stub backend using the USELOCAL run configuration.
68-
69-
Get a sandbox account at https://developer.authorize.net/sandbox/
70-
Update app.config in the AuthorizeNetTest folder to run all the tests against your sandbox account
71-
72-
For reporting tests, go to https://sandbox.authorize.net/ under Account tab->Transaction Details API and enable it.
73-
74-
75-
## Usage
76-
77-
### Advanced Merchant Integration (AIM)
78-
79-
````csharp
80-
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
81-
{
82-
name = ApiLoginID,
83-
ItemElementName = ItemChoiceType.transactionKey,
84-
Item = ApiTransactionKey,
85-
};
86-
87-
var creditCard = new creditCardType
88-
{
89-
cardNumber = "4111111111111111",
90-
expirationDate = "0718"
91-
};
92-
93-
var paymentType = new paymentType { Item = creditCard };
94-
95-
var transactionRequest = new transactionRequestType
96-
{
97-
transactionType = transactionTypeEnum.authOnlyTransaction.ToString(), // authorize only
98-
amount = 35.45m,
99-
payment = paymentType
100-
};
101-
102-
var request = new createTransactionRequest { transactionRequest = transactionRequest };
103-
104-
var controller = new createTransactionController(request);
105-
controller.Execute();
106-
107-
var response = controller.GetApiResponse();
108-
109-
if (response.messages.resultCode == messageTypeEnum.Ok)
110-
{
111-
if (response.transactionResponse != null)
112-
{
113-
Console.WriteLine("Success, Auth Code : " + response.transactionResponse.authCode);
114-
}
115-
}
116-
else
117-
{
118-
Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text);
119-
}
120-
````
73+
### Setting the Production Environment
74+
Set the appropriate environment constant using the ApiOperationBase RunEnvironment. For example, in the method above, to switch to production environment use:
75+
```csharp
76+
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.PRODUCTION;
77+
```
12178

12279
### Direct Post Method (DPM)
12380

@@ -145,107 +102,15 @@ Place the following code in the default action of a simple MVC application to di
145102

146103
````
147104

148-
### Automated Recurring Billing (ARB)
149-
````csharp
150-
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
151-
{
152-
name = ApiLoginID,
153-
ItemElementName = ItemChoiceType.transactionKey,
154-
Item = ApiTransactionKey,
155-
};
156-
157-
paymentScheduleTypeInterval interval = new paymentScheduleTypeInterval();
158-
159-
interval.length = 1;
160-
interval.unit = ARBSubscriptionUnitEnum.months;
161-
162-
paymentScheduleType schedule = new paymentScheduleType
163-
{
164-
interval = interval,
165-
startDate = DateTime.Now.AddDays(1),
166-
totalOccurrences = 9999, // 9999 indicates no end date
167-
trialOccurrences = 3
168-
};
169-
170-
#region Payment Information
171-
var creditCard = new creditCardType
172-
{
173-
cardNumber = "4111111111111111",
174-
expirationDate = "0718"
175-
};
176-
177-
paymentType cc = new paymentType { Item = creditCard };
178-
#endregion
179105

180-
nameAndAddressType addressInfo = new nameAndAddressType()
181-
{
182-
firstName = "John",
183-
lastName = "Doe"
184-
};
185-
186-
ARBSubscriptionType subscriptionType = new ARBSubscriptionType()
187-
{
188-
amount = 35.55m,
189-
trialAmount = 0.00m,
190-
paymentSchedule = schedule,
191-
billTo = addressInfo,
192-
payment = cc
193-
};
194-
195-
var request = new ARBCreateSubscriptionRequest { subscription = subscriptionType };
196-
197-
var controller = new ARBCreateSubscriptionController(request);
198-
controller.Execute();
106+
## Running the SDK Tests
199107

200-
ARBCreateSubscriptionResponse response = controller.GetApiResponse();
201-
202-
if (response != null && response.messages.resultCode == messageTypeEnum.Ok)
203-
{
204-
if (response != null && response.messages.message != null)
205-
{
206-
Console.WriteLine("Success, Subscription ID : " + response.subscriptionId.ToString());
207-
}
208-
}
209-
else
210-
{
211-
Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text);
212-
}
213-
214-
````
215-
### Customer Information Manager (CIM)
216-
````csharp
217-
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
218-
{
219-
name = ApiLoginID,
220-
ItemElementName = ItemChoiceType.transactionKey,
221-
Item = ApiTransactionKey,
222-
};
223-
224-
customerProfileType customerProfile = new customerProfileType();
225-
customerProfile.merchantCustomerId = "TestCustomerID";
226-
customerProfile.email = "[email protected]";
227-
228-
var request = new createCustomerProfileRequest { profile = customerProfile, validationMode = validationModeEnum.none};
229-
230-
var controller = new createCustomerProfileController(request);
231-
controller.Execute();
232-
233-
createCustomerProfileResponse response = controller.GetApiResponse();
234-
235-
if (response != null && response.messages.resultCode == messageTypeEnum.Ok)
236-
{
237-
if (response != null && response.messages.message != null)
238-
{
239-
Console.WriteLine("Success, CustomerProfileID : " + response.customerProfileId);
240-
}
241-
}
242-
else
243-
{
244-
Console.WriteLine("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text);
245-
}
108+
All the tests can be run against a stub backend using the USELOCAL run configuration.
246109

247-
````
110+
Get a sandbox account at https://developer.authorize.net/sandbox/
111+
Update app.config in the AuthorizeNetTest folder to run all the tests against your sandbox account
248112

113+
For reporting tests, go to https://sandbox.authorize.net/ under Account tab->Transaction Details API and enable it.
249114

250115

251116
## Credit Card Test Numbers

0 commit comments

Comments
 (0)