Skip to content

StripeKit 1.0.6

Pre-release
Pre-release
Compare
Choose a tag to compare
@Andrewangeta Andrewangeta released this 16 Jul 00:12
a6142b3

This release adopts the NIO pattern of retuning failed EventLoopFutures 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)")
  }