The official Swift SDK for BlindPay - Global payments infrastructure made simple.
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
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
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()All API methods return a consistent response format
APIResponse(
data: /* your data */,
error: nil
)APIResponse(
data: nil,
error: APIError(message: "Error message")
)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:
- Email: eric@blindpay.com
- Issues: GitHub Issues
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the BlindPay team
