Mobile SDK Integration
Integrate BLAQPAY into your iOS and Android apps
Mobile SDK Integration
Integrate cryptocurrency payments into your mobile apps with our native iOS and Android SDKs.
iOS SDK
Installation
CocoaPods
# Podfile
pod 'BlaqPay', '~> 1.0' Swift Package Manager
dependencies: [
.package(url: "https://github.com/blaqpay/blaqpay-ios", from: "1.0.0")
] Swift Example
import BlaqPay
// Initialize SDK
let blaqpay = BlaqPay(apiKey: "pk_test_YOUR_KEY")
// Create payment
blaqpay.createOrder(
amount: 99.99,
currency: "USD",
cryptoCurrency: "BTC"
) { result in
switch result {
case .success(let order):
// Present checkout
blaqpay.presentCheckout(order: order, from: self)
case .failure(let error):
print("Error: (error)")
}
}
// Handle payment completion
extension MyViewController: BlaqPayDelegate {
func blaqpayDidCompletePayment(_ order: Order) {
print("Payment successful!")
}
func blaqpayDidCancelPayment() {
print("Payment cancelled")
}
} Android SDK
Installation
Gradle
dependencies {
implementation 'com.blaqpay:android-sdk:1.0.0'
} Kotlin Example
import com.blaqpay.BlaqPay
import com.blaqpay.models.Order
// Initialize SDK
val blaqpay = BlaqPay(apiKey = "pk_test_YOUR_KEY")
// Create payment
blaqpay.createOrder(
amount = 99.99,
currency = "USD",
cryptoCurrency = "BTC"
) { result ->
when (result) {
is Result.Success -> {
// Launch checkout
blaqpay.launchCheckout(this, result.data)
}
is Result.Failure -> {
Log.e("Payment", "Error: ${result.error}")
}
}
}
// Handle payment result
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
blaqpay.handleActivityResult(requestCode, resultCode, data) { result ->
when (result) {
is PaymentResult.Completed -> {
Toast.makeText(this, "Payment successful!", Toast.LENGTH_SHORT).show()
}
is PaymentResult.Cancelled -> {
Toast.makeText(this, "Payment cancelled", Toast.LENGTH_SHORT).show()
}
is PaymentResult.Failed -> {
Toast.makeText(this, "Payment failed: ${result.error}", Toast.LENGTH_SHORT).show()
}
}
}
} React Native
Installation
npm install @blaqpay/react-native Example
import { BlaqPay } from '@blaqpay/react-native';
// Initialize
BlaqPay.initialize('pk_test_YOUR_KEY');
// Create payment
const handlePayment = async () => {
try {
const order = await BlaqPay.createOrder({
amount: 99.99,
currency: 'USD',
cryptoCurrency: 'BTC'
});
const result = await BlaqPay.presentCheckout(order.id);
if (result.status === 'completed') {
console.log('Payment successful!');
}
} catch (error) {
console.error('Payment failed:', error);
}
}; Flutter
Installation
dependencies:
blaqpay_flutter: ^1.0.0 Example
import 'package:blaqpay_flutter/blaqpay_flutter.dart';
// Initialize
final blaqpay = BlaqPay(apiKey: 'pk_test_YOUR_KEY');
// Create payment
Future<void> handlePayment() async {
try {
final order = await blaqpay.createOrder(
amount: 99.99,
currency: 'USD',
cryptoCurrency: 'BTC',
);
final result = await blaqpay.presentCheckout(order.id);
if (result.status == PaymentStatus.completed) {
print('Payment successful!');
}
} catch (e) {
print('Payment failed: $e');
}
} Features
- ✅ Native checkout UI
- ✅ QR code scanning
- ✅ Deep linking support
- ✅ Biometric authentication
- ✅ Offline mode support
- ✅ Automatic updates
