Repository navigation
Perfect-AuthNet 1.0.0
Perfect-AuthNet 1.0.0 is the first release. It's a small Swift client for the Authorize.net payment gateway's JSON API (request.api). It charges Accept.js and Accept Mobile payment nonces, so raw card numbers never reach your server. It uses only Foundation (URLSession and Codable).
.package(url: "https://github.com/PerfectlySoft/Perfect-AuthNet.git", from: "1.0.0"),Requirements
- Swift 6.2 or later (
swift-tools-version: 6.2, Swift 6 language mode). - macOS 12 or later, or Linux. CI covers Swift 6.2 and 6.4 on Ubuntu 24.04 and Xcode 26.0.1 and 26.6 on macOS, in debug and release, with warnings as errors.
- No package dependencies.
Highlights
AuthNetClient:charge,authorize,capture(full or partial),refundandvoid, allasync throws, against.sandboxor.production.- Payment input:
.nonce(value:)and.opaqueData(descriptor:value:)for tokenized payments, and.creditCard(number:expiration:code:)for server-to-server use or testing. - Declines aren't errors. A declined card comes back as a
TransactionResultwithapproved == false.AuthNetErrorcovers transport failures, malformed responses and gateway rejections. - Amounts are
Decimaland are sent as plain two-decimal strings (en_US_POSIX, no grouping). - The UTF-8 byte-order mark that the JSON API puts before its responses is stripped before decoding.
- Every public type is
Sendable.
Fixes
Against the pre-release main (01bebca), in #1:
- Linux: the package didn't build.
URLSessionandHTTPURLResponsewere used without importingFoundationNetworking. - Deployment target: lowered from macOS 26 to macOS 12. Nothing in the package needs anything newer.
- License: the repository had none and was effectively all rights reserved. It's now Apache 2.0.
Pull requests
- #1: PerfectlySoft baseline (Apache 2.0 license, CI, README, macOS 12, Linux build).
Known limitations
- Not covered yet: customer profiles (CIM, saved cards), recurring billing (ARB) and webhooks.
- The live sandbox tests (
AUTHNET_TESTS=1with sandbox credentials) weren't run for this release. Only the 14 offline tests were. The package hasn't handled production traffic, so test against the sandbox before going live. - Pass amounts with at most two decimal places. On macOS,
Foundationrounds a value like49.995half-to-even (50.00); on Linux it's sent unrounded (49.995), which the gateway is likely to reject. The client should round or reject such amounts itself; that's planned for a patch release. - Charging a raw card number puts your server in PCI scope. Use nonces in storefronts.
Verified: 14 offline tests pass on macOS and on Linux (Swift 6.2 and 6.4), and CI on main (950e265) is green across all 8 jobs. A scratch consumer resolving the package from PerfectlySoft/Perfect-AuthNet builds every README example with warnings as errors.