Affirm Payment method in Swift

Updated 30 May 2022


In this article, we will learn how to integrate the Affirm payment method in Swift.

Affirm payment method allows user to pay the cost of the purchase in simple EMI’s.

If you are having a e-commerce based application you can integrate the Affirm payment method for the large amount purchases.

So lets begin with the article.

Overview of Affirm Payment method in Swift

Affirm checkout process involves selecting the payment method at the checkout.

Affirm SDK interacts with the merchant site, a checkout object is created and redirected to the Affirm server.

A checkout object contains the cart information. This opens a UI for the Affirm payments.

Setting up Affirm Payment method in Swift

If you have Cocoapods installed then you can use the below commands to get the SDK into your project.

Open your terminal and navigate to the project directory. Then run below commands.

A podfile will be opened in the TextEdit, add below code in the file.

Save the file and hit below command.

Now, the SDK will be installed in your project.

Affirm Checkout

You need to have a developer account with Affirm, from where you can check the sales of your product. Also you will get a PUBLIC KEY.

After that, use this public key in your AppDelegate inside the didFinishLaunchingWithOptions as

Do not forget to import the SDK on your ViewController

Now use collect the Shipping information from the checkout and use below code to initialze the checkout object.

After that, you will see the SDK response like below

Affirm Payment method in Swift


You can aditionally show the promotional message at your Product description page.

Use Promotional button to reflect the EMI options. For more details refer here

To read more articles please visit here.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home