2.0.1 | 2022-06-20

1.36.1 | 2022-06-15

2.0.0 | 2022-06-08

๐Ÿš€ New Features and Improvements

The version 2 of the SDK is out! This includes a simplified way to integrate Primer

<aside> ๐Ÿ“š Take a look at the migration guide for updating your integration to version 2.

</aside>

โœจ Payments created automatically

Universal Checkout | SDK

Creating payments with Universal Checkout is now seamless. Thereโ€™s no more need for callbacks, API calls and headaches to create a payment. Itโ€™s all done under the hood ๐Ÿง™

In the past, creating payments involved manual payment handling: On the client side, you would have had to implement the dreaded clientTokenCallback, onTokenizeSuccess and onResumeSuccess delegate functions:

extension MyViewController: PrimerDelegate {
 
   func clientTokenCallback(_ completion: @escaping(String ? , Error ? ) - > Void) {
      // API call to fetch client token from your backend.
      fetchClientToken() {
         (token, err) in
         completion(token, err)
      }
		}
 
	func onTokenizeSuccess(_ paymentMethodToken: PaymentMethodToken, resumeHandler: ResumeHandlerProtocol) {
	   // Send the payment method token to your server to create a payment
	   sendPaymentMethodToken(token: paymentMethodToken) { (res, err) in
	      if let err = err {
	         resumeHandler.handle(error: err)
	      } else if
	      let res = res {
	         guard
	         let requiredActionDic = res["requiredAction"] as ? [String: Any],
	            let clientToken = requiredActionDic["clientToken"] as ? String
	         else {
	            resumeHandler.handleSuccess()
	            return
	         }
	 
	         resumeHandler.handle(newClientToken: clientToken)
	      }
	   }
	}
 
	func onResumeSuccess(_ resumeToken: String, resumeHandler: ResumeHandlerProtocol) {
	   // Resume the payment
	   sendResumeToken(resumeToken) {
	      (res, err) in
	      if let err = err {
	         resumeHandler.handle(error: err)
	      } else if let res = res {
	         resumeHandler.handleSuccess()
	      }
	   }
	}

}

On the server side, you had to manually call our Payments API in order to create a payment ๐Ÿคท

Rejoice! As from version 2.0.0 no manual payment handling is required! Payment creation is now, as mentioned above, :chef-kiss: - seamless.

Feel free to rip out the above mentioned callbacks when migrating to version 2.0.0 and enjoy the feeling of utter relaxation as all your payment handling is now done by Universal Checkout ๐Ÿ’†