With Post Purchase SDK, you can enable your users to view and manage their Klarna purchases (pay, report return, snooze, etc.) inside your mobile application.
Post Purchase SDK helps you fetch users’ orders at Klarna and present available operations for each order, such as pay, return, snooze, etc.
We first need to know who the user is and if they consent to your application to access their Klarna purchases so we can share that information with you.
After the user gives consent, you will receive an authorization code that you can use to grab an access token and a refresh token from Klarna OAuth API. These tokens are your way to access the user information containing Klarna purchases and available operations (pay, return, etc.) for each purchase.
When you get that information from the previous step, you can present all the orders to the user and ask the SDK to render a specific operation (for example, pay for a purchase) via Klarna.
The first thing to do is to call initialize on the SDK with required parameters such as Locale, Purchase Country, and optionally the design identifier. These parameters are used to present the appropriate consent page and operation to the user.
In this step, we need to know which user it is (Client ID) that you want their consent so we can share information about their purchases. Also, we need to know where we should send the authorization code as a result (Return URL). You should also specify the access level you want the user to consent to (Scope).
After you retrieve the list of user purchases, you can ask the SDK to render a chosen operation for a specific purchase. For example, show Klarna’s return operation for a purchase (if available), so the user can report it to Klarna directly inside your application. You will get the result back in the application if you want to update the UI, sync up with your servers, etc.