InApp Payments

Supporting Apple AppStore and Google PlayStore InApp Payments

While InApp Purchase is not only a very convinient way to pay for a subscription, it can also be used to replace an account creation flow, if the user only wants to use the product on one specific device or devices which are linked to his Apple or Google account. Apple and Google will take care of the authentication and the returned Receipt or Purchase Token can be used as an alternative way to authenticate the customer.

SDK is authenticated with existing user credentials, no customer details provided

  • Purchase is assigned to the existing account

SDK is authenticated with existing user credentials and customer details are provided

  • Purchase is assigned to the existing account

  • Account e-mail is being updated with the provided e-mail address

  • User will receive a mail which asks him to confirm the new e-mail address

  • The response will have email_confirmation_required set to true

  • The next time, the user tries to login with the provided e-mail address, the "reset password" flow is being triggered, allowing the user to set a password.

SDK is not authenticated yet, customer details provided

  • Backend will create a new account and links the purchase to that account

  • The account is created using the specified details

  • The next time, the user tries to login with the provided e-mail address, the "reset password" flow is being triggered, allowing the user to set a password.

  • The response will have email_confirmation_required set to true

SDK is not authenticated yet, NO customer details provided

  • Similar to the previous scenario, just that the backend will generate a random username and password without sending a confirmation mail and the auto_account_created flag in the response is set to true

process_apple_payment

This will send a JWT Receipt or Transaction ID to the backend.

Parameters

Name
Type
Description

jwt_receipt

String

This is the JWT Receipt of the transaction

transaction_id

String

This is the transaction id of the transaction. You need to provide either the receipt or the transaction id.

customer_details

Optional Customer Details, if provided a new account will be created with the details, if an account is already linked with the receipt, the account is updated with the new details

conversion_details

Optional Conversion Details for Appsflyer Conversion, usually required only for new purchases

Returns

Returns an InAppPaymentResponse upon success, otherwise SDKException.

process_google_payment

This will send a Google Playstore Purchase Token to the backend.

Parameters

Name
Type
Description

purchase_token

String

This is the Purchase

customer_details

Optional Customer Details, if provided a new account will be created with the details, if an account is already linked with the receipt, the account is updated with the new details

conversion_details

Optional Conversion Details for Appsflyer Conversion, usually required only for new purchases

Returns

Returns an InAppPaymentResponse upon success, otherwise SDKException.

Types

InAppCustomerDetailsBody

Name
Type
Description

email

String

E-Mail to be set or updated

InAppAflyrBody

Name
Type
Description

referrer_id

String

Referrer ID

apple_search_ads

String

JSON Content of the Apple Search Ads JSON

InAppPaymentResponse

Name
Type
Description

login_url

String

This URL needs to be opened in order to log the user in. It will basically follow the OpenID Connect Login flow and as such requires the same mechanism to be applied (e.g. opening the URL with ASWebAuthenticationSession in iOS)

account_switched

Bool

This value is true if the Access Token is for a different account than the one logged in during the request.

email_confirmation_required

Bool

If customer_details are provided and setting or updating the email requires the user to click on a confirmation link, this value will be true

auto_account_created

Bool

If true, it indicates, that the account has been automatically created and the customer might want to customize it, by providing an e-mail

Last updated