Skip to content
Port of Shopify's active_merchant ruby library to Objective-C
Objective-C
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
Classes
English.lproj
Tests
build
objective_merchant.xcodeproj
.gitignore
Info.plist
README.textile
objective_merchant_Prefix.pch
objective_merchant_tests-Info.plist

README.textile

Objective Merchant

This project is an open-source Objective-C port of the popular Shopify library, active_merchant , which enables developers to process sales transactions in Ruby.

The goal of the project is to duplicate as much of the core functionality from active_merchant as possible, but using Objective-C standards and design guidelines.

Initially, a limited number of processing gateways will be supported… mostly likely Authorize.Net and Paypal.

It is sponsored by Transparent Financial Services at TransFS.com.

Authorize.Net Example

Here is a basic example of how to use this library with the Authorize.Net gateway:


	BillingResponse *response;	
	[BillingBase setGatewayMode:Test];

	BillingCreditCard *card = [[BillingCreditCard alloc] init:[NSDictionary dictionaryWithObjectsAndKeys:
															   @"4111111111111111", @"number",
															   [NSNumber numberWithInt:8], @"month",
															   [NSNumber numberWithInt:2012], @"year",
															   @"Joshua", @"firstName",
															   @"Krall", @"lastName",
															   @"123", @"verificationValue",
															   nil]];
	
	if ([card is_valid])
	{
		AuthorizeNetGateway *gateway = [[AuthorizeNetGateway alloc] init:[NSDictionary dictionaryWithObjectsAndKeys:
																		  @"my_login", @"login",
																		  @"my_tran_key", @"password",
																		  nil]];

		response = [gateway authorize:[NSNumber numberWithInt:200] creditcard:card options:[[NSDictionary alloc] init]];
		if (![response is_success])
			[NSException raise:@"Authorize.Net Gateway Error, authorize:" format:[response message]];
		else {
			response = [gateway capture:[NSNumber numberWithInt:200] authorization:[response authorization] options:[[NSDictionary alloc] init]];
			if (![response is_success])
				[NSException raise:@"Authorize.Net Gateway Error, capture:" format:[response message]];
		}
	}

Something went wrong with that request. Please try again.