Repository navigation
Releases
Perfect-AuthNet 1.0.1
Perfect-AuthNet 1.0.1 fixes how amounts with more than two decimal places are sent. Before, they were handled differently on macOS and Linux. This release makes no API changes.
.package(url: "https://github.com/PerfectlySoft/Perfect-AuthNet.git", from: "1.0.1"),Fixed
- Amounts are rounded to the cent the same way on every platform. 1.0.0 formatted amounts with
NumberFormatter, and Linux's Foundation ignores its two-decimal limit. On Linux,49.995was sent to the gateway unchanged, as"49.995", while macOS sent"50.00". Amounts are now rounded to two places, half-to-even, on both platforms. This is what macOS already did, so macOS output is unchanged. For example,49.995is sent as50.00,49.985as49.98and0.015as0.02. Amounts with two or fewer decimal places are sent exactly as before (40becomes"40.00"). If your prices can have fractions of a cent and you want a different rounding rule, round them yourself before passing them in. (#2)
Verified
All 16 offline tests pass on macOS and on Linux with Swift 6.2 and 6.4, built with warnings as errors. Those tests include 10 new rounding cases and a locale check. Against the 1.0.0 code, 9 of the 10 rounding cases fail on Linux. CI on main (fb52c26) is green across all 8 jobs. As with 1.0.0, the live sandbox tests weren't run for this release.
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.