blindpaylabs/blindpay-swift
BlindPay's Swift SDK.
Installation
Swift Package Manager
Add the following to your Package.swift file:
dependencies: [
.package(url: "https://github.com/blindpaylabs/blindpay-swift.git", from: "1.0.0")
]Or add it via Xcode:
- File → Add Packages...
- Enter the repository URL:
https://github.com/blindpaylabs/blindpay-swift.git - Select the version and add it to your target
Authentication
To get started, you will need both your API key and your instance ID, you can obtain your API key and instance ID from the BlindPay dashboard https://app.blindpay.com/instances/<instance_id>/api-keys
import BlindPay
let blindpay = BlindPay(
apiKey: "your-api-key-here",
instanceId: "your-instance-id-here"
)[!NOTE] All API calls are going to use the provided API key and instance ID
Quick Start
Check for available rails
func getAvailableRails() async {
let blindpay = BlindPay(
apiKey: "your-api-key-here",
instanceId: "your-instance-id-here"
)
do {
let response = try await blindpay.getRails()
if let error = response.error {
throw NSError(domain: "BlindPay", code: -1, userInfo: [NSLocalizedDescriptionKey: error.message])
}
if let data = response.data {
print("Rails: ", data)
}
} catch {
print("Error: \(error)")
}
}
await getAvailableRails()Response format
All API methods return a consistent response format
Success response
APIResponse(
data: /* your data */,
error: nil
)Error response
APIResponse(
data: nil,
error: APIError(message: "Error message")
)Error handling
This SDK uses a consistent error handling pattern. Always check for errors:
do {
let response = try await blindpay.getRails()
if let error = response.error {
print("API Error: \(error.message)")
return
}
if let data = response.data {
print("Success:", data)
}
} catch {
print("Error: \(error)")
}For detailed API documentation, visit:
Support
- Email: eric@blindpay.com
- Issues: GitHub Issues
License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the BlindPay team
Package Metadata
Repository: blindpaylabs/blindpay-swift
Stars: 9
Forks: 2
Open issues: 1
Default branch: main
Primary language: swift
License: MIT
README: README.md