StripeKit 1.0.6
Pre-release
Pre-release
This release adopts the NIO pattern of retuning failed EventLoopFuture
s rather than having throwing functions. So instead of a do
catch
pattern you would opt for something like this instead
stripe.charges.create(amount: 2500,
currency: .usd,
description: "A server written in swift.",
source: "tok_visa")
.flatMap { (charge) -> EventLoopFuture<Void> in
if charge.status == .succeeded {
print("New servers are on the way 🚀")
} else {
print("Sorry you have to use Node.js 🤢")
}
}
.flatMapError { error in
print("Stripe error \(error.message)")
}