<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.barion.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Macika</id>
	<title>Barion Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.barion.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Macika"/>
	<link rel="alternate" type="text/html" href="https://docs.barion.com/Special:Contributions/Macika"/>
	<updated>2026-11-21T07:52:49Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://docs.barion.com/index.php?title=BankAccountNumberFormat&amp;diff=3464</id>
		<title>BankAccountNumberFormat</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=BankAccountNumberFormat&amp;diff=3464"/>
		<updated>2022-07-12T08:26:31Z</updated>

		<summary type="html">&lt;p&gt;Macika: Reverted edits by Macika (talk) to last revision by Stankovicsa&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageTitle|title=Bank account number format enumeration}}&lt;br /&gt;
&lt;br /&gt;
This enum indicates the format of a bank account number, when initiating bank (wire) transfers.&lt;br /&gt;
&lt;br /&gt;
= Included in = &lt;br /&gt;
&lt;br /&gt;
This enum is used in the following structures:&lt;br /&gt;
* [[BankAccount]]&lt;br /&gt;
&lt;br /&gt;
= API usage =&lt;br /&gt;
&lt;br /&gt;
This enum is used by the following API endpoints:&lt;br /&gt;
* [[Withdraw-BankTransfer-v2]]&lt;br /&gt;
&lt;br /&gt;
= Enum list =&lt;br /&gt;
&lt;br /&gt;
{{api_enum_table_header}}&lt;br /&gt;
|-&lt;br /&gt;
| Unknown || -1 || The bank account number format is unknown.&lt;br /&gt;
|-&lt;br /&gt;
| Giro || 1 || Hungarian GIRO-format, which can be either 2×8 or 3×8 characters.&lt;br /&gt;
|-&lt;br /&gt;
| IBAN || 2 || Standard International Bank Account Number format. Its length depends on the recipient&#039;s bank&#039;s country.&lt;br /&gt;
|-&lt;br /&gt;
| Czech || 3 || Czech BBANK Format, length could vary between 12 and 20 characters.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| Other || 10 || Every other formats, where the others are not applicable (e.g. Sort Code)&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=BankAccountNumberFormat&amp;diff=3463</id>
		<title>BankAccountNumberFormat</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=BankAccountNumberFormat&amp;diff=3463"/>
		<updated>2022-07-12T08:15:09Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageTitle|title=Bank account number format enumeration}}&lt;br /&gt;
&lt;br /&gt;
This enum indicates the format of a bank account number, when initiating bank (wire) transfers.&lt;br /&gt;
&lt;br /&gt;
= Included in = &lt;br /&gt;
&lt;br /&gt;
This enum is used in the following structures:&lt;br /&gt;
* [[BankAccount]]&lt;br /&gt;
&lt;br /&gt;
= API usage =&lt;br /&gt;
&lt;br /&gt;
This enum is used by the following API endpoints:&lt;br /&gt;
* [[Withdraw-BankTransfer-v2]]&lt;br /&gt;
&lt;br /&gt;
= Enum list =&lt;br /&gt;
&lt;br /&gt;
{{api_enum_table_header}}&lt;br /&gt;
|-&lt;br /&gt;
| Unknown || -1 || The bank account number format is unknown.&lt;br /&gt;
|-&lt;br /&gt;
| Giro || 1 || Hungarian GIRO-format, which can be either 2×8 or 3×8 characters.&lt;br /&gt;
|-&lt;br /&gt;
| IBAN || 2 || Standard International Bank Account Number format. Its length depends on the recipient&#039;s bank&#039;s country.&lt;br /&gt;
|-&lt;br /&gt;
| Czech || 3 || Czech BBANK Format, length could vary between 12 and 20 characters.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| Other || 10 || Every other formats, where the others are not applicable (e.g. Sort Code) &#039;&#039;&#039;DEPRECATED in v3&#039;&#039;&#039;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=BankAccountNumberFormat&amp;diff=3462</id>
		<title>BankAccountNumberFormat</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=BankAccountNumberFormat&amp;diff=3462"/>
		<updated>2022-07-12T08:13:25Z</updated>

		<summary type="html">&lt;p&gt;Macika: Reverted edits by Macika (talk) to last revision by Stankovicsa&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageTitle|title=Bank account number format enumeration}}&lt;br /&gt;
&lt;br /&gt;
This enum indicates the format of a bank account number, when initiating bank (wire) transfers.&lt;br /&gt;
&lt;br /&gt;
= Included in = &lt;br /&gt;
&lt;br /&gt;
This enum is used in the following structures:&lt;br /&gt;
* [[BankAccount]]&lt;br /&gt;
&lt;br /&gt;
= API usage =&lt;br /&gt;
&lt;br /&gt;
This enum is used by the following API endpoints:&lt;br /&gt;
* [[Withdraw-BankTransfer-v2]]&lt;br /&gt;
&lt;br /&gt;
= Enum list =&lt;br /&gt;
&lt;br /&gt;
{{api_enum_table_header}}&lt;br /&gt;
|-&lt;br /&gt;
| Unknown || -1 || The bank account number format is unknown.&lt;br /&gt;
|-&lt;br /&gt;
| Giro || 1 || Hungarian GIRO-format, which can be either 2×8 or 3×8 characters.&lt;br /&gt;
|-&lt;br /&gt;
| IBAN || 2 || Standard International Bank Account Number format. Its length depends on the recipient&#039;s bank&#039;s country.&lt;br /&gt;
|-&lt;br /&gt;
| Czech || 3 || Czech BBANK Format, length could vary between 12 and 20 characters.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| Other || 10 || Every other formats, where the others are not applicable (e.g. Sort Code)&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=BankAccountNumberFormat&amp;diff=3461</id>
		<title>BankAccountNumberFormat</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=BankAccountNumberFormat&amp;diff=3461"/>
		<updated>2022-07-12T08:12:51Z</updated>

		<summary type="html">&lt;p&gt;Macika: /* Enum list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageTitle|title=Bank account number format enumeration}}&lt;br /&gt;
&lt;br /&gt;
This enum indicates the format of a bank account number, when initiating bank (wire) transfers.&lt;br /&gt;
&lt;br /&gt;
= Included in = &lt;br /&gt;
&lt;br /&gt;
This enum is used in the following structures:&lt;br /&gt;
* [[BankAccount]]&lt;br /&gt;
&lt;br /&gt;
= API usage =&lt;br /&gt;
&lt;br /&gt;
This enum is used by the following API endpoints:&lt;br /&gt;
* [[Withdraw-BankTransfer-v2]]&lt;br /&gt;
&lt;br /&gt;
= Enum list =&lt;br /&gt;
&lt;br /&gt;
{{api_enum_table_header}}&lt;br /&gt;
|-&lt;br /&gt;
| Unknown || -1 || The bank account number format is unknown.&lt;br /&gt;
|-&lt;br /&gt;
| Giro || 1 || Hungarian GIRO-format, which can be either 2×8 or 3×8 characters.&lt;br /&gt;
|-&lt;br /&gt;
| IBAN || 2 || Standard International Bank Account Number format. Its length depends on the recipient&#039;s bank&#039;s country.&lt;br /&gt;
|-&lt;br /&gt;
| Czech || 3 || Czech BBANK Format, length could vary between 12 and 20 characters.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=PayeeTransaction&amp;diff=1623</id>
		<title>PayeeTransaction</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=PayeeTransaction&amp;diff=1623"/>
		<updated>2019-02-13T15:04:27Z</updated>

		<summary type="html">&lt;p&gt;Macika: /* Property list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{PageTitle|title=Payee transaction structure}}&lt;br /&gt;
&lt;br /&gt;
This structure represents payee transaction included in a payment transaction. These are e-money sub-transactions that are executed after the payment was fully completed.&lt;br /&gt;
&lt;br /&gt;
Payee transactions can be used to transfer royalties, agent fees or such to a third party, or to distribute the amount paid by the payer to multiple Barion wallets.&lt;br /&gt;
&lt;br /&gt;
== Included in == &lt;br /&gt;
&lt;br /&gt;
Payee transactions are used in the following structures:&lt;br /&gt;
* [[PaymentTransaction]]&lt;br /&gt;
&lt;br /&gt;
== Property list ==&lt;br /&gt;
&lt;br /&gt;
{{api_input_table_header}}&lt;br /&gt;
|-&lt;br /&gt;
| POSTransactionId || string || &lt;br /&gt;
* Required&lt;br /&gt;
* Maximum length: 100 characters&lt;br /&gt;
|| The unique identifier of the transaction at the shop that started the payment.&lt;br /&gt;
|-&lt;br /&gt;
| Payee || string || &lt;br /&gt;
* Required&lt;br /&gt;
* Must be the e-mail address of a valid Barion wallet&lt;br /&gt;
* Maximum length: 256 characters&lt;br /&gt;
|| The recipient&#039;s e-mail address. &lt;br /&gt;
|-&lt;br /&gt;
| Total || decimal || &lt;br /&gt;
* Required&lt;br /&gt;
* Must be greater than zero&lt;br /&gt;
* Maximum value: the Total amount of the [[PaymentTransaction]] containing this PayeeTransaction&lt;br /&gt;
|| The total amount of the transaction.&lt;br /&gt;
|-&lt;br /&gt;
| Comment || string || &lt;br /&gt;
* Optional &lt;br /&gt;
* Maximum length: 640 characters&lt;br /&gt;
|| Comment of the transaction. This is shown to the recipient.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_payment&amp;diff=1536</id>
		<title>App2App payment</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_payment&amp;diff=1536"/>
		<updated>2019-02-08T09:36:55Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Barion App2App Payment makes it possible to easily pay with Barion balance or credit card through [[Getting_started|Barion Smart Gateway]] and purchase any goods/services in the integration applications. &lt;br /&gt;
. &lt;br /&gt;
&lt;br /&gt;
Payment is initiated by an application. There are two ways to pay:&lt;br /&gt;
*If the Barion mobile application is available on the mobile device (iOS, Android) the customer will pay in the Barion mobile app. In order to use the Barion mobile app, the customer must have an activated Barion wallet.&lt;br /&gt;
*If the Barion mobile application isn&#039;t available on the mobile device the payment is made on Barion&#039;s responsive website, just like for web payment. The website is accessible on every platform and customers don&#039;t have to have Barion wallet.&lt;br /&gt;
The documentation below shows the integration processes.&lt;br /&gt;
&lt;br /&gt;
Before you start to integrate we recommend reading [[Sandbox| this description]].&lt;br /&gt;
&lt;br /&gt;
==Integration possibilities==&lt;br /&gt;
You can integrate [[Getting_started|Barion Smart Gateway]] into mobile apps in three ways:&lt;br /&gt;
# &#039;&#039;&#039;With your own server-side&#039;&#039;&#039;&lt;br /&gt;
#* In this case, the mobile application doesn&#039;t communicate directly with the Barion system.&lt;br /&gt;
#* On your server-side you can use for example our PHP Library, you can find it on [https://github.com/barion Barion&#039;s Github page]&lt;br /&gt;
# &#039;&#039;&#039;With Barion Mobile Library&#039;&#039;&#039;&lt;br /&gt;
#* In this case, your mobile application will communicate with the Barion System through our Barion Mobile Library.&lt;br /&gt;
#* You can find Android and iOS libraries on [https://github.com/barion Barion&#039;s GitHub page]&lt;br /&gt;
# &#039;&#039;&#039;Totally native implementation (we don&#039;t recommend it)&#039;&#039;&#039;&lt;br /&gt;
#* In this case, your mobile application will communicate directly with the Barion System and you need to implement everything on your own.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;In all cases, it is highly recommended to obfuscate client applications! We recommend using [http://developer.android.com/tools/help/proguard.html ProGuard] or [https://www.guardsquare.com/dexguard DexGuard].&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see the integration possibilities pros and cons in this table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;|Using server-side&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
* The client application won&#039;t contain sensitive information.&lt;br /&gt;
* Because the client application will communicate at first with your own server-side you can log the network communication and also you can add extra information to it.&lt;br /&gt;
|&lt;br /&gt;
* Includes additional server side enhancements.&lt;br /&gt;
* you need to handle the availability of the Barion application on the users device.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[File:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;| With Barion Mobile Library&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
|style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
* The library will handle the whole communication with the Barion System&lt;br /&gt;
* You don&#039;t need to handle when Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|&lt;br /&gt;
* The integrator application will contain the POSKey.&lt;br /&gt;
* In order for the integrator&#039;s server-side to be notified about the payments, the client should send it.&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;| Native solution (not recommended)&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
|style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
* A lot of sensitive information will be in the integrator application.&lt;br /&gt;
* The integrator application should handle every network communication.&lt;br /&gt;
* You need to handle when the Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Integration descriptions==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%&amp;quot;&lt;br /&gt;
| style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[File: android_logo.png|center|256px]] Integrate on Android&lt;br /&gt;
| style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[File: ios_logo.png|center|256px]] Integrate on iOS&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* [[App2App_integration_on_android_with_server_side | Using server-side]]&lt;br /&gt;
* [[App2App_integration_with_android_library|With Library]]&lt;br /&gt;
|&lt;br /&gt;
* [[App2App_integration_on_ios_with_server_side|Using server-side]]&lt;br /&gt;
* [[App2App_integration_with_ios_library|With Library]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
* [https://github.com/barion/barion-android-java-app2app Android example on GitHub]&lt;br /&gt;
* [https://github.com/barion/barion-ios-objc-app2app iOS example on GitHub]&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=File:Ios_logo.png&amp;diff=1535</id>
		<title>File:Ios logo.png</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=File:Ios_logo.png&amp;diff=1535"/>
		<updated>2019-02-08T08:39:25Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=File:Android_logo.png&amp;diff=1534</id>
		<title>File:Android logo.png</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=File:Android_logo.png&amp;diff=1534"/>
		<updated>2019-02-08T08:36:15Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_payment&amp;diff=1533</id>
		<title>App2App payment</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_payment&amp;diff=1533"/>
		<updated>2019-02-08T08:35:36Z</updated>

		<summary type="html">&lt;p&gt;Macika: /* Integration descriptions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Barion App2App Payment makes it possible to easily pay with Barion balance or credit card through [[Barion_Smart_Gateway|Barion Smart Gateway]] and purchase any goods/services in the integration applications. &lt;br /&gt;
. &lt;br /&gt;
&lt;br /&gt;
Payment is initiated by an application. There are two ways to pay:&lt;br /&gt;
*If the Barion mobile application is available on the mobile device (iOS, Android) the customer will pay in the Barion mobile app. In order to use the Barion mobile app, the customer must have an activated Barion wallet.&lt;br /&gt;
*If the Barion mobile application isn&#039;t available on the mobile device the payment is made on Barion&#039;s responsive website, just like for web payment. The website is accessible on every platform and customers don&#039;t have to have Barion wallet.&lt;br /&gt;
The documentation below shows the integration processes.&lt;br /&gt;
&lt;br /&gt;
Before you start to integrate we recommend reading [[API_h%C3%ADv%C3%A1s_alapok| this description]].&lt;br /&gt;
&lt;br /&gt;
==Integration possibilities==&lt;br /&gt;
You can integrate [[Barion_Smart_Gateway|Barion Smart Gateway]] into mobile apps in three ways:&lt;br /&gt;
# &#039;&#039;&#039;With your own server-side&#039;&#039;&#039;&lt;br /&gt;
#* In this case, the mobile application doesn&#039;t communicate directly with the Barion system.&lt;br /&gt;
#* On your server-side you can use for example our PHP Library, you can find it on [https://github.com/barion Barion&#039;s Github page]&lt;br /&gt;
# &#039;&#039;&#039;With Barion Mobile Library&#039;&#039;&#039;&lt;br /&gt;
#* In this case, your mobile application will communicate with the Barion System through our Barion Mobile Library.&lt;br /&gt;
#* You can find Android and iOS libraries on [https://github.com/barion Barion&#039;s GitHub page]&lt;br /&gt;
# &#039;&#039;&#039;Totally native implementation (we don&#039;t recommend it)&#039;&#039;&#039;&lt;br /&gt;
#* In this case, your mobile application will communicate directly with the Barion System and you need to implement everything on your own.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;In all cases, it is highly recommended to obfuscate client applications! We recommend using [http://developer.android.com/tools/help/proguard.html ProGuard] or [https://www.guardsquare.com/dexguard DexGuard].&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see the integration possibilities pros and cons in this table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;|Using server-side&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
* The client application won&#039;t contain sensitive information.&lt;br /&gt;
* Because the client application will communicate at first with your own server-side you can log the network communication and also you can add extra information to it.&lt;br /&gt;
|&lt;br /&gt;
* Includes additional server side enhancements.&lt;br /&gt;
* you need to handle the availability of the Barion application on the users device.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[File:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;| With Barion Mobile Library&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
|style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
* The library will handle the whole communication with the Barion System&lt;br /&gt;
* You don&#039;t need to handle when Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|&lt;br /&gt;
* The integrator application will contain the POSKey.&lt;br /&gt;
* In order for the integrator&#039;s server-side to be notified about the payments, the client should send it.&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;| Native solution (not recommended)&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
|style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
* A lot of sensitive information will be in the integrator application.&lt;br /&gt;
* The integrator application should handle every network communication.&lt;br /&gt;
* You need to handle when the Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Integration descriptions==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%&amp;quot;&lt;br /&gt;
| style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[File: android_logo.png|center|256px]] Integrate on Android&lt;br /&gt;
| style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[File: ios_logo.png|center|256px]] Integrate on iOS&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* [[App2App_integration_on_android_with_server_side | Using server-side]]&lt;br /&gt;
* [[App2App_integration_with_android_library|With Library]]&lt;br /&gt;
|&lt;br /&gt;
* [[App2App_integration_on_ios_with_server_side|Using server-side]]&lt;br /&gt;
* [[App2App_integration_with_ios_library|With Library]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
* [https://github.com/barion/barion-android-java-app2app Android example on GitHub]&lt;br /&gt;
* [https://github.com/barion/barion-ios-objc-app2app iOS example on GitHub]&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_payment&amp;diff=1532</id>
		<title>App2App payment</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_payment&amp;diff=1532"/>
		<updated>2019-02-08T08:32:59Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Barion App2App Payment makes it possible to easily pay with Barion balance or credit card through [[Barion_Smart_Gateway|Barion Smart Gateway]] and purchase any goods/services in the integration applications. &lt;br /&gt;
. &lt;br /&gt;
&lt;br /&gt;
Payment is initiated by an application. There are two ways to pay:&lt;br /&gt;
*If the Barion mobile application is available on the mobile device (iOS, Android) the customer will pay in the Barion mobile app. In order to use the Barion mobile app, the customer must have an activated Barion wallet.&lt;br /&gt;
*If the Barion mobile application isn&#039;t available on the mobile device the payment is made on Barion&#039;s responsive website, just like for web payment. The website is accessible on every platform and customers don&#039;t have to have Barion wallet.&lt;br /&gt;
The documentation below shows the integration processes.&lt;br /&gt;
&lt;br /&gt;
Before you start to integrate we recommend reading [[API_h%C3%ADv%C3%A1s_alapok| this description]].&lt;br /&gt;
&lt;br /&gt;
==Integration possibilities==&lt;br /&gt;
You can integrate [[Barion_Smart_Gateway|Barion Smart Gateway]] into mobile apps in three ways:&lt;br /&gt;
# &#039;&#039;&#039;With your own server-side&#039;&#039;&#039;&lt;br /&gt;
#* In this case, the mobile application doesn&#039;t communicate directly with the Barion system.&lt;br /&gt;
#* On your server-side you can use for example our PHP Library, you can find it on [https://github.com/barion Barion&#039;s Github page]&lt;br /&gt;
# &#039;&#039;&#039;With Barion Mobile Library&#039;&#039;&#039;&lt;br /&gt;
#* In this case, your mobile application will communicate with the Barion System through our Barion Mobile Library.&lt;br /&gt;
#* You can find Android and iOS libraries on [https://github.com/barion Barion&#039;s GitHub page]&lt;br /&gt;
# &#039;&#039;&#039;Totally native implementation (we don&#039;t recommend it)&#039;&#039;&#039;&lt;br /&gt;
#* In this case, your mobile application will communicate directly with the Barion System and you need to implement everything on your own.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;In all cases, it is highly recommended to obfuscate client applications! We recommend using [http://developer.android.com/tools/help/proguard.html ProGuard] or [https://www.guardsquare.com/dexguard DexGuard].&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see the integration possibilities pros and cons in this table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;|Using server-side&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
* The client application won&#039;t contain sensitive information.&lt;br /&gt;
* Because the client application will communicate at first with your own server-side you can log the network communication and also you can add extra information to it.&lt;br /&gt;
|&lt;br /&gt;
* Includes additional server side enhancements.&lt;br /&gt;
* you need to handle the availability of the Barion application on the users device.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[File:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;| With Barion Mobile Library&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
|style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
* The library will handle the whole communication with the Barion System&lt;br /&gt;
* You don&#039;t need to handle when Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|&lt;br /&gt;
* The integrator application will contain the POSKey.&lt;br /&gt;
* In order for the integrator&#039;s server-side to be notified about the payments, the client should send it.&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;| Native solution (not recommended)&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
|style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
* A lot of sensitive information will be in the integrator application.&lt;br /&gt;
* The integrator application should handle every network communication.&lt;br /&gt;
* You need to handle when the Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Integration descriptions==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%&amp;quot;&lt;br /&gt;
| style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[Fájl: android_logo.png|center|256px]] Integrate on Android&lt;br /&gt;
| style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[Fájl: ios_logo.png|center|256px]] Integrate on iOS&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* [[Barion_App2App_integráció_Androidon_szerver_oldal_közbeiktatásával | Using server-side]]&lt;br /&gt;
* [[Barion_App2App_integráció_Androidon_library_használatával|With Library]]&lt;br /&gt;
|&lt;br /&gt;
* [[Barion_App2App_integráció_iOSen_szerver_oldal_közbeiktatásával|Using server-side]]&lt;br /&gt;
* [[Barion_App2App_integráció_iOSen_library_használatával|With Library]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
* [https://github.com/barion/barion-android-java-app2app Android example on GitHub]&lt;br /&gt;
* [https://github.com/barion/barion-ios-objc-app2app iOS example on GitHub]&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_payment&amp;diff=1531</id>
		<title>App2App payment</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_payment&amp;diff=1531"/>
		<updated>2019-02-08T08:31:17Z</updated>

		<summary type="html">&lt;p&gt;Macika: /* Integration possibilities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Barion App2App Payment makes it possible to easily pay with Barion balance or credit card through [[Barion_Smart_Gateway|Barion Smart Gateway]] and purchase any goods/services in the integration applications. &lt;br /&gt;
. &lt;br /&gt;
&lt;br /&gt;
Payment is initiated by an application. There are two ways to pay:&lt;br /&gt;
*If the Barion mobile application is available on the mobile device (iOS, Android) the customer will pay in the Barion mobile app. In order to use the Barion mobile app, the customer must have an activated Barion wallet.&lt;br /&gt;
*If the Barion mobile application isn&#039;t available on the mobile device the payment is made on Barion&#039;s responsive website, just like for web payment. The website is accessible on every platform and customers don&#039;t have to have Barion wallet.&lt;br /&gt;
The documentation below shows the integration processes.&lt;br /&gt;
&lt;br /&gt;
Before you start to integrate we recommend reading [[API_h%C3%ADv%C3%A1s_alapok| this description]].&lt;br /&gt;
&lt;br /&gt;
==Integration possibilities==&lt;br /&gt;
You can integrate [[Barion_Smart_Gateway|Barion Smart Gateway]] into mobile apps in three ways:&lt;br /&gt;
# &#039;&#039;&#039;With your own server-side&#039;&#039;&#039;&lt;br /&gt;
#* In this case, the mobile application doesn&#039;t communicate directly with the Barion system.&lt;br /&gt;
#* On your server-side you can use for example our PHP Library, you can find it on [https://github.com/barion Barion&#039;s Github page]&lt;br /&gt;
# &#039;&#039;&#039;With Barion Mobile Library&#039;&#039;&#039;&lt;br /&gt;
#* In this case, your mobile application will communicate with the Barion System through our Barion Mobile Library.&lt;br /&gt;
#* You can find Android and iOS libraries on [https://github.com/barion Barion&#039;s GitHub page]&lt;br /&gt;
# &#039;&#039;&#039;Totally native implementation (we don&#039;t recommend it)&#039;&#039;&#039;&lt;br /&gt;
#* In this case, your mobile application will communicate directly with the Barion System and you need to implement everything on your own.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;In all cases, it is highly recommended to obfuscate client applications! We recommend using [http://developer.android.com/tools/help/proguard.html ProGuard] or [https://www.guardsquare.com/dexguard DexGuard].&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see the integration possibilities pros and cons in this table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;|Using server-side&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
* The client application won&#039;t contain sensitive information.&lt;br /&gt;
* Because the client application will communicate at first with your own server-side you can log the network communication and also you can add extra information to it.&lt;br /&gt;
|&lt;br /&gt;
* Includes additional server side enhancements.&lt;br /&gt;
* You need to handle when the Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[File:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;| With Barion Mobile Library&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
|style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
* The library will handle the whole communication with the Barion System&lt;br /&gt;
* You don&#039;t need to handle when Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|&lt;br /&gt;
* The integrator application will contain the POSKey.&lt;br /&gt;
* In order for the integrator&#039;s server-side to be notified about the payments, the client should send it.&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;| Native solution (not recommended)&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
|style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
* A lot of sensitive information will be in the integrator application.&lt;br /&gt;
* The integrator application should handle every network communication.&lt;br /&gt;
* You need to handle when the Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Integration descriptions==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%&amp;quot;&lt;br /&gt;
| style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[Fájl: android_logo.png|center|256px]] Integrate on Android&lt;br /&gt;
| style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[Fájl: ios_logo.png|center|256px]] Integrate on iOS&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* [[Barion_App2App_integráció_Androidon_szerver_oldal_közbeiktatásával | Using server-side]]&lt;br /&gt;
* [[Barion_App2App_integráció_Androidon_library_használatával|With Library]]&lt;br /&gt;
|&lt;br /&gt;
* [[Barion_App2App_integráció_iOSen_szerver_oldal_közbeiktatásával|Using server-side]]&lt;br /&gt;
* [[Barion_App2App_integráció_iOSen_library_használatával|With Library]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
* [https://github.com/barion/barion-android-java-app2app Android example on GitHub]&lt;br /&gt;
* [https://github.com/barion/barion-ios-objc-app2app iOS example on GitHub]&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_payment&amp;diff=1530</id>
		<title>App2App payment</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_payment&amp;diff=1530"/>
		<updated>2019-02-08T08:30:48Z</updated>

		<summary type="html">&lt;p&gt;Macika: Created page with &amp;quot;__NOTOC__ Barion App2App Payment makes it possible to easily pay with Barion balance or credit card through Barion Smart Gateway and purchase any good...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Barion App2App Payment makes it possible to easily pay with Barion balance or credit card through [[Barion_Smart_Gateway|Barion Smart Gateway]] and purchase any goods/services in the integration applications. &lt;br /&gt;
. &lt;br /&gt;
&lt;br /&gt;
Payment is initiated by an application. There are two ways to pay:&lt;br /&gt;
*If the Barion mobile application is available on the mobile device (iOS, Android) the customer will pay in the Barion mobile app. In order to use the Barion mobile app, the customer must have an activated Barion wallet.&lt;br /&gt;
*If the Barion mobile application isn&#039;t available on the mobile device the payment is made on Barion&#039;s responsive website, just like for web payment. The website is accessible on every platform and customers don&#039;t have to have Barion wallet.&lt;br /&gt;
The documentation below shows the integration processes.&lt;br /&gt;
&lt;br /&gt;
Before you start to integrate we recommend reading [[API_h%C3%ADv%C3%A1s_alapok| this description]].&lt;br /&gt;
&lt;br /&gt;
==Integration possibilities==&lt;br /&gt;
You can integrate [[Barion_Smart_Gateway|Barion Smart Gateway]] into mobile apps in three ways:&lt;br /&gt;
# &#039;&#039;&#039;With your own server-side&#039;&#039;&#039;&lt;br /&gt;
#* In this case, the mobile application doesn&#039;t communicate directly with the Barion system.&lt;br /&gt;
#* On your server-side you can use for example our PHP Library, you can find it on [https://github.com/barion Barion&#039;s Github page]&lt;br /&gt;
# &#039;&#039;&#039;With Barion Mobile Library&#039;&#039;&#039;&lt;br /&gt;
#* In this case, your mobile application will communicate with the Barion System through our Barion Mobile Library.&lt;br /&gt;
#* You can find Android and iOS libraries on [https://github.com/barion Barion&#039;s GitHub page]&lt;br /&gt;
# &#039;&#039;&#039;Totally native implementation (we don&#039;t recommend it)&#039;&#039;&#039;&lt;br /&gt;
#* In this case, your mobile application will communicate directly with the Barion System and you need to implement everything on your own.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;In all cases, it is highly recommended to obfuscate client applications! We recommend using [http://developer.android.com/tools/help/proguard.html ProGuard] or [https://www.guardsquare.com/dexguard DexGuard].&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see the integration possibilities pros and cons in this table:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;|Using server-side&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
* The client application won&#039;t contain sensitive information.&lt;br /&gt;
* Because the client application will communicate at first with your own server-side you can log the network communication and also you can add extra information to it.&lt;br /&gt;
|&lt;br /&gt;
* Includes additional server side enhancements.&lt;br /&gt;
* You need to handle when the Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[Fájl:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;| With Barion Mobile Library&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
|style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
* The library will handle the whole communication with the Barion System&lt;br /&gt;
* You don&#039;t need to handle when Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|&lt;br /&gt;
* The integrator application will contain the POSKey.&lt;br /&gt;
* In order for the integrator&#039;s server-side to be notified about the payments, the client should send it.&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot; style=&amp;quot;font-size: 150%&amp;quot;| Native solution (not recommended)&lt;br /&gt;
|- &lt;br /&gt;
| style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: green;&amp;quot; | Pros &lt;br /&gt;
|style=&amp;quot;width: 50%; text-align: center; font-weight: bold; color: red;&amp;quot; | Cons&lt;br /&gt;
|-&lt;br /&gt;
| &lt;br /&gt;
|&lt;br /&gt;
* A lot of sensitive information will be in the integrator application.&lt;br /&gt;
* The integrator application should handle every network communication.&lt;br /&gt;
* You need to handle when the Barion application is available on the user&#039;s device or not.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Integration descriptions==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 100%&amp;quot;&lt;br /&gt;
| style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[Fájl: android_logo.png|center|256px]] Integrate on Android&lt;br /&gt;
| style=&amp;quot;font-weight: bold; text-align: center&amp;quot; | [[Fájl: ios_logo.png|center|256px]] Integrate on iOS&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
* [[Barion_App2App_integráció_Androidon_szerver_oldal_közbeiktatásával | Using server-side]]&lt;br /&gt;
* [[Barion_App2App_integráció_Androidon_library_használatával|With Library]]&lt;br /&gt;
|&lt;br /&gt;
* [[Barion_App2App_integráció_iOSen_szerver_oldal_közbeiktatásával|Using server-side]]&lt;br /&gt;
* [[Barion_App2App_integráció_iOSen_library_használatával|With Library]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
* [https://github.com/barion/barion-android-java-app2app Android example on GitHub]&lt;br /&gt;
* [https://github.com/barion/barion-ios-objc-app2app iOS example on GitHub]&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1529</id>
		<title>App2App integration on ios with server side</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1529"/>
		<updated>2019-02-07T14:45:29Z</updated>

		<summary type="html">&lt;p&gt;Macika: /* 5.1. step - Setup UIWebView */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
In this type of integration, you don&#039;t need to edit your server-side. In your mobile application, you don&#039;t have to implement network communication. We already did it for you. If you use the Barion Android library you have to add a few lines of code to your existing codebase. The disadvantage of this is, that you have to notify your own server-side about the payments and your mobile app can contain the POSKey.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Downloads, example==&lt;br /&gt;
You can download the example project from [https://github.com/barion/barion-ios-objc-app2app/tree/master/examples/NativeIntegration this].&lt;br /&gt;
&lt;br /&gt;
This project contains the models, and error handling processes. so this description won&#039;t talk about it.&lt;br /&gt;
&lt;br /&gt;
==flow chart==&lt;br /&gt;
[[File:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
==Server-side developments==&lt;br /&gt;
The server-side must be capable of the following call types (you can also see them on the flow chart above): :&lt;br /&gt;
* Payment initiation in the Barion System through the [[Payment-Start-v2|Payment/Start]] API request.&lt;br /&gt;
* Get payment&#039;s state from the Barion System through the [[Payment-GetPaymentState-v2|Payment/GetPaymentState]] API request.&lt;br /&gt;
&lt;br /&gt;
You can use any languages and technology. In the case of PHP you can use our library, which you can download from [https://github.com/barion Barion&#039;s GitHub page].&lt;br /&gt;
The Barion System using JSON format in the requests and responses.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===0. step - Server-side developments===&lt;br /&gt;
====0.1. step - Server-side requests====&lt;br /&gt;
For the server-side requests, you can use the examples directory in our PHP library on [https://github.com/barion/barion-web-php/tree/master/examples Barion&#039;s GitHub page]]. &lt;br /&gt;
&lt;br /&gt;
In this example we assume the following:&lt;br /&gt;
* For the payment initiator request, we will send the list of products with a POST request under the Items key&lt;br /&gt;
* For the payment&#039;s status, we will use a GET request.&lt;br /&gt;
&lt;br /&gt;
Add server-side endpoints to your mobile application:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   // Parameters.h file&lt;br /&gt;
   @interface Parameters : NSObject&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl;&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl;&lt;br /&gt;
   + (NSString*)redirectUrl;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // Parameters.m file&lt;br /&gt;
   @implementation Parameters&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/generate_barion_payment.php&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/get_barion_payment_state.php?PaymentId=&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)redirectUrl&lt;br /&gt;
   {&lt;br /&gt;
      NSString* url;&lt;br /&gt;
      if ([[[UIDevice currentDevice] systemVersion] floatValue] &amp;lt; 9) {&lt;br /&gt;
         url = @&amp;quot;your-domain://&amp;quot;;&lt;br /&gt;
      } else {&lt;br /&gt;
         url = @&amp;quot;https://your-domain.com/&amp;quot;;&lt;br /&gt;
      }&lt;br /&gt;
      return url;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====0.2. step - Setup your server-side for Universal links====&lt;br /&gt;
In order to the Barion mobile application to redirect the user to the integrator mobile application, you have to put one file into your website&#039;s root directory. Your website must support HTTPS protocol. Simply put a file into your website&#039;s root directory. Name it to &#039;&#039;&#039;apple-app-site-association&#039;&#039;&#039;. Don&#039;t write any extension to the name. The file’s content should be something like this:&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      &amp;quot;applinks&amp;quot;:{&lt;br /&gt;
         &amp;quot;apps&amp;quot;:[],&lt;br /&gt;
         &amp;quot;details&amp;quot;:[&lt;br /&gt;
            {&lt;br /&gt;
               &amp;quot;appID&amp;quot;:&amp;quot;[your ios team id].[your application&#039;s bundle id]&amp;quot;,&lt;br /&gt;
               &amp;quot;paths&amp;quot;:[&lt;br /&gt;
                  &amp;quot;*&amp;quot;&lt;br /&gt;
               ]&lt;br /&gt;
            }&lt;br /&gt;
         ]&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a real example on [https://secure.barion.com/apple-app-site-association our website].&lt;br /&gt;
&lt;br /&gt;
You can read more about Universal link in [https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html Apple&#039;s documentation]&lt;br /&gt;
The Universal Link doesn&#039;t work in simulator!&lt;br /&gt;
&lt;br /&gt;
===1. step - Setup your iOS application for Universal links===&lt;br /&gt;
Open the XCode. Select your project and the target. Select the &#039;&#039;&#039;Capabilities&#039;&#039;&#039; tab and look for the &#039;&#039;&#039;Associated Domains&#039;&#039;&#039; section! You need to add the domains that you have written in the 0.2 step:&lt;br /&gt;
[[File:Universallink.png|center|800px]]&lt;br /&gt;
As a result, this will generate a [ProjectName].entitlements file.&lt;br /&gt;
&lt;br /&gt;
===2. step - Setup your application to handle your own scheme===&lt;br /&gt;
Switch to the &#039;&#039;&#039;Info&#039;&#039;&#039; tab, and open the &#039;&#039;&#039;URL Types&#039;&#039;&#039; section! Add your own url scheme as you can see on this image.&lt;br /&gt;
[[File:UrlScheme.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===3. step - Create classes for network communication===&lt;br /&gt;
Here you can see a possible solution:&lt;br /&gt;
====3.1. step - Network base class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.h&lt;br /&gt;
   #import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @protocol BaseConnectionHandlerDelegate &amp;lt;NSObject&amp;gt;&lt;br /&gt;
      - (void)networkError;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface BaseConnectionHandler : NSObject &amp;lt;NSURLConnectionDataDelegate, NSURLConnectionDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
       NSURLConnection* _connection;&lt;br /&gt;
       NSMutableData* _data;&lt;br /&gt;
       float _timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel;&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString;&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString;&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result;&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation BaseConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   static int _activityIndicatorRequest = 0;&lt;br /&gt;
&lt;br /&gt;
   - (id)init&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _timeout = 30.0;&lt;br /&gt;
         _data = [[NSMutableData alloc] init];&lt;br /&gt;
         _activityIndicatorRequest++;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)dealloc&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      if(_activityIndicatorRequest &amp;gt; 1) {&lt;br /&gt;
         _activityIndicatorRequest--;&lt;br /&gt;
      } else {&lt;br /&gt;
         _activityIndicatorRequest = 0;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel&lt;br /&gt;
   {&lt;br /&gt;
      if(_connection)&lt;br /&gt;
      {&lt;br /&gt;
         [_connection cancel];&lt;br /&gt;
         _connection = nil;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [NSURL URLWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL: url];&lt;br /&gt;
      [request setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest: request delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [[NSURL alloc] initWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* urlRequest = [[NSMutableURLRequest alloc] initWithURL:url];&lt;br /&gt;
      NSData* requestData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];&lt;br /&gt;
      [urlRequest setValue: [NSString stringWithFormat:@&amp;quot;%lu&amp;quot;, (unsigned long)requestData.length] &lt;br /&gt;
         forHTTPHeaderField:@&amp;quot;Content-Length&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;gzip&amp;quot; forHTTPHeaderField:@&amp;quot;Accept-Encoding&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;application/json&amp;quot; forHTTPHeaderField:@&amp;quot;Content-Type&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPMethod: @&amp;quot;POST&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPBody: requestData];&lt;br /&gt;
      [urlRequest setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data&lt;br /&gt;
   {&lt;br /&gt;
      [_data appendData: data];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connectionDidFinishLoading:(NSURLConnection *)connection&lt;br /&gt;
   {&lt;br /&gt;
      NSError* jsonParsingError;&lt;br /&gt;
      NSDictionary* jsonResult = [NSJSONSerialization JSONObjectWithData: _data options: 0 error: &amp;amp;jsonParsingError];&lt;br /&gt;
      if(jsonParsingError != nil) {&lt;br /&gt;
         [self error: nil];&lt;br /&gt;
      } else {&lt;br /&gt;
         NSArray* jsonErrors = [jsonResult objectForKey: @&amp;quot;Errors&amp;quot;];&lt;br /&gt;
         if(jsonErrors.count != 0)&lt;br /&gt;
         {&lt;br /&gt;
            NSMutableArray* errors = [NSMutableArray new];&lt;br /&gt;
            for(int i = 0; i &amp;lt; jsonErrors.count; ++i)&lt;br /&gt;
            {&lt;br /&gt;
               NSDictionary* errorDict = [jsonErrors objectAtIndex: i];&lt;br /&gt;
               BarionError* error = [[BarionError alloc] initWithErrorCode: [errorDict objectForKey: @&amp;quot;ErrorCode&amp;quot;] &lt;br /&gt;
                  title: [errorDict objectForKey: @&amp;quot;Title&amp;quot;] description: [errorDict objectForKey:@&amp;quot;Description&amp;quot;]];&lt;br /&gt;
               [errors addObject: error];&lt;br /&gt;
            }&lt;br /&gt;
            [self error: errors];&lt;br /&gt;
         } else {&lt;br /&gt;
            [self requestComplete: jsonResult];&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      [self error: nil];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)setTimeout:(float)timeout {&lt;br /&gt;
      _timeout = timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.2. step - Payment initiator network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol StartPaymentConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)paymentStartSuccessed:(NSDictionary*)result;&lt;br /&gt;
      - (void)paymentStartFailed:(NSArray*)errors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface StartPaymentConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;StartPaymentConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Product.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation StartPaymentConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSMutableArray* productsArray = [NSMutableArray new];&lt;br /&gt;
         for(int i = 0; i &amp;lt; products.count; ++i)&lt;br /&gt;
         {&lt;br /&gt;
            Product* p = [products objectAtIndex: i];&lt;br /&gt;
            NSMutableDictionary* dict = [NSMutableDictionary new];&lt;br /&gt;
            [dict setObject: p.name forKey: @&amp;quot;Name&amp;quot;];&lt;br /&gt;
            [dict setObject: p.productDescription forKey: @&amp;quot;Description&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.quantity] forKey: @&amp;quot;Quantity&amp;quot;];&lt;br /&gt;
            [dict setObject: p.unit forKey: @&amp;quot;Unit&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;UnitPrice&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;ItemTotal&amp;quot;];&lt;br /&gt;
            [dict setObject: p.SKU forKey: @&amp;quot;SKU&amp;quot;];&lt;br /&gt;
            [productsArray addObject: dict];&lt;br /&gt;
         }&lt;br /&gt;
        &lt;br /&gt;
         NSMutableDictionary* containerDict = [NSMutableDictionary new];&lt;br /&gt;
         [containerDict setObject: productsArray forKey: @&amp;quot;Products&amp;quot;];&lt;br /&gt;
         [containerDict setObject: [Parameters redirectUrl] forKey: @&amp;quot;RedirectUrl&amp;quot;];&lt;br /&gt;
        &lt;br /&gt;
         NSString* jsonString = [[NSString alloc] initWithData: [NSJSONSerialization dataWithJSONObject: containerDict &lt;br /&gt;
            options:0 error:nil] encoding: NSUTF8StringEncoding];&lt;br /&gt;
        &lt;br /&gt;
         [self startPOSTWithUrlString: [Parameters startBarionPaymentUrl] jsonString: jsonString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate paymentStartSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil)&lt;br /&gt;
      {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate paymentStartFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.3. step - Payment&#039;s status network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol GetPaymentStateConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)getPaymentStateSuccessed:(NSDictionary*)response;&lt;br /&gt;
      - (void)getPaymentStateFailed:(NSArray*)barionErrors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface GetPaymentStateConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation GetPaymentStateConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSString* urlString = [NSString stringWithFormat: @&amp;quot;%@%@&amp;quot;,[Parameters getBarionPaymentStateUrl], paymentId];&lt;br /&gt;
         [self startGETWithUrlString: urlString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate getPaymentStateSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil) {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate getPaymentStateFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4. step - Initiate payment===&lt;br /&gt;
At any point in the mobile application – where the products you want to pay are available - you should initiate the payment in the Barion System. The Barion IOS Library will check the parameters and if something is wrong, itwill return with an error. The possible error codes can be found on [[Barion_Mobil_Library_ErrorCodes|this page]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (IBAction)payWithBarion:(id)sender&lt;br /&gt;
   {&lt;br /&gt;
      _progressAlert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Communicating with the Barion system&amp;quot; message:nil &lt;br /&gt;
         delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];&lt;br /&gt;
      [_progressAlert show];&lt;br /&gt;
      startPaymentHandler = [[StartPaymentConnectionHandler alloc] initWithDelegate:self products: _products];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===5. step - Get results and redirect===&lt;br /&gt;
If the payment initiation was successful you need to redirect the user to the Barion mobile application or to Barion&#039;s website.&lt;br /&gt;
&lt;br /&gt;
In order for the user to be redirected to the Barion mobile application, the following requirements must be met:&lt;br /&gt;
* The device must have Barion mobile application installed.&lt;br /&gt;
* The installed Barion mobile application version must be above of 3.1.0.&lt;br /&gt;
&lt;br /&gt;
After you successfully initiated the payment you got a &#039;&#039;&#039;PaymentId&#039;&#039;&#039; parameter in the response. Start the Bairon mobile application with this &#039;&#039;&#039;PaymentId&#039;&#039;&#039; by the following:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (void)paymentStartSuccessed:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
      BarionStartPaymentResponse* response = [[BarionStartPaymentResponse alloc] initWithJsonDictionary: result];&lt;br /&gt;
      NSURL* url = [NSURL URLWithString:&lt;br /&gt;
         [NSString stringWithFormat: @&amp;quot;barion://?pid=%@&amp;amp;redirectUrl=%@&amp;quot;, response.paymentId, [Parameters redirectUrl]]];&lt;br /&gt;
      if([[UIApplication sharedApplication] canOpenURL: url]) {&lt;br /&gt;
         [[UIApplication sharedApplication] openURL: url];&lt;br /&gt;
      } else {&lt;br /&gt;
         UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
         WebViewController* web = [sb instantiateViewControllerWithIdentifier:@&amp;quot;webViewController&amp;quot;];&lt;br /&gt;
         web.paymentId = response.paymentId;&lt;br /&gt;
         web.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
         [self.navigationController setViewControllers: [NSArray arrayWithObject: web]];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)paymentStartFailed:(NSArray*)errors&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the Barion mobile application isn&#039;t installed on the user&#039;s device, you need to load Barion&#039;s website in a UIWebView.&lt;br /&gt;
&lt;br /&gt;
====5.1. step - Setup UIWebView====&lt;br /&gt;
We create a new viewcontroller with a full screen Webview and with a UIActivityIndicatorView. In the Interface Builder this will look something like this:&lt;br /&gt;
&lt;br /&gt;
[[File:WebView.png|center|200px]]&lt;br /&gt;
&lt;br /&gt;
Here is the content of the UIViewController for that view above:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @interface WebViewController : UIViewController &amp;lt;UIWebViewDelegate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIWebView* webView;&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIActivityIndicatorView* loadIndicator;&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSString* paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.m&lt;br /&gt;
   #import &amp;quot;WebViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation WebViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
    &lt;br /&gt;
      self.title = @&amp;quot;Barion Smart Books&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
      [_webView setHidden: YES];&lt;br /&gt;
      [_loadIndicator setHidden: NO];&lt;br /&gt;
      [_loadIndicator startAnimating];&lt;br /&gt;
    &lt;br /&gt;
      NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:&lt;br /&gt;
         [NSURL URLWithString:&lt;br /&gt;
            [NSString stringWithFormat: @&amp;quot;https://barion.com/Pay?Id=%@&amp;quot;, _paymentId]]];&lt;br /&gt;
    &lt;br /&gt;
      [_webView loadRequest: request];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webViewDidFinishLoad:(UIWebView *)webView&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      [_loadIndicator setHidden: YES];&lt;br /&gt;
      [_webView setHidden: NO];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      UIAlertView* alert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Error&amp;quot; message: @&amp;quot;The requested page could not load&amp;quot; &lt;br /&gt;
         delegate: nil cancelButtonTitle: @&amp;quot;OK&amp;quot; otherButtonTitles: nil, nil];&lt;br /&gt;
      [alert show];&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = [NSURL URLWithString: [NSString stringWithFormat:@&amp;quot;%@?paymentId=%@&amp;quot;, [Parameters redirectUrl], _paymentId]];&lt;br /&gt;
      [self.navigationController setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType&lt;br /&gt;
   {&lt;br /&gt;
      if ([[request.URL absoluteString] hasPrefix: [Parameters redirectUrl]]) {&lt;br /&gt;
         [((AppDelegate*)[UIApplication sharedApplication].delegate) openPaymentResultViewControllerWithUrl: request.URL];&lt;br /&gt;
         return NO;&lt;br /&gt;
      }&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===6. step - Handling redirect===&lt;br /&gt;
You need to implement these methods in your application&#039;s AppDelegate.m file.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {&lt;br /&gt;
      [self openPaymentResultViewControllerWithUrl: userActivity.webpageURL];&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)openPaymentResultViewControllerWithUrl:(NSURL*)url&lt;br /&gt;
   {&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = url;&lt;br /&gt;
      result.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
      UINavigationController* controller = (UINavigationController*)self.window.rootViewController;&lt;br /&gt;
      [controller setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===7. step - Get payment&#039;s result===&lt;br /&gt;
In the Barion mobile application the user can pay or reject the payment. After that, the application closes itself. Then the user will be redirected to the integrator mobile application and you need to request the payment&#039;s status from your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @interface PaymentResultViewController : UIViewController &amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      GetPaymentStateConnectionHandler* _getPaymentStateHandler;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSURL* url;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.m&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation PaymentResultViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
&lt;br /&gt;
      NSString* paymentId = [[_url absoluteString] stringByReplacingOccurrencesOfString: [NSString stringWithFormat: @&amp;quot;%@?paymentId=&amp;quot;, [Parameters redirectUrl]] withString:@&amp;quot;&amp;quot;];&lt;br /&gt;
      _getPaymentStateHandler = [[GetPaymentStateConnectionHandler alloc] initWithDelegate: self paymentId: paymentId];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateSuccessed:(NSDictionary*)response&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
      BarionGetPaymentStateResponse* paymentState = [[BarionGetPaymentStateResponse alloc] initWithJsonDictionary: response];&lt;br /&gt;
      // you can find the payment details in this object&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateFailed:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the &#039;&#039;&#039;BarionGetPaymentStateResponse&#039;&#039;&#039; object you can easily get the payment details.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=File:WebView.png&amp;diff=1528</id>
		<title>File:WebView.png</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=File:WebView.png&amp;diff=1528"/>
		<updated>2019-02-07T14:45:15Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=Barion_Mobil_Library_ErrorCodes&amp;diff=1527</id>
		<title>Barion Mobil Library ErrorCodes</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=Barion_Mobil_Library_ErrorCodes&amp;diff=1527"/>
		<updated>2019-02-07T14:43:57Z</updated>

		<summary type="html">&lt;p&gt;Macika: Created page with &amp;quot;The Barion Mobile Library will check the parameters and if anything is wrong, it will return with an error.   {|	  |- | 999 || Barion System not responding. |- | 1000 ||  Miss...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Barion Mobile Library will check the parameters and if anything is wrong, it will return with an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|	 &lt;br /&gt;
|-&lt;br /&gt;
| 999 || Barion System not responding.&lt;br /&gt;
|-&lt;br /&gt;
| 1000 ||  Missing the POSKey.&lt;br /&gt;
|-&lt;br /&gt;
| 1001 || Missing the type of the payment.&lt;br /&gt;
|-&lt;br /&gt;
| 1002 ||  Missing the reservation period.&lt;br /&gt;
|-&lt;br /&gt;
| 1003 ||  Missing the funding sources.&lt;br /&gt;
|-&lt;br /&gt;
| 1004 ||  Missing the locale.&lt;br /&gt;
|-&lt;br /&gt;
| 1005 ||  Missing the transaction id in the integrator system.&lt;br /&gt;
|-&lt;br /&gt;
| 1006 ||  Missing the payee.&lt;br /&gt;
|-&lt;br /&gt;
| 1111 ||  Missing the required parameters.&lt;br /&gt;
|-&lt;br /&gt;
| 2000 ||  Missing the product list.&lt;br /&gt;
|-&lt;br /&gt;
| 2001 ||  Missing the name of the product.&lt;br /&gt;
|-&lt;br /&gt;
| 2002 ||  Missing the description of the product.&lt;br /&gt;
|-&lt;br /&gt;
| 2003 ||  Missing the quantity of the product.&lt;br /&gt;
|-&lt;br /&gt;
| 2004 ||  Missing the unit.&lt;br /&gt;
|-&lt;br /&gt;
| 2005 ||  Missing the price of the product.&lt;br /&gt;
|-&lt;br /&gt;
| 2006 ||  Missing the total price.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1526</id>
		<title>App2App integration on ios with server side</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1526"/>
		<updated>2019-02-07T14:40:58Z</updated>

		<summary type="html">&lt;p&gt;Macika: /* 4. step - Initiate payment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
In this type of integration, you don&#039;t need to edit your server-side. In your mobile application, you don&#039;t have to implement network communication. We already did it for you. If you use the Barion Android library you have to add a few lines of code to your existing codebase. The disadvantage of this is, that you have to notify your own server-side about the payments and your mobile app can contain the POSKey.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Downloads, example==&lt;br /&gt;
You can download the example project from [https://github.com/barion/barion-ios-objc-app2app/tree/master/examples/NativeIntegration this].&lt;br /&gt;
&lt;br /&gt;
This project contains the models, and error handling processes. so this description won&#039;t talk about it.&lt;br /&gt;
&lt;br /&gt;
==flow chart==&lt;br /&gt;
[[File:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
==Server-side developments==&lt;br /&gt;
The server-side must be capable of the following call types (you can also see them on the flow chart above): :&lt;br /&gt;
* Payment initiation in the Barion System through the [[Payment-Start-v2|Payment/Start]] API request.&lt;br /&gt;
* Get payment&#039;s state from the Barion System through the [[Payment-GetPaymentState-v2|Payment/GetPaymentState]] API request.&lt;br /&gt;
&lt;br /&gt;
You can use any languages and technology. In the case of PHP you can use our library, which you can download from [https://github.com/barion Barion&#039;s GitHub page].&lt;br /&gt;
The Barion System using JSON format in the requests and responses.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===0. step - Server-side developments===&lt;br /&gt;
====0.1. step - Server-side requests====&lt;br /&gt;
For the server-side requests, you can use the examples directory in our PHP library on [https://github.com/barion/barion-web-php/tree/master/examples Barion&#039;s GitHub page]]. &lt;br /&gt;
&lt;br /&gt;
In this example we assume the following:&lt;br /&gt;
* For the payment initiator request, we will send the list of products with a POST request under the Items key&lt;br /&gt;
* For the payment&#039;s status, we will use a GET request.&lt;br /&gt;
&lt;br /&gt;
Add server-side endpoints to your mobile application:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   // Parameters.h file&lt;br /&gt;
   @interface Parameters : NSObject&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl;&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl;&lt;br /&gt;
   + (NSString*)redirectUrl;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // Parameters.m file&lt;br /&gt;
   @implementation Parameters&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/generate_barion_payment.php&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/get_barion_payment_state.php?PaymentId=&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)redirectUrl&lt;br /&gt;
   {&lt;br /&gt;
      NSString* url;&lt;br /&gt;
      if ([[[UIDevice currentDevice] systemVersion] floatValue] &amp;lt; 9) {&lt;br /&gt;
         url = @&amp;quot;your-domain://&amp;quot;;&lt;br /&gt;
      } else {&lt;br /&gt;
         url = @&amp;quot;https://your-domain.com/&amp;quot;;&lt;br /&gt;
      }&lt;br /&gt;
      return url;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====0.2. step - Setup your server-side for Universal links====&lt;br /&gt;
In order to the Barion mobile application to redirect the user to the integrator mobile application, you have to put one file into your website&#039;s root directory. Your website must support HTTPS protocol. Simply put a file into your website&#039;s root directory. Name it to &#039;&#039;&#039;apple-app-site-association&#039;&#039;&#039;. Don&#039;t write any extension to the name. The file’s content should be something like this:&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      &amp;quot;applinks&amp;quot;:{&lt;br /&gt;
         &amp;quot;apps&amp;quot;:[],&lt;br /&gt;
         &amp;quot;details&amp;quot;:[&lt;br /&gt;
            {&lt;br /&gt;
               &amp;quot;appID&amp;quot;:&amp;quot;[your ios team id].[your application&#039;s bundle id]&amp;quot;,&lt;br /&gt;
               &amp;quot;paths&amp;quot;:[&lt;br /&gt;
                  &amp;quot;*&amp;quot;&lt;br /&gt;
               ]&lt;br /&gt;
            }&lt;br /&gt;
         ]&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a real example on [https://secure.barion.com/apple-app-site-association our website].&lt;br /&gt;
&lt;br /&gt;
You can read more about Universal link in [https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html Apple&#039;s documentation]&lt;br /&gt;
The Universal Link doesn&#039;t work in simulator!&lt;br /&gt;
&lt;br /&gt;
===1. step - Setup your iOS application for Universal links===&lt;br /&gt;
Open the XCode. Select your project and the target. Select the &#039;&#039;&#039;Capabilities&#039;&#039;&#039; tab and look for the &#039;&#039;&#039;Associated Domains&#039;&#039;&#039; section! You need to add the domains that you have written in the 0.2 step:&lt;br /&gt;
[[File:Universallink.png|center|800px]]&lt;br /&gt;
As a result, this will generate a [ProjectName].entitlements file.&lt;br /&gt;
&lt;br /&gt;
===2. step - Setup your application to handle your own scheme===&lt;br /&gt;
Switch to the &#039;&#039;&#039;Info&#039;&#039;&#039; tab, and open the &#039;&#039;&#039;URL Types&#039;&#039;&#039; section! Add your own url scheme as you can see on this image.&lt;br /&gt;
[[File:UrlScheme.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===3. step - Create classes for network communication===&lt;br /&gt;
Here you can see a possible solution:&lt;br /&gt;
====3.1. step - Network base class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.h&lt;br /&gt;
   #import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @protocol BaseConnectionHandlerDelegate &amp;lt;NSObject&amp;gt;&lt;br /&gt;
      - (void)networkError;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface BaseConnectionHandler : NSObject &amp;lt;NSURLConnectionDataDelegate, NSURLConnectionDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
       NSURLConnection* _connection;&lt;br /&gt;
       NSMutableData* _data;&lt;br /&gt;
       float _timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel;&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString;&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString;&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result;&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation BaseConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   static int _activityIndicatorRequest = 0;&lt;br /&gt;
&lt;br /&gt;
   - (id)init&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _timeout = 30.0;&lt;br /&gt;
         _data = [[NSMutableData alloc] init];&lt;br /&gt;
         _activityIndicatorRequest++;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)dealloc&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      if(_activityIndicatorRequest &amp;gt; 1) {&lt;br /&gt;
         _activityIndicatorRequest--;&lt;br /&gt;
      } else {&lt;br /&gt;
         _activityIndicatorRequest = 0;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel&lt;br /&gt;
   {&lt;br /&gt;
      if(_connection)&lt;br /&gt;
      {&lt;br /&gt;
         [_connection cancel];&lt;br /&gt;
         _connection = nil;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [NSURL URLWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL: url];&lt;br /&gt;
      [request setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest: request delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [[NSURL alloc] initWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* urlRequest = [[NSMutableURLRequest alloc] initWithURL:url];&lt;br /&gt;
      NSData* requestData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];&lt;br /&gt;
      [urlRequest setValue: [NSString stringWithFormat:@&amp;quot;%lu&amp;quot;, (unsigned long)requestData.length] &lt;br /&gt;
         forHTTPHeaderField:@&amp;quot;Content-Length&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;gzip&amp;quot; forHTTPHeaderField:@&amp;quot;Accept-Encoding&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;application/json&amp;quot; forHTTPHeaderField:@&amp;quot;Content-Type&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPMethod: @&amp;quot;POST&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPBody: requestData];&lt;br /&gt;
      [urlRequest setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data&lt;br /&gt;
   {&lt;br /&gt;
      [_data appendData: data];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connectionDidFinishLoading:(NSURLConnection *)connection&lt;br /&gt;
   {&lt;br /&gt;
      NSError* jsonParsingError;&lt;br /&gt;
      NSDictionary* jsonResult = [NSJSONSerialization JSONObjectWithData: _data options: 0 error: &amp;amp;jsonParsingError];&lt;br /&gt;
      if(jsonParsingError != nil) {&lt;br /&gt;
         [self error: nil];&lt;br /&gt;
      } else {&lt;br /&gt;
         NSArray* jsonErrors = [jsonResult objectForKey: @&amp;quot;Errors&amp;quot;];&lt;br /&gt;
         if(jsonErrors.count != 0)&lt;br /&gt;
         {&lt;br /&gt;
            NSMutableArray* errors = [NSMutableArray new];&lt;br /&gt;
            for(int i = 0; i &amp;lt; jsonErrors.count; ++i)&lt;br /&gt;
            {&lt;br /&gt;
               NSDictionary* errorDict = [jsonErrors objectAtIndex: i];&lt;br /&gt;
               BarionError* error = [[BarionError alloc] initWithErrorCode: [errorDict objectForKey: @&amp;quot;ErrorCode&amp;quot;] &lt;br /&gt;
                  title: [errorDict objectForKey: @&amp;quot;Title&amp;quot;] description: [errorDict objectForKey:@&amp;quot;Description&amp;quot;]];&lt;br /&gt;
               [errors addObject: error];&lt;br /&gt;
            }&lt;br /&gt;
            [self error: errors];&lt;br /&gt;
         } else {&lt;br /&gt;
            [self requestComplete: jsonResult];&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      [self error: nil];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)setTimeout:(float)timeout {&lt;br /&gt;
      _timeout = timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.2. step - Payment initiator network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol StartPaymentConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)paymentStartSuccessed:(NSDictionary*)result;&lt;br /&gt;
      - (void)paymentStartFailed:(NSArray*)errors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface StartPaymentConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;StartPaymentConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Product.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation StartPaymentConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSMutableArray* productsArray = [NSMutableArray new];&lt;br /&gt;
         for(int i = 0; i &amp;lt; products.count; ++i)&lt;br /&gt;
         {&lt;br /&gt;
            Product* p = [products objectAtIndex: i];&lt;br /&gt;
            NSMutableDictionary* dict = [NSMutableDictionary new];&lt;br /&gt;
            [dict setObject: p.name forKey: @&amp;quot;Name&amp;quot;];&lt;br /&gt;
            [dict setObject: p.productDescription forKey: @&amp;quot;Description&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.quantity] forKey: @&amp;quot;Quantity&amp;quot;];&lt;br /&gt;
            [dict setObject: p.unit forKey: @&amp;quot;Unit&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;UnitPrice&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;ItemTotal&amp;quot;];&lt;br /&gt;
            [dict setObject: p.SKU forKey: @&amp;quot;SKU&amp;quot;];&lt;br /&gt;
            [productsArray addObject: dict];&lt;br /&gt;
         }&lt;br /&gt;
        &lt;br /&gt;
         NSMutableDictionary* containerDict = [NSMutableDictionary new];&lt;br /&gt;
         [containerDict setObject: productsArray forKey: @&amp;quot;Products&amp;quot;];&lt;br /&gt;
         [containerDict setObject: [Parameters redirectUrl] forKey: @&amp;quot;RedirectUrl&amp;quot;];&lt;br /&gt;
        &lt;br /&gt;
         NSString* jsonString = [[NSString alloc] initWithData: [NSJSONSerialization dataWithJSONObject: containerDict &lt;br /&gt;
            options:0 error:nil] encoding: NSUTF8StringEncoding];&lt;br /&gt;
        &lt;br /&gt;
         [self startPOSTWithUrlString: [Parameters startBarionPaymentUrl] jsonString: jsonString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate paymentStartSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil)&lt;br /&gt;
      {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate paymentStartFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.3. step - Payment&#039;s status network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol GetPaymentStateConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)getPaymentStateSuccessed:(NSDictionary*)response;&lt;br /&gt;
      - (void)getPaymentStateFailed:(NSArray*)barionErrors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface GetPaymentStateConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation GetPaymentStateConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSString* urlString = [NSString stringWithFormat: @&amp;quot;%@%@&amp;quot;,[Parameters getBarionPaymentStateUrl], paymentId];&lt;br /&gt;
         [self startGETWithUrlString: urlString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate getPaymentStateSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil) {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate getPaymentStateFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4. step - Initiate payment===&lt;br /&gt;
At any point in the mobile application – where the products you want to pay are available - you should initiate the payment in the Barion System. The Barion IOS Library will check the parameters and if something is wrong, itwill return with an error. The possible error codes can be found on [[Barion_Mobil_Library_ErrorCodes|this page]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (IBAction)payWithBarion:(id)sender&lt;br /&gt;
   {&lt;br /&gt;
      _progressAlert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Communicating with the Barion system&amp;quot; message:nil &lt;br /&gt;
         delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];&lt;br /&gt;
      [_progressAlert show];&lt;br /&gt;
      startPaymentHandler = [[StartPaymentConnectionHandler alloc] initWithDelegate:self products: _products];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===5. step - Get results and redirect===&lt;br /&gt;
If the payment initiation was successful you need to redirect the user to the Barion mobile application or to Barion&#039;s website.&lt;br /&gt;
&lt;br /&gt;
In order for the user to be redirected to the Barion mobile application, the following requirements must be met:&lt;br /&gt;
* The device must have Barion mobile application installed.&lt;br /&gt;
* The installed Barion mobile application version must be above of 3.1.0.&lt;br /&gt;
&lt;br /&gt;
After you successfully initiated the payment you got a &#039;&#039;&#039;PaymentId&#039;&#039;&#039; parameter in the response. Start the Bairon mobile application with this &#039;&#039;&#039;PaymentId&#039;&#039;&#039; by the following:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (void)paymentStartSuccessed:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
      BarionStartPaymentResponse* response = [[BarionStartPaymentResponse alloc] initWithJsonDictionary: result];&lt;br /&gt;
      NSURL* url = [NSURL URLWithString:&lt;br /&gt;
         [NSString stringWithFormat: @&amp;quot;barion://?pid=%@&amp;amp;redirectUrl=%@&amp;quot;, response.paymentId, [Parameters redirectUrl]]];&lt;br /&gt;
      if([[UIApplication sharedApplication] canOpenURL: url]) {&lt;br /&gt;
         [[UIApplication sharedApplication] openURL: url];&lt;br /&gt;
      } else {&lt;br /&gt;
         UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
         WebViewController* web = [sb instantiateViewControllerWithIdentifier:@&amp;quot;webViewController&amp;quot;];&lt;br /&gt;
         web.paymentId = response.paymentId;&lt;br /&gt;
         web.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
         [self.navigationController setViewControllers: [NSArray arrayWithObject: web]];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)paymentStartFailed:(NSArray*)errors&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the Barion mobile application isn&#039;t installed on the user&#039;s device, you need to load Barion&#039;s website in a UIWebView.&lt;br /&gt;
&lt;br /&gt;
====5.1. step - Setup UIWebView====&lt;br /&gt;
We create a new viewcontroller with a full screen Webview and with a UIActivityIndicatorView. In the Interface Builder this will look something like this:&lt;br /&gt;
&lt;br /&gt;
[[Fájl:WebView.png|center|200px]]&lt;br /&gt;
&lt;br /&gt;
Here is the content of the UIViewController for that view above:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @interface WebViewController : UIViewController &amp;lt;UIWebViewDelegate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIWebView* webView;&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIActivityIndicatorView* loadIndicator;&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSString* paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.m&lt;br /&gt;
   #import &amp;quot;WebViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation WebViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
    &lt;br /&gt;
      self.title = @&amp;quot;Barion Smart Books&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
      [_webView setHidden: YES];&lt;br /&gt;
      [_loadIndicator setHidden: NO];&lt;br /&gt;
      [_loadIndicator startAnimating];&lt;br /&gt;
    &lt;br /&gt;
      NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:&lt;br /&gt;
         [NSURL URLWithString:&lt;br /&gt;
            [NSString stringWithFormat: @&amp;quot;https://barion.com/Pay?Id=%@&amp;quot;, _paymentId]]];&lt;br /&gt;
    &lt;br /&gt;
      [_webView loadRequest: request];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webViewDidFinishLoad:(UIWebView *)webView&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      [_loadIndicator setHidden: YES];&lt;br /&gt;
      [_webView setHidden: NO];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      UIAlertView* alert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Error&amp;quot; message: @&amp;quot;The requested page could not load&amp;quot; &lt;br /&gt;
         delegate: nil cancelButtonTitle: @&amp;quot;OK&amp;quot; otherButtonTitles: nil, nil];&lt;br /&gt;
      [alert show];&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = [NSURL URLWithString: [NSString stringWithFormat:@&amp;quot;%@?paymentId=%@&amp;quot;, [Parameters redirectUrl], _paymentId]];&lt;br /&gt;
      [self.navigationController setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType&lt;br /&gt;
   {&lt;br /&gt;
      if ([[request.URL absoluteString] hasPrefix: [Parameters redirectUrl]]) {&lt;br /&gt;
         [((AppDelegate*)[UIApplication sharedApplication].delegate) openPaymentResultViewControllerWithUrl: request.URL];&lt;br /&gt;
         return NO;&lt;br /&gt;
      }&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===6. step - Handling redirect===&lt;br /&gt;
You need to implement these methods in your application&#039;s AppDelegate.m file.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {&lt;br /&gt;
      [self openPaymentResultViewControllerWithUrl: userActivity.webpageURL];&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)openPaymentResultViewControllerWithUrl:(NSURL*)url&lt;br /&gt;
   {&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = url;&lt;br /&gt;
      result.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
      UINavigationController* controller = (UINavigationController*)self.window.rootViewController;&lt;br /&gt;
      [controller setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===7. step - Get payment&#039;s result===&lt;br /&gt;
In the Barion mobile application the user can pay or reject the payment. After that, the application closes itself. Then the user will be redirected to the integrator mobile application and you need to request the payment&#039;s status from your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @interface PaymentResultViewController : UIViewController &amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      GetPaymentStateConnectionHandler* _getPaymentStateHandler;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSURL* url;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.m&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation PaymentResultViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
&lt;br /&gt;
      NSString* paymentId = [[_url absoluteString] stringByReplacingOccurrencesOfString: [NSString stringWithFormat: @&amp;quot;%@?paymentId=&amp;quot;, [Parameters redirectUrl]] withString:@&amp;quot;&amp;quot;];&lt;br /&gt;
      _getPaymentStateHandler = [[GetPaymentStateConnectionHandler alloc] initWithDelegate: self paymentId: paymentId];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateSuccessed:(NSDictionary*)response&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
      BarionGetPaymentStateResponse* paymentState = [[BarionGetPaymentStateResponse alloc] initWithJsonDictionary: response];&lt;br /&gt;
      // you can find the payment details in this object&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateFailed:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the &#039;&#039;&#039;BarionGetPaymentStateResponse&#039;&#039;&#039; object you can easily get the payment details.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1525</id>
		<title>App2App integration on ios with server side</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1525"/>
		<updated>2019-02-07T14:39:53Z</updated>

		<summary type="html">&lt;p&gt;Macika: /* 1. step - Setup your iOS application for Universal links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
In this type of integration, you don&#039;t need to edit your server-side. In your mobile application, you don&#039;t have to implement network communication. We already did it for you. If you use the Barion Android library you have to add a few lines of code to your existing codebase. The disadvantage of this is, that you have to notify your own server-side about the payments and your mobile app can contain the POSKey.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Downloads, example==&lt;br /&gt;
You can download the example project from [https://github.com/barion/barion-ios-objc-app2app/tree/master/examples/NativeIntegration this].&lt;br /&gt;
&lt;br /&gt;
This project contains the models, and error handling processes. so this description won&#039;t talk about it.&lt;br /&gt;
&lt;br /&gt;
==flow chart==&lt;br /&gt;
[[File:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
==Server-side developments==&lt;br /&gt;
The server-side must be capable of the following call types (you can also see them on the flow chart above): :&lt;br /&gt;
* Payment initiation in the Barion System through the [[Payment-Start-v2|Payment/Start]] API request.&lt;br /&gt;
* Get payment&#039;s state from the Barion System through the [[Payment-GetPaymentState-v2|Payment/GetPaymentState]] API request.&lt;br /&gt;
&lt;br /&gt;
You can use any languages and technology. In the case of PHP you can use our library, which you can download from [https://github.com/barion Barion&#039;s GitHub page].&lt;br /&gt;
The Barion System using JSON format in the requests and responses.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===0. step - Server-side developments===&lt;br /&gt;
====0.1. step - Server-side requests====&lt;br /&gt;
For the server-side requests, you can use the examples directory in our PHP library on [https://github.com/barion/barion-web-php/tree/master/examples Barion&#039;s GitHub page]]. &lt;br /&gt;
&lt;br /&gt;
In this example we assume the following:&lt;br /&gt;
* For the payment initiator request, we will send the list of products with a POST request under the Items key&lt;br /&gt;
* For the payment&#039;s status, we will use a GET request.&lt;br /&gt;
&lt;br /&gt;
Add server-side endpoints to your mobile application:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   // Parameters.h file&lt;br /&gt;
   @interface Parameters : NSObject&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl;&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl;&lt;br /&gt;
   + (NSString*)redirectUrl;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // Parameters.m file&lt;br /&gt;
   @implementation Parameters&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/generate_barion_payment.php&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/get_barion_payment_state.php?PaymentId=&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)redirectUrl&lt;br /&gt;
   {&lt;br /&gt;
      NSString* url;&lt;br /&gt;
      if ([[[UIDevice currentDevice] systemVersion] floatValue] &amp;lt; 9) {&lt;br /&gt;
         url = @&amp;quot;your-domain://&amp;quot;;&lt;br /&gt;
      } else {&lt;br /&gt;
         url = @&amp;quot;https://your-domain.com/&amp;quot;;&lt;br /&gt;
      }&lt;br /&gt;
      return url;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====0.2. step - Setup your server-side for Universal links====&lt;br /&gt;
In order to the Barion mobile application to redirect the user to the integrator mobile application, you have to put one file into your website&#039;s root directory. Your website must support HTTPS protocol. Simply put a file into your website&#039;s root directory. Name it to &#039;&#039;&#039;apple-app-site-association&#039;&#039;&#039;. Don&#039;t write any extension to the name. The file’s content should be something like this:&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      &amp;quot;applinks&amp;quot;:{&lt;br /&gt;
         &amp;quot;apps&amp;quot;:[],&lt;br /&gt;
         &amp;quot;details&amp;quot;:[&lt;br /&gt;
            {&lt;br /&gt;
               &amp;quot;appID&amp;quot;:&amp;quot;[your ios team id].[your application&#039;s bundle id]&amp;quot;,&lt;br /&gt;
               &amp;quot;paths&amp;quot;:[&lt;br /&gt;
                  &amp;quot;*&amp;quot;&lt;br /&gt;
               ]&lt;br /&gt;
            }&lt;br /&gt;
         ]&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a real example on [https://secure.barion.com/apple-app-site-association our website].&lt;br /&gt;
&lt;br /&gt;
You can read more about Universal link in [https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html Apple&#039;s documentation]&lt;br /&gt;
The Universal Link doesn&#039;t work in simulator!&lt;br /&gt;
&lt;br /&gt;
===1. step - Setup your iOS application for Universal links===&lt;br /&gt;
Open the XCode. Select your project and the target. Select the &#039;&#039;&#039;Capabilities&#039;&#039;&#039; tab and look for the &#039;&#039;&#039;Associated Domains&#039;&#039;&#039; section! You need to add the domains that you have written in the 0.2 step:&lt;br /&gt;
[[File:Universallink.png|center|800px]]&lt;br /&gt;
As a result, this will generate a [ProjectName].entitlements file.&lt;br /&gt;
&lt;br /&gt;
===2. step - Setup your application to handle your own scheme===&lt;br /&gt;
Switch to the &#039;&#039;&#039;Info&#039;&#039;&#039; tab, and open the &#039;&#039;&#039;URL Types&#039;&#039;&#039; section! Add your own url scheme as you can see on this image.&lt;br /&gt;
[[File:UrlScheme.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===3. step - Create classes for network communication===&lt;br /&gt;
Here you can see a possible solution:&lt;br /&gt;
====3.1. step - Network base class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.h&lt;br /&gt;
   #import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @protocol BaseConnectionHandlerDelegate &amp;lt;NSObject&amp;gt;&lt;br /&gt;
      - (void)networkError;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface BaseConnectionHandler : NSObject &amp;lt;NSURLConnectionDataDelegate, NSURLConnectionDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
       NSURLConnection* _connection;&lt;br /&gt;
       NSMutableData* _data;&lt;br /&gt;
       float _timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel;&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString;&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString;&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result;&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation BaseConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   static int _activityIndicatorRequest = 0;&lt;br /&gt;
&lt;br /&gt;
   - (id)init&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _timeout = 30.0;&lt;br /&gt;
         _data = [[NSMutableData alloc] init];&lt;br /&gt;
         _activityIndicatorRequest++;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)dealloc&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      if(_activityIndicatorRequest &amp;gt; 1) {&lt;br /&gt;
         _activityIndicatorRequest--;&lt;br /&gt;
      } else {&lt;br /&gt;
         _activityIndicatorRequest = 0;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel&lt;br /&gt;
   {&lt;br /&gt;
      if(_connection)&lt;br /&gt;
      {&lt;br /&gt;
         [_connection cancel];&lt;br /&gt;
         _connection = nil;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [NSURL URLWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL: url];&lt;br /&gt;
      [request setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest: request delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [[NSURL alloc] initWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* urlRequest = [[NSMutableURLRequest alloc] initWithURL:url];&lt;br /&gt;
      NSData* requestData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];&lt;br /&gt;
      [urlRequest setValue: [NSString stringWithFormat:@&amp;quot;%lu&amp;quot;, (unsigned long)requestData.length] &lt;br /&gt;
         forHTTPHeaderField:@&amp;quot;Content-Length&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;gzip&amp;quot; forHTTPHeaderField:@&amp;quot;Accept-Encoding&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;application/json&amp;quot; forHTTPHeaderField:@&amp;quot;Content-Type&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPMethod: @&amp;quot;POST&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPBody: requestData];&lt;br /&gt;
      [urlRequest setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data&lt;br /&gt;
   {&lt;br /&gt;
      [_data appendData: data];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connectionDidFinishLoading:(NSURLConnection *)connection&lt;br /&gt;
   {&lt;br /&gt;
      NSError* jsonParsingError;&lt;br /&gt;
      NSDictionary* jsonResult = [NSJSONSerialization JSONObjectWithData: _data options: 0 error: &amp;amp;jsonParsingError];&lt;br /&gt;
      if(jsonParsingError != nil) {&lt;br /&gt;
         [self error: nil];&lt;br /&gt;
      } else {&lt;br /&gt;
         NSArray* jsonErrors = [jsonResult objectForKey: @&amp;quot;Errors&amp;quot;];&lt;br /&gt;
         if(jsonErrors.count != 0)&lt;br /&gt;
         {&lt;br /&gt;
            NSMutableArray* errors = [NSMutableArray new];&lt;br /&gt;
            for(int i = 0; i &amp;lt; jsonErrors.count; ++i)&lt;br /&gt;
            {&lt;br /&gt;
               NSDictionary* errorDict = [jsonErrors objectAtIndex: i];&lt;br /&gt;
               BarionError* error = [[BarionError alloc] initWithErrorCode: [errorDict objectForKey: @&amp;quot;ErrorCode&amp;quot;] &lt;br /&gt;
                  title: [errorDict objectForKey: @&amp;quot;Title&amp;quot;] description: [errorDict objectForKey:@&amp;quot;Description&amp;quot;]];&lt;br /&gt;
               [errors addObject: error];&lt;br /&gt;
            }&lt;br /&gt;
            [self error: errors];&lt;br /&gt;
         } else {&lt;br /&gt;
            [self requestComplete: jsonResult];&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      [self error: nil];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)setTimeout:(float)timeout {&lt;br /&gt;
      _timeout = timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.2. step - Payment initiator network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol StartPaymentConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)paymentStartSuccessed:(NSDictionary*)result;&lt;br /&gt;
      - (void)paymentStartFailed:(NSArray*)errors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface StartPaymentConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;StartPaymentConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Product.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation StartPaymentConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSMutableArray* productsArray = [NSMutableArray new];&lt;br /&gt;
         for(int i = 0; i &amp;lt; products.count; ++i)&lt;br /&gt;
         {&lt;br /&gt;
            Product* p = [products objectAtIndex: i];&lt;br /&gt;
            NSMutableDictionary* dict = [NSMutableDictionary new];&lt;br /&gt;
            [dict setObject: p.name forKey: @&amp;quot;Name&amp;quot;];&lt;br /&gt;
            [dict setObject: p.productDescription forKey: @&amp;quot;Description&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.quantity] forKey: @&amp;quot;Quantity&amp;quot;];&lt;br /&gt;
            [dict setObject: p.unit forKey: @&amp;quot;Unit&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;UnitPrice&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;ItemTotal&amp;quot;];&lt;br /&gt;
            [dict setObject: p.SKU forKey: @&amp;quot;SKU&amp;quot;];&lt;br /&gt;
            [productsArray addObject: dict];&lt;br /&gt;
         }&lt;br /&gt;
        &lt;br /&gt;
         NSMutableDictionary* containerDict = [NSMutableDictionary new];&lt;br /&gt;
         [containerDict setObject: productsArray forKey: @&amp;quot;Products&amp;quot;];&lt;br /&gt;
         [containerDict setObject: [Parameters redirectUrl] forKey: @&amp;quot;RedirectUrl&amp;quot;];&lt;br /&gt;
        &lt;br /&gt;
         NSString* jsonString = [[NSString alloc] initWithData: [NSJSONSerialization dataWithJSONObject: containerDict &lt;br /&gt;
            options:0 error:nil] encoding: NSUTF8StringEncoding];&lt;br /&gt;
        &lt;br /&gt;
         [self startPOSTWithUrlString: [Parameters startBarionPaymentUrl] jsonString: jsonString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate paymentStartSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil)&lt;br /&gt;
      {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate paymentStartFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.3. step - Payment&#039;s status network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol GetPaymentStateConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)getPaymentStateSuccessed:(NSDictionary*)response;&lt;br /&gt;
      - (void)getPaymentStateFailed:(NSArray*)barionErrors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface GetPaymentStateConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation GetPaymentStateConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSString* urlString = [NSString stringWithFormat: @&amp;quot;%@%@&amp;quot;,[Parameters getBarionPaymentStateUrl], paymentId];&lt;br /&gt;
         [self startGETWithUrlString: urlString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate getPaymentStateSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil) {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate getPaymentStateFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4. step - Initiate payment===&lt;br /&gt;
At any point in the mobile application – where the products you want to pay are available - you should initiate the payment in the Barion System. The Barion IOS Library will check the parameters and if something is wrong, itwill return with an error. The possible error codes can be found on [[Barion_Mobil_Library_Hibakódok|this page]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (IBAction)payWithBarion:(id)sender&lt;br /&gt;
   {&lt;br /&gt;
      _progressAlert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Communicating with the Barion system&amp;quot; message:nil &lt;br /&gt;
         delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];&lt;br /&gt;
      [_progressAlert show];&lt;br /&gt;
      startPaymentHandler = [[StartPaymentConnectionHandler alloc] initWithDelegate:self products: _products];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===5. step - Get results and redirect===&lt;br /&gt;
If the payment initiation was successful you need to redirect the user to the Barion mobile application or to Barion&#039;s website.&lt;br /&gt;
&lt;br /&gt;
In order for the user to be redirected to the Barion mobile application, the following requirements must be met:&lt;br /&gt;
* The device must have Barion mobile application installed.&lt;br /&gt;
* The installed Barion mobile application version must be above of 3.1.0.&lt;br /&gt;
&lt;br /&gt;
After you successfully initiated the payment you got a &#039;&#039;&#039;PaymentId&#039;&#039;&#039; parameter in the response. Start the Bairon mobile application with this &#039;&#039;&#039;PaymentId&#039;&#039;&#039; by the following:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (void)paymentStartSuccessed:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
      BarionStartPaymentResponse* response = [[BarionStartPaymentResponse alloc] initWithJsonDictionary: result];&lt;br /&gt;
      NSURL* url = [NSURL URLWithString:&lt;br /&gt;
         [NSString stringWithFormat: @&amp;quot;barion://?pid=%@&amp;amp;redirectUrl=%@&amp;quot;, response.paymentId, [Parameters redirectUrl]]];&lt;br /&gt;
      if([[UIApplication sharedApplication] canOpenURL: url]) {&lt;br /&gt;
         [[UIApplication sharedApplication] openURL: url];&lt;br /&gt;
      } else {&lt;br /&gt;
         UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
         WebViewController* web = [sb instantiateViewControllerWithIdentifier:@&amp;quot;webViewController&amp;quot;];&lt;br /&gt;
         web.paymentId = response.paymentId;&lt;br /&gt;
         web.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
         [self.navigationController setViewControllers: [NSArray arrayWithObject: web]];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)paymentStartFailed:(NSArray*)errors&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the Barion mobile application isn&#039;t installed on the user&#039;s device, you need to load Barion&#039;s website in a UIWebView.&lt;br /&gt;
&lt;br /&gt;
====5.1. step - Setup UIWebView====&lt;br /&gt;
We create a new viewcontroller with a full screen Webview and with a UIActivityIndicatorView. In the Interface Builder this will look something like this:&lt;br /&gt;
&lt;br /&gt;
[[Fájl:WebView.png|center|200px]]&lt;br /&gt;
&lt;br /&gt;
Here is the content of the UIViewController for that view above:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @interface WebViewController : UIViewController &amp;lt;UIWebViewDelegate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIWebView* webView;&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIActivityIndicatorView* loadIndicator;&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSString* paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.m&lt;br /&gt;
   #import &amp;quot;WebViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation WebViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
    &lt;br /&gt;
      self.title = @&amp;quot;Barion Smart Books&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
      [_webView setHidden: YES];&lt;br /&gt;
      [_loadIndicator setHidden: NO];&lt;br /&gt;
      [_loadIndicator startAnimating];&lt;br /&gt;
    &lt;br /&gt;
      NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:&lt;br /&gt;
         [NSURL URLWithString:&lt;br /&gt;
            [NSString stringWithFormat: @&amp;quot;https://barion.com/Pay?Id=%@&amp;quot;, _paymentId]]];&lt;br /&gt;
    &lt;br /&gt;
      [_webView loadRequest: request];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webViewDidFinishLoad:(UIWebView *)webView&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      [_loadIndicator setHidden: YES];&lt;br /&gt;
      [_webView setHidden: NO];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      UIAlertView* alert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Error&amp;quot; message: @&amp;quot;The requested page could not load&amp;quot; &lt;br /&gt;
         delegate: nil cancelButtonTitle: @&amp;quot;OK&amp;quot; otherButtonTitles: nil, nil];&lt;br /&gt;
      [alert show];&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = [NSURL URLWithString: [NSString stringWithFormat:@&amp;quot;%@?paymentId=%@&amp;quot;, [Parameters redirectUrl], _paymentId]];&lt;br /&gt;
      [self.navigationController setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType&lt;br /&gt;
   {&lt;br /&gt;
      if ([[request.URL absoluteString] hasPrefix: [Parameters redirectUrl]]) {&lt;br /&gt;
         [((AppDelegate*)[UIApplication sharedApplication].delegate) openPaymentResultViewControllerWithUrl: request.URL];&lt;br /&gt;
         return NO;&lt;br /&gt;
      }&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===6. step - Handling redirect===&lt;br /&gt;
You need to implement these methods in your application&#039;s AppDelegate.m file.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {&lt;br /&gt;
      [self openPaymentResultViewControllerWithUrl: userActivity.webpageURL];&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)openPaymentResultViewControllerWithUrl:(NSURL*)url&lt;br /&gt;
   {&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = url;&lt;br /&gt;
      result.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
      UINavigationController* controller = (UINavigationController*)self.window.rootViewController;&lt;br /&gt;
      [controller setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===7. step - Get payment&#039;s result===&lt;br /&gt;
In the Barion mobile application the user can pay or reject the payment. After that, the application closes itself. Then the user will be redirected to the integrator mobile application and you need to request the payment&#039;s status from your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @interface PaymentResultViewController : UIViewController &amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      GetPaymentStateConnectionHandler* _getPaymentStateHandler;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSURL* url;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.m&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation PaymentResultViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
&lt;br /&gt;
      NSString* paymentId = [[_url absoluteString] stringByReplacingOccurrencesOfString: [NSString stringWithFormat: @&amp;quot;%@?paymentId=&amp;quot;, [Parameters redirectUrl]] withString:@&amp;quot;&amp;quot;];&lt;br /&gt;
      _getPaymentStateHandler = [[GetPaymentStateConnectionHandler alloc] initWithDelegate: self paymentId: paymentId];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateSuccessed:(NSDictionary*)response&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
      BarionGetPaymentStateResponse* paymentState = [[BarionGetPaymentStateResponse alloc] initWithJsonDictionary: response];&lt;br /&gt;
      // you can find the payment details in this object&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateFailed:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the &#039;&#039;&#039;BarionGetPaymentStateResponse&#039;&#039;&#039; object you can easily get the payment details.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1524</id>
		<title>App2App integration on ios with server side</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1524"/>
		<updated>2019-02-07T14:39:12Z</updated>

		<summary type="html">&lt;p&gt;Macika: /* 2. step - Setup your application to handle your own scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
In this type of integration, you don&#039;t need to edit your server-side. In your mobile application, you don&#039;t have to implement network communication. We already did it for you. If you use the Barion Android library you have to add a few lines of code to your existing codebase. The disadvantage of this is, that you have to notify your own server-side about the payments and your mobile app can contain the POSKey.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Downloads, example==&lt;br /&gt;
You can download the example project from [https://github.com/barion/barion-ios-objc-app2app/tree/master/examples/NativeIntegration this].&lt;br /&gt;
&lt;br /&gt;
This project contains the models, and error handling processes. so this description won&#039;t talk about it.&lt;br /&gt;
&lt;br /&gt;
==flow chart==&lt;br /&gt;
[[File:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
==Server-side developments==&lt;br /&gt;
The server-side must be capable of the following call types (you can also see them on the flow chart above): :&lt;br /&gt;
* Payment initiation in the Barion System through the [[Payment-Start-v2|Payment/Start]] API request.&lt;br /&gt;
* Get payment&#039;s state from the Barion System through the [[Payment-GetPaymentState-v2|Payment/GetPaymentState]] API request.&lt;br /&gt;
&lt;br /&gt;
You can use any languages and technology. In the case of PHP you can use our library, which you can download from [https://github.com/barion Barion&#039;s GitHub page].&lt;br /&gt;
The Barion System using JSON format in the requests and responses.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===0. step - Server-side developments===&lt;br /&gt;
====0.1. step - Server-side requests====&lt;br /&gt;
For the server-side requests, you can use the examples directory in our PHP library on [https://github.com/barion/barion-web-php/tree/master/examples Barion&#039;s GitHub page]]. &lt;br /&gt;
&lt;br /&gt;
In this example we assume the following:&lt;br /&gt;
* For the payment initiator request, we will send the list of products with a POST request under the Items key&lt;br /&gt;
* For the payment&#039;s status, we will use a GET request.&lt;br /&gt;
&lt;br /&gt;
Add server-side endpoints to your mobile application:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   // Parameters.h file&lt;br /&gt;
   @interface Parameters : NSObject&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl;&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl;&lt;br /&gt;
   + (NSString*)redirectUrl;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // Parameters.m file&lt;br /&gt;
   @implementation Parameters&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/generate_barion_payment.php&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/get_barion_payment_state.php?PaymentId=&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)redirectUrl&lt;br /&gt;
   {&lt;br /&gt;
      NSString* url;&lt;br /&gt;
      if ([[[UIDevice currentDevice] systemVersion] floatValue] &amp;lt; 9) {&lt;br /&gt;
         url = @&amp;quot;your-domain://&amp;quot;;&lt;br /&gt;
      } else {&lt;br /&gt;
         url = @&amp;quot;https://your-domain.com/&amp;quot;;&lt;br /&gt;
      }&lt;br /&gt;
      return url;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====0.2. step - Setup your server-side for Universal links====&lt;br /&gt;
In order to the Barion mobile application to redirect the user to the integrator mobile application, you have to put one file into your website&#039;s root directory. Your website must support HTTPS protocol. Simply put a file into your website&#039;s root directory. Name it to &#039;&#039;&#039;apple-app-site-association&#039;&#039;&#039;. Don&#039;t write any extension to the name. The file’s content should be something like this:&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      &amp;quot;applinks&amp;quot;:{&lt;br /&gt;
         &amp;quot;apps&amp;quot;:[],&lt;br /&gt;
         &amp;quot;details&amp;quot;:[&lt;br /&gt;
            {&lt;br /&gt;
               &amp;quot;appID&amp;quot;:&amp;quot;[your ios team id].[your application&#039;s bundle id]&amp;quot;,&lt;br /&gt;
               &amp;quot;paths&amp;quot;:[&lt;br /&gt;
                  &amp;quot;*&amp;quot;&lt;br /&gt;
               ]&lt;br /&gt;
            }&lt;br /&gt;
         ]&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a real example on [https://secure.barion.com/apple-app-site-association our website].&lt;br /&gt;
&lt;br /&gt;
You can read more about Universal link in [https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html Apple&#039;s documentation]&lt;br /&gt;
The Universal Link doesn&#039;t work in simulator!&lt;br /&gt;
&lt;br /&gt;
===1. step - Setup your iOS application for Universal links===&lt;br /&gt;
Open the XCode. Select your project and the target. Select the &#039;&#039;&#039;Capabilities&#039;&#039;&#039; tab and look for the &#039;&#039;&#039;Associated Domains&#039;&#039;&#039; section! You need to add the domains that you have written in the 0.2 step:&lt;br /&gt;
[[Fájl:Universallink.png|center|800px]]&lt;br /&gt;
As a result, this will generate a [ProjectName].entitlements file.&lt;br /&gt;
&lt;br /&gt;
===2. step - Setup your application to handle your own scheme===&lt;br /&gt;
Switch to the &#039;&#039;&#039;Info&#039;&#039;&#039; tab, and open the &#039;&#039;&#039;URL Types&#039;&#039;&#039; section! Add your own url scheme as you can see on this image.&lt;br /&gt;
[[File:UrlScheme.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===3. step - Create classes for network communication===&lt;br /&gt;
Here you can see a possible solution:&lt;br /&gt;
====3.1. step - Network base class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.h&lt;br /&gt;
   #import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @protocol BaseConnectionHandlerDelegate &amp;lt;NSObject&amp;gt;&lt;br /&gt;
      - (void)networkError;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface BaseConnectionHandler : NSObject &amp;lt;NSURLConnectionDataDelegate, NSURLConnectionDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
       NSURLConnection* _connection;&lt;br /&gt;
       NSMutableData* _data;&lt;br /&gt;
       float _timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel;&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString;&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString;&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result;&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation BaseConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   static int _activityIndicatorRequest = 0;&lt;br /&gt;
&lt;br /&gt;
   - (id)init&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _timeout = 30.0;&lt;br /&gt;
         _data = [[NSMutableData alloc] init];&lt;br /&gt;
         _activityIndicatorRequest++;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)dealloc&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      if(_activityIndicatorRequest &amp;gt; 1) {&lt;br /&gt;
         _activityIndicatorRequest--;&lt;br /&gt;
      } else {&lt;br /&gt;
         _activityIndicatorRequest = 0;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel&lt;br /&gt;
   {&lt;br /&gt;
      if(_connection)&lt;br /&gt;
      {&lt;br /&gt;
         [_connection cancel];&lt;br /&gt;
         _connection = nil;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [NSURL URLWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL: url];&lt;br /&gt;
      [request setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest: request delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [[NSURL alloc] initWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* urlRequest = [[NSMutableURLRequest alloc] initWithURL:url];&lt;br /&gt;
      NSData* requestData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];&lt;br /&gt;
      [urlRequest setValue: [NSString stringWithFormat:@&amp;quot;%lu&amp;quot;, (unsigned long)requestData.length] &lt;br /&gt;
         forHTTPHeaderField:@&amp;quot;Content-Length&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;gzip&amp;quot; forHTTPHeaderField:@&amp;quot;Accept-Encoding&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;application/json&amp;quot; forHTTPHeaderField:@&amp;quot;Content-Type&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPMethod: @&amp;quot;POST&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPBody: requestData];&lt;br /&gt;
      [urlRequest setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data&lt;br /&gt;
   {&lt;br /&gt;
      [_data appendData: data];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connectionDidFinishLoading:(NSURLConnection *)connection&lt;br /&gt;
   {&lt;br /&gt;
      NSError* jsonParsingError;&lt;br /&gt;
      NSDictionary* jsonResult = [NSJSONSerialization JSONObjectWithData: _data options: 0 error: &amp;amp;jsonParsingError];&lt;br /&gt;
      if(jsonParsingError != nil) {&lt;br /&gt;
         [self error: nil];&lt;br /&gt;
      } else {&lt;br /&gt;
         NSArray* jsonErrors = [jsonResult objectForKey: @&amp;quot;Errors&amp;quot;];&lt;br /&gt;
         if(jsonErrors.count != 0)&lt;br /&gt;
         {&lt;br /&gt;
            NSMutableArray* errors = [NSMutableArray new];&lt;br /&gt;
            for(int i = 0; i &amp;lt; jsonErrors.count; ++i)&lt;br /&gt;
            {&lt;br /&gt;
               NSDictionary* errorDict = [jsonErrors objectAtIndex: i];&lt;br /&gt;
               BarionError* error = [[BarionError alloc] initWithErrorCode: [errorDict objectForKey: @&amp;quot;ErrorCode&amp;quot;] &lt;br /&gt;
                  title: [errorDict objectForKey: @&amp;quot;Title&amp;quot;] description: [errorDict objectForKey:@&amp;quot;Description&amp;quot;]];&lt;br /&gt;
               [errors addObject: error];&lt;br /&gt;
            }&lt;br /&gt;
            [self error: errors];&lt;br /&gt;
         } else {&lt;br /&gt;
            [self requestComplete: jsonResult];&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      [self error: nil];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)setTimeout:(float)timeout {&lt;br /&gt;
      _timeout = timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.2. step - Payment initiator network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol StartPaymentConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)paymentStartSuccessed:(NSDictionary*)result;&lt;br /&gt;
      - (void)paymentStartFailed:(NSArray*)errors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface StartPaymentConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;StartPaymentConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Product.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation StartPaymentConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSMutableArray* productsArray = [NSMutableArray new];&lt;br /&gt;
         for(int i = 0; i &amp;lt; products.count; ++i)&lt;br /&gt;
         {&lt;br /&gt;
            Product* p = [products objectAtIndex: i];&lt;br /&gt;
            NSMutableDictionary* dict = [NSMutableDictionary new];&lt;br /&gt;
            [dict setObject: p.name forKey: @&amp;quot;Name&amp;quot;];&lt;br /&gt;
            [dict setObject: p.productDescription forKey: @&amp;quot;Description&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.quantity] forKey: @&amp;quot;Quantity&amp;quot;];&lt;br /&gt;
            [dict setObject: p.unit forKey: @&amp;quot;Unit&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;UnitPrice&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;ItemTotal&amp;quot;];&lt;br /&gt;
            [dict setObject: p.SKU forKey: @&amp;quot;SKU&amp;quot;];&lt;br /&gt;
            [productsArray addObject: dict];&lt;br /&gt;
         }&lt;br /&gt;
        &lt;br /&gt;
         NSMutableDictionary* containerDict = [NSMutableDictionary new];&lt;br /&gt;
         [containerDict setObject: productsArray forKey: @&amp;quot;Products&amp;quot;];&lt;br /&gt;
         [containerDict setObject: [Parameters redirectUrl] forKey: @&amp;quot;RedirectUrl&amp;quot;];&lt;br /&gt;
        &lt;br /&gt;
         NSString* jsonString = [[NSString alloc] initWithData: [NSJSONSerialization dataWithJSONObject: containerDict &lt;br /&gt;
            options:0 error:nil] encoding: NSUTF8StringEncoding];&lt;br /&gt;
        &lt;br /&gt;
         [self startPOSTWithUrlString: [Parameters startBarionPaymentUrl] jsonString: jsonString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate paymentStartSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil)&lt;br /&gt;
      {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate paymentStartFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.3. step - Payment&#039;s status network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol GetPaymentStateConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)getPaymentStateSuccessed:(NSDictionary*)response;&lt;br /&gt;
      - (void)getPaymentStateFailed:(NSArray*)barionErrors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface GetPaymentStateConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation GetPaymentStateConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSString* urlString = [NSString stringWithFormat: @&amp;quot;%@%@&amp;quot;,[Parameters getBarionPaymentStateUrl], paymentId];&lt;br /&gt;
         [self startGETWithUrlString: urlString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate getPaymentStateSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil) {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate getPaymentStateFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4. step - Initiate payment===&lt;br /&gt;
At any point in the mobile application – where the products you want to pay are available - you should initiate the payment in the Barion System. The Barion IOS Library will check the parameters and if something is wrong, itwill return with an error. The possible error codes can be found on [[Barion_Mobil_Library_Hibakódok|this page]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (IBAction)payWithBarion:(id)sender&lt;br /&gt;
   {&lt;br /&gt;
      _progressAlert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Communicating with the Barion system&amp;quot; message:nil &lt;br /&gt;
         delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];&lt;br /&gt;
      [_progressAlert show];&lt;br /&gt;
      startPaymentHandler = [[StartPaymentConnectionHandler alloc] initWithDelegate:self products: _products];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===5. step - Get results and redirect===&lt;br /&gt;
If the payment initiation was successful you need to redirect the user to the Barion mobile application or to Barion&#039;s website.&lt;br /&gt;
&lt;br /&gt;
In order for the user to be redirected to the Barion mobile application, the following requirements must be met:&lt;br /&gt;
* The device must have Barion mobile application installed.&lt;br /&gt;
* The installed Barion mobile application version must be above of 3.1.0.&lt;br /&gt;
&lt;br /&gt;
After you successfully initiated the payment you got a &#039;&#039;&#039;PaymentId&#039;&#039;&#039; parameter in the response. Start the Bairon mobile application with this &#039;&#039;&#039;PaymentId&#039;&#039;&#039; by the following:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (void)paymentStartSuccessed:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
      BarionStartPaymentResponse* response = [[BarionStartPaymentResponse alloc] initWithJsonDictionary: result];&lt;br /&gt;
      NSURL* url = [NSURL URLWithString:&lt;br /&gt;
         [NSString stringWithFormat: @&amp;quot;barion://?pid=%@&amp;amp;redirectUrl=%@&amp;quot;, response.paymentId, [Parameters redirectUrl]]];&lt;br /&gt;
      if([[UIApplication sharedApplication] canOpenURL: url]) {&lt;br /&gt;
         [[UIApplication sharedApplication] openURL: url];&lt;br /&gt;
      } else {&lt;br /&gt;
         UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
         WebViewController* web = [sb instantiateViewControllerWithIdentifier:@&amp;quot;webViewController&amp;quot;];&lt;br /&gt;
         web.paymentId = response.paymentId;&lt;br /&gt;
         web.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
         [self.navigationController setViewControllers: [NSArray arrayWithObject: web]];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)paymentStartFailed:(NSArray*)errors&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the Barion mobile application isn&#039;t installed on the user&#039;s device, you need to load Barion&#039;s website in a UIWebView.&lt;br /&gt;
&lt;br /&gt;
====5.1. step - Setup UIWebView====&lt;br /&gt;
We create a new viewcontroller with a full screen Webview and with a UIActivityIndicatorView. In the Interface Builder this will look something like this:&lt;br /&gt;
&lt;br /&gt;
[[Fájl:WebView.png|center|200px]]&lt;br /&gt;
&lt;br /&gt;
Here is the content of the UIViewController for that view above:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @interface WebViewController : UIViewController &amp;lt;UIWebViewDelegate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIWebView* webView;&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIActivityIndicatorView* loadIndicator;&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSString* paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.m&lt;br /&gt;
   #import &amp;quot;WebViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation WebViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
    &lt;br /&gt;
      self.title = @&amp;quot;Barion Smart Books&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
      [_webView setHidden: YES];&lt;br /&gt;
      [_loadIndicator setHidden: NO];&lt;br /&gt;
      [_loadIndicator startAnimating];&lt;br /&gt;
    &lt;br /&gt;
      NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:&lt;br /&gt;
         [NSURL URLWithString:&lt;br /&gt;
            [NSString stringWithFormat: @&amp;quot;https://barion.com/Pay?Id=%@&amp;quot;, _paymentId]]];&lt;br /&gt;
    &lt;br /&gt;
      [_webView loadRequest: request];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webViewDidFinishLoad:(UIWebView *)webView&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      [_loadIndicator setHidden: YES];&lt;br /&gt;
      [_webView setHidden: NO];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      UIAlertView* alert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Error&amp;quot; message: @&amp;quot;The requested page could not load&amp;quot; &lt;br /&gt;
         delegate: nil cancelButtonTitle: @&amp;quot;OK&amp;quot; otherButtonTitles: nil, nil];&lt;br /&gt;
      [alert show];&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = [NSURL URLWithString: [NSString stringWithFormat:@&amp;quot;%@?paymentId=%@&amp;quot;, [Parameters redirectUrl], _paymentId]];&lt;br /&gt;
      [self.navigationController setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType&lt;br /&gt;
   {&lt;br /&gt;
      if ([[request.URL absoluteString] hasPrefix: [Parameters redirectUrl]]) {&lt;br /&gt;
         [((AppDelegate*)[UIApplication sharedApplication].delegate) openPaymentResultViewControllerWithUrl: request.URL];&lt;br /&gt;
         return NO;&lt;br /&gt;
      }&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===6. step - Handling redirect===&lt;br /&gt;
You need to implement these methods in your application&#039;s AppDelegate.m file.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {&lt;br /&gt;
      [self openPaymentResultViewControllerWithUrl: userActivity.webpageURL];&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)openPaymentResultViewControllerWithUrl:(NSURL*)url&lt;br /&gt;
   {&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = url;&lt;br /&gt;
      result.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
      UINavigationController* controller = (UINavigationController*)self.window.rootViewController;&lt;br /&gt;
      [controller setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===7. step - Get payment&#039;s result===&lt;br /&gt;
In the Barion mobile application the user can pay or reject the payment. After that, the application closes itself. Then the user will be redirected to the integrator mobile application and you need to request the payment&#039;s status from your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @interface PaymentResultViewController : UIViewController &amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      GetPaymentStateConnectionHandler* _getPaymentStateHandler;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSURL* url;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.m&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation PaymentResultViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
&lt;br /&gt;
      NSString* paymentId = [[_url absoluteString] stringByReplacingOccurrencesOfString: [NSString stringWithFormat: @&amp;quot;%@?paymentId=&amp;quot;, [Parameters redirectUrl]] withString:@&amp;quot;&amp;quot;];&lt;br /&gt;
      _getPaymentStateHandler = [[GetPaymentStateConnectionHandler alloc] initWithDelegate: self paymentId: paymentId];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateSuccessed:(NSDictionary*)response&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
      BarionGetPaymentStateResponse* paymentState = [[BarionGetPaymentStateResponse alloc] initWithJsonDictionary: response];&lt;br /&gt;
      // you can find the payment details in this object&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateFailed:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the &#039;&#039;&#039;BarionGetPaymentStateResponse&#039;&#039;&#039; object you can easily get the payment details.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1523</id>
		<title>App2App integration on ios with server side</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1523"/>
		<updated>2019-02-07T14:38:33Z</updated>

		<summary type="html">&lt;p&gt;Macika: /* flow chart */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
In this type of integration, you don&#039;t need to edit your server-side. In your mobile application, you don&#039;t have to implement network communication. We already did it for you. If you use the Barion Android library you have to add a few lines of code to your existing codebase. The disadvantage of this is, that you have to notify your own server-side about the payments and your mobile app can contain the POSKey.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Downloads, example==&lt;br /&gt;
You can download the example project from [https://github.com/barion/barion-ios-objc-app2app/tree/master/examples/NativeIntegration this].&lt;br /&gt;
&lt;br /&gt;
This project contains the models, and error handling processes. so this description won&#039;t talk about it.&lt;br /&gt;
&lt;br /&gt;
==flow chart==&lt;br /&gt;
[[File:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
==Server-side developments==&lt;br /&gt;
The server-side must be capable of the following call types (you can also see them on the flow chart above): :&lt;br /&gt;
* Payment initiation in the Barion System through the [[Payment-Start-v2|Payment/Start]] API request.&lt;br /&gt;
* Get payment&#039;s state from the Barion System through the [[Payment-GetPaymentState-v2|Payment/GetPaymentState]] API request.&lt;br /&gt;
&lt;br /&gt;
You can use any languages and technology. In the case of PHP you can use our library, which you can download from [https://github.com/barion Barion&#039;s GitHub page].&lt;br /&gt;
The Barion System using JSON format in the requests and responses.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===0. step - Server-side developments===&lt;br /&gt;
====0.1. step - Server-side requests====&lt;br /&gt;
For the server-side requests, you can use the examples directory in our PHP library on [https://github.com/barion/barion-web-php/tree/master/examples Barion&#039;s GitHub page]]. &lt;br /&gt;
&lt;br /&gt;
In this example we assume the following:&lt;br /&gt;
* For the payment initiator request, we will send the list of products with a POST request under the Items key&lt;br /&gt;
* For the payment&#039;s status, we will use a GET request.&lt;br /&gt;
&lt;br /&gt;
Add server-side endpoints to your mobile application:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   // Parameters.h file&lt;br /&gt;
   @interface Parameters : NSObject&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl;&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl;&lt;br /&gt;
   + (NSString*)redirectUrl;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // Parameters.m file&lt;br /&gt;
   @implementation Parameters&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/generate_barion_payment.php&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/get_barion_payment_state.php?PaymentId=&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)redirectUrl&lt;br /&gt;
   {&lt;br /&gt;
      NSString* url;&lt;br /&gt;
      if ([[[UIDevice currentDevice] systemVersion] floatValue] &amp;lt; 9) {&lt;br /&gt;
         url = @&amp;quot;your-domain://&amp;quot;;&lt;br /&gt;
      } else {&lt;br /&gt;
         url = @&amp;quot;https://your-domain.com/&amp;quot;;&lt;br /&gt;
      }&lt;br /&gt;
      return url;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====0.2. step - Setup your server-side for Universal links====&lt;br /&gt;
In order to the Barion mobile application to redirect the user to the integrator mobile application, you have to put one file into your website&#039;s root directory. Your website must support HTTPS protocol. Simply put a file into your website&#039;s root directory. Name it to &#039;&#039;&#039;apple-app-site-association&#039;&#039;&#039;. Don&#039;t write any extension to the name. The file’s content should be something like this:&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      &amp;quot;applinks&amp;quot;:{&lt;br /&gt;
         &amp;quot;apps&amp;quot;:[],&lt;br /&gt;
         &amp;quot;details&amp;quot;:[&lt;br /&gt;
            {&lt;br /&gt;
               &amp;quot;appID&amp;quot;:&amp;quot;[your ios team id].[your application&#039;s bundle id]&amp;quot;,&lt;br /&gt;
               &amp;quot;paths&amp;quot;:[&lt;br /&gt;
                  &amp;quot;*&amp;quot;&lt;br /&gt;
               ]&lt;br /&gt;
            }&lt;br /&gt;
         ]&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a real example on [https://secure.barion.com/apple-app-site-association our website].&lt;br /&gt;
&lt;br /&gt;
You can read more about Universal link in [https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html Apple&#039;s documentation]&lt;br /&gt;
The Universal Link doesn&#039;t work in simulator!&lt;br /&gt;
&lt;br /&gt;
===1. step - Setup your iOS application for Universal links===&lt;br /&gt;
Open the XCode. Select your project and the target. Select the &#039;&#039;&#039;Capabilities&#039;&#039;&#039; tab and look for the &#039;&#039;&#039;Associated Domains&#039;&#039;&#039; section! You need to add the domains that you have written in the 0.2 step:&lt;br /&gt;
[[Fájl:Universallink.png|center|800px]]&lt;br /&gt;
As a result, this will generate a [ProjectName].entitlements file.&lt;br /&gt;
&lt;br /&gt;
===2. step - Setup your application to handle your own scheme===&lt;br /&gt;
Switch to the &#039;&#039;&#039;Info&#039;&#039;&#039; tab, and open the &#039;&#039;&#039;URL Types&#039;&#039;&#039; section! Add your own url scheme as you can see on this image.&lt;br /&gt;
[[Fájl:UrlScheme.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===3. step - Create classes for network communication===&lt;br /&gt;
Here you can see a possible solution:&lt;br /&gt;
====3.1. step - Network base class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.h&lt;br /&gt;
   #import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @protocol BaseConnectionHandlerDelegate &amp;lt;NSObject&amp;gt;&lt;br /&gt;
      - (void)networkError;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface BaseConnectionHandler : NSObject &amp;lt;NSURLConnectionDataDelegate, NSURLConnectionDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
       NSURLConnection* _connection;&lt;br /&gt;
       NSMutableData* _data;&lt;br /&gt;
       float _timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel;&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString;&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString;&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result;&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation BaseConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   static int _activityIndicatorRequest = 0;&lt;br /&gt;
&lt;br /&gt;
   - (id)init&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _timeout = 30.0;&lt;br /&gt;
         _data = [[NSMutableData alloc] init];&lt;br /&gt;
         _activityIndicatorRequest++;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)dealloc&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      if(_activityIndicatorRequest &amp;gt; 1) {&lt;br /&gt;
         _activityIndicatorRequest--;&lt;br /&gt;
      } else {&lt;br /&gt;
         _activityIndicatorRequest = 0;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel&lt;br /&gt;
   {&lt;br /&gt;
      if(_connection)&lt;br /&gt;
      {&lt;br /&gt;
         [_connection cancel];&lt;br /&gt;
         _connection = nil;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [NSURL URLWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL: url];&lt;br /&gt;
      [request setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest: request delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [[NSURL alloc] initWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* urlRequest = [[NSMutableURLRequest alloc] initWithURL:url];&lt;br /&gt;
      NSData* requestData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];&lt;br /&gt;
      [urlRequest setValue: [NSString stringWithFormat:@&amp;quot;%lu&amp;quot;, (unsigned long)requestData.length] &lt;br /&gt;
         forHTTPHeaderField:@&amp;quot;Content-Length&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;gzip&amp;quot; forHTTPHeaderField:@&amp;quot;Accept-Encoding&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;application/json&amp;quot; forHTTPHeaderField:@&amp;quot;Content-Type&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPMethod: @&amp;quot;POST&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPBody: requestData];&lt;br /&gt;
      [urlRequest setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data&lt;br /&gt;
   {&lt;br /&gt;
      [_data appendData: data];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connectionDidFinishLoading:(NSURLConnection *)connection&lt;br /&gt;
   {&lt;br /&gt;
      NSError* jsonParsingError;&lt;br /&gt;
      NSDictionary* jsonResult = [NSJSONSerialization JSONObjectWithData: _data options: 0 error: &amp;amp;jsonParsingError];&lt;br /&gt;
      if(jsonParsingError != nil) {&lt;br /&gt;
         [self error: nil];&lt;br /&gt;
      } else {&lt;br /&gt;
         NSArray* jsonErrors = [jsonResult objectForKey: @&amp;quot;Errors&amp;quot;];&lt;br /&gt;
         if(jsonErrors.count != 0)&lt;br /&gt;
         {&lt;br /&gt;
            NSMutableArray* errors = [NSMutableArray new];&lt;br /&gt;
            for(int i = 0; i &amp;lt; jsonErrors.count; ++i)&lt;br /&gt;
            {&lt;br /&gt;
               NSDictionary* errorDict = [jsonErrors objectAtIndex: i];&lt;br /&gt;
               BarionError* error = [[BarionError alloc] initWithErrorCode: [errorDict objectForKey: @&amp;quot;ErrorCode&amp;quot;] &lt;br /&gt;
                  title: [errorDict objectForKey: @&amp;quot;Title&amp;quot;] description: [errorDict objectForKey:@&amp;quot;Description&amp;quot;]];&lt;br /&gt;
               [errors addObject: error];&lt;br /&gt;
            }&lt;br /&gt;
            [self error: errors];&lt;br /&gt;
         } else {&lt;br /&gt;
            [self requestComplete: jsonResult];&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      [self error: nil];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)setTimeout:(float)timeout {&lt;br /&gt;
      _timeout = timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.2. step - Payment initiator network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol StartPaymentConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)paymentStartSuccessed:(NSDictionary*)result;&lt;br /&gt;
      - (void)paymentStartFailed:(NSArray*)errors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface StartPaymentConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;StartPaymentConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Product.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation StartPaymentConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSMutableArray* productsArray = [NSMutableArray new];&lt;br /&gt;
         for(int i = 0; i &amp;lt; products.count; ++i)&lt;br /&gt;
         {&lt;br /&gt;
            Product* p = [products objectAtIndex: i];&lt;br /&gt;
            NSMutableDictionary* dict = [NSMutableDictionary new];&lt;br /&gt;
            [dict setObject: p.name forKey: @&amp;quot;Name&amp;quot;];&lt;br /&gt;
            [dict setObject: p.productDescription forKey: @&amp;quot;Description&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.quantity] forKey: @&amp;quot;Quantity&amp;quot;];&lt;br /&gt;
            [dict setObject: p.unit forKey: @&amp;quot;Unit&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;UnitPrice&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;ItemTotal&amp;quot;];&lt;br /&gt;
            [dict setObject: p.SKU forKey: @&amp;quot;SKU&amp;quot;];&lt;br /&gt;
            [productsArray addObject: dict];&lt;br /&gt;
         }&lt;br /&gt;
        &lt;br /&gt;
         NSMutableDictionary* containerDict = [NSMutableDictionary new];&lt;br /&gt;
         [containerDict setObject: productsArray forKey: @&amp;quot;Products&amp;quot;];&lt;br /&gt;
         [containerDict setObject: [Parameters redirectUrl] forKey: @&amp;quot;RedirectUrl&amp;quot;];&lt;br /&gt;
        &lt;br /&gt;
         NSString* jsonString = [[NSString alloc] initWithData: [NSJSONSerialization dataWithJSONObject: containerDict &lt;br /&gt;
            options:0 error:nil] encoding: NSUTF8StringEncoding];&lt;br /&gt;
        &lt;br /&gt;
         [self startPOSTWithUrlString: [Parameters startBarionPaymentUrl] jsonString: jsonString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate paymentStartSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil)&lt;br /&gt;
      {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate paymentStartFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.3. step - Payment&#039;s status network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol GetPaymentStateConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)getPaymentStateSuccessed:(NSDictionary*)response;&lt;br /&gt;
      - (void)getPaymentStateFailed:(NSArray*)barionErrors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface GetPaymentStateConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation GetPaymentStateConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSString* urlString = [NSString stringWithFormat: @&amp;quot;%@%@&amp;quot;,[Parameters getBarionPaymentStateUrl], paymentId];&lt;br /&gt;
         [self startGETWithUrlString: urlString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate getPaymentStateSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil) {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate getPaymentStateFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4. step - Initiate payment===&lt;br /&gt;
At any point in the mobile application – where the products you want to pay are available - you should initiate the payment in the Barion System. The Barion IOS Library will check the parameters and if something is wrong, itwill return with an error. The possible error codes can be found on [[Barion_Mobil_Library_Hibakódok|this page]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (IBAction)payWithBarion:(id)sender&lt;br /&gt;
   {&lt;br /&gt;
      _progressAlert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Communicating with the Barion system&amp;quot; message:nil &lt;br /&gt;
         delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];&lt;br /&gt;
      [_progressAlert show];&lt;br /&gt;
      startPaymentHandler = [[StartPaymentConnectionHandler alloc] initWithDelegate:self products: _products];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===5. step - Get results and redirect===&lt;br /&gt;
If the payment initiation was successful you need to redirect the user to the Barion mobile application or to Barion&#039;s website.&lt;br /&gt;
&lt;br /&gt;
In order for the user to be redirected to the Barion mobile application, the following requirements must be met:&lt;br /&gt;
* The device must have Barion mobile application installed.&lt;br /&gt;
* The installed Barion mobile application version must be above of 3.1.0.&lt;br /&gt;
&lt;br /&gt;
After you successfully initiated the payment you got a &#039;&#039;&#039;PaymentId&#039;&#039;&#039; parameter in the response. Start the Bairon mobile application with this &#039;&#039;&#039;PaymentId&#039;&#039;&#039; by the following:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (void)paymentStartSuccessed:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
      BarionStartPaymentResponse* response = [[BarionStartPaymentResponse alloc] initWithJsonDictionary: result];&lt;br /&gt;
      NSURL* url = [NSURL URLWithString:&lt;br /&gt;
         [NSString stringWithFormat: @&amp;quot;barion://?pid=%@&amp;amp;redirectUrl=%@&amp;quot;, response.paymentId, [Parameters redirectUrl]]];&lt;br /&gt;
      if([[UIApplication sharedApplication] canOpenURL: url]) {&lt;br /&gt;
         [[UIApplication sharedApplication] openURL: url];&lt;br /&gt;
      } else {&lt;br /&gt;
         UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
         WebViewController* web = [sb instantiateViewControllerWithIdentifier:@&amp;quot;webViewController&amp;quot;];&lt;br /&gt;
         web.paymentId = response.paymentId;&lt;br /&gt;
         web.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
         [self.navigationController setViewControllers: [NSArray arrayWithObject: web]];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)paymentStartFailed:(NSArray*)errors&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the Barion mobile application isn&#039;t installed on the user&#039;s device, you need to load Barion&#039;s website in a UIWebView.&lt;br /&gt;
&lt;br /&gt;
====5.1. step - Setup UIWebView====&lt;br /&gt;
We create a new viewcontroller with a full screen Webview and with a UIActivityIndicatorView. In the Interface Builder this will look something like this:&lt;br /&gt;
&lt;br /&gt;
[[Fájl:WebView.png|center|200px]]&lt;br /&gt;
&lt;br /&gt;
Here is the content of the UIViewController for that view above:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @interface WebViewController : UIViewController &amp;lt;UIWebViewDelegate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIWebView* webView;&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIActivityIndicatorView* loadIndicator;&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSString* paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.m&lt;br /&gt;
   #import &amp;quot;WebViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation WebViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
    &lt;br /&gt;
      self.title = @&amp;quot;Barion Smart Books&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
      [_webView setHidden: YES];&lt;br /&gt;
      [_loadIndicator setHidden: NO];&lt;br /&gt;
      [_loadIndicator startAnimating];&lt;br /&gt;
    &lt;br /&gt;
      NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:&lt;br /&gt;
         [NSURL URLWithString:&lt;br /&gt;
            [NSString stringWithFormat: @&amp;quot;https://barion.com/Pay?Id=%@&amp;quot;, _paymentId]]];&lt;br /&gt;
    &lt;br /&gt;
      [_webView loadRequest: request];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webViewDidFinishLoad:(UIWebView *)webView&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      [_loadIndicator setHidden: YES];&lt;br /&gt;
      [_webView setHidden: NO];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      UIAlertView* alert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Error&amp;quot; message: @&amp;quot;The requested page could not load&amp;quot; &lt;br /&gt;
         delegate: nil cancelButtonTitle: @&amp;quot;OK&amp;quot; otherButtonTitles: nil, nil];&lt;br /&gt;
      [alert show];&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = [NSURL URLWithString: [NSString stringWithFormat:@&amp;quot;%@?paymentId=%@&amp;quot;, [Parameters redirectUrl], _paymentId]];&lt;br /&gt;
      [self.navigationController setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType&lt;br /&gt;
   {&lt;br /&gt;
      if ([[request.URL absoluteString] hasPrefix: [Parameters redirectUrl]]) {&lt;br /&gt;
         [((AppDelegate*)[UIApplication sharedApplication].delegate) openPaymentResultViewControllerWithUrl: request.URL];&lt;br /&gt;
         return NO;&lt;br /&gt;
      }&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===6. step - Handling redirect===&lt;br /&gt;
You need to implement these methods in your application&#039;s AppDelegate.m file.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {&lt;br /&gt;
      [self openPaymentResultViewControllerWithUrl: userActivity.webpageURL];&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)openPaymentResultViewControllerWithUrl:(NSURL*)url&lt;br /&gt;
   {&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = url;&lt;br /&gt;
      result.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
      UINavigationController* controller = (UINavigationController*)self.window.rootViewController;&lt;br /&gt;
      [controller setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===7. step - Get payment&#039;s result===&lt;br /&gt;
In the Barion mobile application the user can pay or reject the payment. After that, the application closes itself. Then the user will be redirected to the integrator mobile application and you need to request the payment&#039;s status from your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @interface PaymentResultViewController : UIViewController &amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      GetPaymentStateConnectionHandler* _getPaymentStateHandler;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSURL* url;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.m&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation PaymentResultViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
&lt;br /&gt;
      NSString* paymentId = [[_url absoluteString] stringByReplacingOccurrencesOfString: [NSString stringWithFormat: @&amp;quot;%@?paymentId=&amp;quot;, [Parameters redirectUrl]] withString:@&amp;quot;&amp;quot;];&lt;br /&gt;
      _getPaymentStateHandler = [[GetPaymentStateConnectionHandler alloc] initWithDelegate: self paymentId: paymentId];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateSuccessed:(NSDictionary*)response&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
      BarionGetPaymentStateResponse* paymentState = [[BarionGetPaymentStateResponse alloc] initWithJsonDictionary: response];&lt;br /&gt;
      // you can find the payment details in this object&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateFailed:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the &#039;&#039;&#039;BarionGetPaymentStateResponse&#039;&#039;&#039; object you can easily get the payment details.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1522</id>
		<title>App2App integration on ios with server side</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_on_ios_with_server_side&amp;diff=1522"/>
		<updated>2019-02-07T14:38:10Z</updated>

		<summary type="html">&lt;p&gt;Macika: Created page with &amp;quot;__NOTOC__  In this type of integration, you don&amp;#039;t need to edit your server-side. In your mobile application, you don&amp;#039;t have to implement network communication. We already did...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
In this type of integration, you don&#039;t need to edit your server-side. In your mobile application, you don&#039;t have to implement network communication. We already did it for you. If you use the Barion Android library you have to add a few lines of code to your existing codebase. The disadvantage of this is, that you have to notify your own server-side about the payments and your mobile app can contain the POSKey.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Downloads, example==&lt;br /&gt;
You can download the example project from [https://github.com/barion/barion-ios-objc-app2app/tree/master/examples/NativeIntegration this].&lt;br /&gt;
&lt;br /&gt;
This project contains the models, and error handling processes. so this description won&#039;t talk about it.&lt;br /&gt;
&lt;br /&gt;
==flow chart==&lt;br /&gt;
[[Fájl:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
==Server-side developments==&lt;br /&gt;
The server-side must be capable of the following call types (you can also see them on the flow chart above): :&lt;br /&gt;
* Payment initiation in the Barion System through the [[Payment-Start-v2|Payment/Start]] API request.&lt;br /&gt;
* Get payment&#039;s state from the Barion System through the [[Payment-GetPaymentState-v2|Payment/GetPaymentState]] API request.&lt;br /&gt;
&lt;br /&gt;
You can use any languages and technology. In the case of PHP you can use our library, which you can download from [https://github.com/barion Barion&#039;s GitHub page].&lt;br /&gt;
The Barion System using JSON format in the requests and responses.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===0. step - Server-side developments===&lt;br /&gt;
====0.1. step - Server-side requests====&lt;br /&gt;
For the server-side requests, you can use the examples directory in our PHP library on [https://github.com/barion/barion-web-php/tree/master/examples Barion&#039;s GitHub page]]. &lt;br /&gt;
&lt;br /&gt;
In this example we assume the following:&lt;br /&gt;
* For the payment initiator request, we will send the list of products with a POST request under the Items key&lt;br /&gt;
* For the payment&#039;s status, we will use a GET request.&lt;br /&gt;
&lt;br /&gt;
Add server-side endpoints to your mobile application:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
   // Parameters.h file&lt;br /&gt;
   @interface Parameters : NSObject&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl;&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl;&lt;br /&gt;
   + (NSString*)redirectUrl;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // Parameters.m file&lt;br /&gt;
   @implementation Parameters&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)startBarionPaymentUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/generate_barion_payment.php&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)getBarionPaymentStateUrl&lt;br /&gt;
   {&lt;br /&gt;
      return @&amp;quot;http://your-domain.com/get_barion_payment_state.php?PaymentId=&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   + (NSString*)redirectUrl&lt;br /&gt;
   {&lt;br /&gt;
      NSString* url;&lt;br /&gt;
      if ([[[UIDevice currentDevice] systemVersion] floatValue] &amp;lt; 9) {&lt;br /&gt;
         url = @&amp;quot;your-domain://&amp;quot;;&lt;br /&gt;
      } else {&lt;br /&gt;
         url = @&amp;quot;https://your-domain.com/&amp;quot;;&lt;br /&gt;
      }&lt;br /&gt;
      return url;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====0.2. step - Setup your server-side for Universal links====&lt;br /&gt;
In order to the Barion mobile application to redirect the user to the integrator mobile application, you have to put one file into your website&#039;s root directory. Your website must support HTTPS protocol. Simply put a file into your website&#039;s root directory. Name it to &#039;&#039;&#039;apple-app-site-association&#039;&#039;&#039;. Don&#039;t write any extension to the name. The file’s content should be something like this:&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      &amp;quot;applinks&amp;quot;:{&lt;br /&gt;
         &amp;quot;apps&amp;quot;:[],&lt;br /&gt;
         &amp;quot;details&amp;quot;:[&lt;br /&gt;
            {&lt;br /&gt;
               &amp;quot;appID&amp;quot;:&amp;quot;[your ios team id].[your application&#039;s bundle id]&amp;quot;,&lt;br /&gt;
               &amp;quot;paths&amp;quot;:[&lt;br /&gt;
                  &amp;quot;*&amp;quot;&lt;br /&gt;
               ]&lt;br /&gt;
            }&lt;br /&gt;
         ]&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is a real example on [https://secure.barion.com/apple-app-site-association our website].&lt;br /&gt;
&lt;br /&gt;
You can read more about Universal link in [https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html Apple&#039;s documentation]&lt;br /&gt;
The Universal Link doesn&#039;t work in simulator!&lt;br /&gt;
&lt;br /&gt;
===1. step - Setup your iOS application for Universal links===&lt;br /&gt;
Open the XCode. Select your project and the target. Select the &#039;&#039;&#039;Capabilities&#039;&#039;&#039; tab and look for the &#039;&#039;&#039;Associated Domains&#039;&#039;&#039; section! You need to add the domains that you have written in the 0.2 step:&lt;br /&gt;
[[Fájl:Universallink.png|center|800px]]&lt;br /&gt;
As a result, this will generate a [ProjectName].entitlements file.&lt;br /&gt;
&lt;br /&gt;
===2. step - Setup your application to handle your own scheme===&lt;br /&gt;
Switch to the &#039;&#039;&#039;Info&#039;&#039;&#039; tab, and open the &#039;&#039;&#039;URL Types&#039;&#039;&#039; section! Add your own url scheme as you can see on this image.&lt;br /&gt;
[[Fájl:UrlScheme.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===3. step - Create classes for network communication===&lt;br /&gt;
Here you can see a possible solution:&lt;br /&gt;
====3.1. step - Network base class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.h&lt;br /&gt;
   #import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @protocol BaseConnectionHandlerDelegate &amp;lt;NSObject&amp;gt;&lt;br /&gt;
      - (void)networkError;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface BaseConnectionHandler : NSObject &amp;lt;NSURLConnectionDataDelegate, NSURLConnectionDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
       NSURLConnection* _connection;&lt;br /&gt;
       NSMutableData* _data;&lt;br /&gt;
       float _timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel;&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString;&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString;&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result;&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // BaseConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation BaseConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   static int _activityIndicatorRequest = 0;&lt;br /&gt;
&lt;br /&gt;
   - (id)init&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _timeout = 30.0;&lt;br /&gt;
         _data = [[NSMutableData alloc] init];&lt;br /&gt;
         _activityIndicatorRequest++;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)dealloc&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      if(_activityIndicatorRequest &amp;gt; 1) {&lt;br /&gt;
         _activityIndicatorRequest--;&lt;br /&gt;
      } else {&lt;br /&gt;
         _activityIndicatorRequest = 0;&lt;br /&gt;
         [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)cancel&lt;br /&gt;
   {&lt;br /&gt;
      if(_connection)&lt;br /&gt;
      {&lt;br /&gt;
         [_connection cancel];&lt;br /&gt;
         _connection = nil;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startGETWithUrlString:(NSString*)urlString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [NSURL URLWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL: url];&lt;br /&gt;
      [request setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest: request delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)startPOSTWithUrlString:(NSString*)urlString jsonString:(NSString*)jsonString&lt;br /&gt;
   {&lt;br /&gt;
      NSURL* url = [[NSURL alloc] initWithString: urlString];&lt;br /&gt;
      NSMutableURLRequest* urlRequest = [[NSMutableURLRequest alloc] initWithURL:url];&lt;br /&gt;
      NSData* requestData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];&lt;br /&gt;
      [urlRequest setValue: [NSString stringWithFormat:@&amp;quot;%lu&amp;quot;, (unsigned long)requestData.length] &lt;br /&gt;
         forHTTPHeaderField:@&amp;quot;Content-Length&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;gzip&amp;quot; forHTTPHeaderField:@&amp;quot;Accept-Encoding&amp;quot;];&lt;br /&gt;
      [urlRequest setValue:@&amp;quot;application/json&amp;quot; forHTTPHeaderField:@&amp;quot;Content-Type&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPMethod: @&amp;quot;POST&amp;quot;];&lt;br /&gt;
      [urlRequest setHTTPBody: requestData];&lt;br /&gt;
      [urlRequest setTimeoutInterval:_timeout];&lt;br /&gt;
      _connection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data&lt;br /&gt;
   {&lt;br /&gt;
      [_data appendData: data];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connectionDidFinishLoading:(NSURLConnection *)connection&lt;br /&gt;
   {&lt;br /&gt;
      NSError* jsonParsingError;&lt;br /&gt;
      NSDictionary* jsonResult = [NSJSONSerialization JSONObjectWithData: _data options: 0 error: &amp;amp;jsonParsingError];&lt;br /&gt;
      if(jsonParsingError != nil) {&lt;br /&gt;
         [self error: nil];&lt;br /&gt;
      } else {&lt;br /&gt;
         NSArray* jsonErrors = [jsonResult objectForKey: @&amp;quot;Errors&amp;quot;];&lt;br /&gt;
         if(jsonErrors.count != 0)&lt;br /&gt;
         {&lt;br /&gt;
            NSMutableArray* errors = [NSMutableArray new];&lt;br /&gt;
            for(int i = 0; i &amp;lt; jsonErrors.count; ++i)&lt;br /&gt;
            {&lt;br /&gt;
               NSDictionary* errorDict = [jsonErrors objectAtIndex: i];&lt;br /&gt;
               BarionError* error = [[BarionError alloc] initWithErrorCode: [errorDict objectForKey: @&amp;quot;ErrorCode&amp;quot;] &lt;br /&gt;
                  title: [errorDict objectForKey: @&amp;quot;Title&amp;quot;] description: [errorDict objectForKey:@&amp;quot;Description&amp;quot;]];&lt;br /&gt;
               [errors addObject: error];&lt;br /&gt;
            }&lt;br /&gt;
            [self error: errors];&lt;br /&gt;
         } else {&lt;br /&gt;
            [self requestComplete: jsonResult];&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [self cancel];&lt;br /&gt;
      [self error: nil];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)setTimeout:(float)timeout {&lt;br /&gt;
      _timeout = timeout;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.2. step - Payment initiator network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol StartPaymentConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)paymentStartSuccessed:(NSDictionary*)result;&lt;br /&gt;
      - (void)paymentStartFailed:(NSArray*)errors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface StartPaymentConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // StartPaymentConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;StartPaymentConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Product.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation StartPaymentConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;StartPaymentConnectionHandlerDelegate&amp;gt;)delegate products:(NSArray*)products;&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSMutableArray* productsArray = [NSMutableArray new];&lt;br /&gt;
         for(int i = 0; i &amp;lt; products.count; ++i)&lt;br /&gt;
         {&lt;br /&gt;
            Product* p = [products objectAtIndex: i];&lt;br /&gt;
            NSMutableDictionary* dict = [NSMutableDictionary new];&lt;br /&gt;
            [dict setObject: p.name forKey: @&amp;quot;Name&amp;quot;];&lt;br /&gt;
            [dict setObject: p.productDescription forKey: @&amp;quot;Description&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.quantity] forKey: @&amp;quot;Quantity&amp;quot;];&lt;br /&gt;
            [dict setObject: p.unit forKey: @&amp;quot;Unit&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;UnitPrice&amp;quot;];&lt;br /&gt;
            [dict setObject: [NSString stringWithFormat: @&amp;quot;%f&amp;quot;, p.price] forKey: @&amp;quot;ItemTotal&amp;quot;];&lt;br /&gt;
            [dict setObject: p.SKU forKey: @&amp;quot;SKU&amp;quot;];&lt;br /&gt;
            [productsArray addObject: dict];&lt;br /&gt;
         }&lt;br /&gt;
        &lt;br /&gt;
         NSMutableDictionary* containerDict = [NSMutableDictionary new];&lt;br /&gt;
         [containerDict setObject: productsArray forKey: @&amp;quot;Products&amp;quot;];&lt;br /&gt;
         [containerDict setObject: [Parameters redirectUrl] forKey: @&amp;quot;RedirectUrl&amp;quot;];&lt;br /&gt;
        &lt;br /&gt;
         NSString* jsonString = [[NSString alloc] initWithData: [NSJSONSerialization dataWithJSONObject: containerDict &lt;br /&gt;
            options:0 error:nil] encoding: NSUTF8StringEncoding];&lt;br /&gt;
        &lt;br /&gt;
         [self startPOSTWithUrlString: [Parameters startBarionPaymentUrl] jsonString: jsonString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate paymentStartSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil)&lt;br /&gt;
      {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate paymentStartFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.3. step - Payment&#039;s status network class====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.h&lt;br /&gt;
   #import &amp;quot;BaseConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @protocol GetPaymentStateConnectionHandlerDelegate &amp;lt;BaseConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
      - (void)getPaymentStateSuccessed:(NSDictionary*)response;&lt;br /&gt;
      - (void)getPaymentStateFailed:(NSArray*)barionErrors;&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   @interface GetPaymentStateConnectionHandler : BaseConnectionHandler&lt;br /&gt;
   {&lt;br /&gt;
      id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt; _delegate;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // GetPaymentStateConnectionHandler.m&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation GetPaymentStateConnectionHandler&lt;br /&gt;
&lt;br /&gt;
   - (id)initWithDelegate:(id&amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;)delegate paymentId:(NSString*)paymentId&lt;br /&gt;
   {&lt;br /&gt;
      self = [super init];&lt;br /&gt;
      if(self)&lt;br /&gt;
      {&lt;br /&gt;
         _delegate = delegate;&lt;br /&gt;
        &lt;br /&gt;
         NSString* urlString = [NSString stringWithFormat: @&amp;quot;%@%@&amp;quot;,[Parameters getBarionPaymentStateUrl], paymentId];&lt;br /&gt;
         [self startGETWithUrlString: urlString];&lt;br /&gt;
      }&lt;br /&gt;
      return self;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)requestComplete:(NSDictionary *)result&lt;br /&gt;
   {&lt;br /&gt;
      [_delegate getPaymentStateSuccessed: result];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)error:(NSArray *)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      if(barionErrors == nil) {&lt;br /&gt;
         [_delegate networkError];&lt;br /&gt;
      } else {&lt;br /&gt;
         [_delegate getPaymentStateFailed: barionErrors];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4. step - Initiate payment===&lt;br /&gt;
At any point in the mobile application – where the products you want to pay are available - you should initiate the payment in the Barion System. The Barion IOS Library will check the parameters and if something is wrong, itwill return with an error. The possible error codes can be found on [[Barion_Mobil_Library_Hibakódok|this page]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (IBAction)payWithBarion:(id)sender&lt;br /&gt;
   {&lt;br /&gt;
      _progressAlert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Communicating with the Barion system&amp;quot; message:nil &lt;br /&gt;
         delegate:nil cancelButtonTitle:nil otherButtonTitles:nil, nil];&lt;br /&gt;
      [_progressAlert show];&lt;br /&gt;
      startPaymentHandler = [[StartPaymentConnectionHandler alloc] initWithDelegate:self products: _products];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===5. step - Get results and redirect===&lt;br /&gt;
If the payment initiation was successful you need to redirect the user to the Barion mobile application or to Barion&#039;s website.&lt;br /&gt;
&lt;br /&gt;
In order for the user to be redirected to the Barion mobile application, the following requirements must be met:&lt;br /&gt;
* The device must have Barion mobile application installed.&lt;br /&gt;
* The installed Barion mobile application version must be above of 3.1.0.&lt;br /&gt;
&lt;br /&gt;
After you successfully initiated the payment you got a &#039;&#039;&#039;PaymentId&#039;&#039;&#039; parameter in the response. Start the Bairon mobile application with this &#039;&#039;&#039;PaymentId&#039;&#039;&#039; by the following:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (void)paymentStartSuccessed:(NSDictionary*)result&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
      BarionStartPaymentResponse* response = [[BarionStartPaymentResponse alloc] initWithJsonDictionary: result];&lt;br /&gt;
      NSURL* url = [NSURL URLWithString:&lt;br /&gt;
         [NSString stringWithFormat: @&amp;quot;barion://?pid=%@&amp;amp;redirectUrl=%@&amp;quot;, response.paymentId, [Parameters redirectUrl]]];&lt;br /&gt;
      if([[UIApplication sharedApplication] canOpenURL: url]) {&lt;br /&gt;
         [[UIApplication sharedApplication] openURL: url];&lt;br /&gt;
      } else {&lt;br /&gt;
         UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
         WebViewController* web = [sb instantiateViewControllerWithIdentifier:@&amp;quot;webViewController&amp;quot;];&lt;br /&gt;
         web.paymentId = response.paymentId;&lt;br /&gt;
         web.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
         [self.navigationController setViewControllers: [NSArray arrayWithObject: web]];&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)paymentStartFailed:(NSArray*)errors&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      startPaymentHandler = nil;&lt;br /&gt;
      [_progressAlert dismissWithClickedButtonIndex:0 animated: YES];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the Barion mobile application isn&#039;t installed on the user&#039;s device, you need to load Barion&#039;s website in a UIWebView.&lt;br /&gt;
&lt;br /&gt;
====5.1. step - Setup UIWebView====&lt;br /&gt;
We create a new viewcontroller with a full screen Webview and with a UIActivityIndicatorView. In the Interface Builder this will look something like this:&lt;br /&gt;
&lt;br /&gt;
[[Fájl:WebView.png|center|200px]]&lt;br /&gt;
&lt;br /&gt;
Here is the content of the UIViewController for that view above:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @interface WebViewController : UIViewController &amp;lt;UIWebViewDelegate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIWebView* webView;&lt;br /&gt;
   @property (weak, nonatomic) IBOutlet UIActivityIndicatorView* loadIndicator;&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSString* paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // WebViewController.m&lt;br /&gt;
   #import &amp;quot;WebViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;AppDelegate.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation WebViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
    &lt;br /&gt;
      self.title = @&amp;quot;Barion Smart Books&amp;quot;;&lt;br /&gt;
    &lt;br /&gt;
      [_webView setHidden: YES];&lt;br /&gt;
      [_loadIndicator setHidden: NO];&lt;br /&gt;
      [_loadIndicator startAnimating];&lt;br /&gt;
    &lt;br /&gt;
      NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:&lt;br /&gt;
         [NSURL URLWithString:&lt;br /&gt;
            [NSString stringWithFormat: @&amp;quot;https://barion.com/Pay?Id=%@&amp;quot;, _paymentId]]];&lt;br /&gt;
    &lt;br /&gt;
      [_webView loadRequest: request];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webViewDidFinishLoad:(UIWebView *)webView&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      [_loadIndicator setHidden: YES];&lt;br /&gt;
      [_webView setHidden: NO];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error&lt;br /&gt;
   {&lt;br /&gt;
      [_loadIndicator stopAnimating];&lt;br /&gt;
      UIAlertView* alert = [[UIAlertView alloc] initWithTitle: @&amp;quot;Error&amp;quot; message: @&amp;quot;The requested page could not load&amp;quot; &lt;br /&gt;
         delegate: nil cancelButtonTitle: @&amp;quot;OK&amp;quot; otherButtonTitles: nil, nil];&lt;br /&gt;
      [alert show];&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = [NSURL URLWithString: [NSString stringWithFormat:@&amp;quot;%@?paymentId=%@&amp;quot;, [Parameters redirectUrl], _paymentId]];&lt;br /&gt;
      [self.navigationController setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType&lt;br /&gt;
   {&lt;br /&gt;
      if ([[request.URL absoluteString] hasPrefix: [Parameters redirectUrl]]) {&lt;br /&gt;
         [((AppDelegate*)[UIApplication sharedApplication].delegate) openPaymentResultViewControllerWithUrl: request.URL];&lt;br /&gt;
         return NO;&lt;br /&gt;
      }&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===6. step - Handling redirect===&lt;br /&gt;
You need to implement these methods in your application&#039;s AppDelegate.m file.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {&lt;br /&gt;
      [self openPaymentResultViewControllerWithUrl: userActivity.webpageURL];&lt;br /&gt;
      return YES;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)openPaymentResultViewControllerWithUrl:(NSURL*)url&lt;br /&gt;
   {&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.url = url;&lt;br /&gt;
      result.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
      UINavigationController* controller = (UINavigationController*)self.window.rootViewController;&lt;br /&gt;
      [controller setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===7. step - Get payment&#039;s result===&lt;br /&gt;
In the Barion mobile application the user can pay or reject the payment. After that, the application closes itself. Then the user will be redirected to the integrator mobile application and you need to request the payment&#039;s status from your server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @interface PaymentResultViewController : UIViewController &amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      GetPaymentStateConnectionHandler* _getPaymentStateHandler;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSURL* url;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.m&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation PaymentResultViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
&lt;br /&gt;
      NSString* paymentId = [[_url absoluteString] stringByReplacingOccurrencesOfString: [NSString stringWithFormat: @&amp;quot;%@?paymentId=&amp;quot;, [Parameters redirectUrl]] withString:@&amp;quot;&amp;quot;];&lt;br /&gt;
      _getPaymentStateHandler = [[GetPaymentStateConnectionHandler alloc] initWithDelegate: self paymentId: paymentId];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateSuccessed:(NSDictionary*)response&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
      BarionGetPaymentStateResponse* paymentState = [[BarionGetPaymentStateResponse alloc] initWithJsonDictionary: response];&lt;br /&gt;
      // you can find the payment details in this object&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)getPaymentStateFailed:(NSArray*)barionErrors&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (void)networkError&lt;br /&gt;
   {&lt;br /&gt;
      _getPaymentStateHandler = nil;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the &#039;&#039;&#039;BarionGetPaymentStateResponse&#039;&#039;&#039; object you can easily get the payment details.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_with_ios_library&amp;diff=1521</id>
		<title>App2App integration with ios library</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_with_ios_library&amp;diff=1521"/>
		<updated>2019-02-07T11:17:35Z</updated>

		<summary type="html">&lt;p&gt;Macika: Created page with &amp;quot;__NOTOC__ In this type of integration, you don&amp;#039;t need to edit your server-side (aside from the Universal link modifications). In your mobile application, you don&amp;#039;t have to imp...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
In this type of integration, you don&#039;t need to edit your server-side (aside from the Universal link modifications). In your mobile application, you don&#039;t have to implement network communication. We already did it for you. If you use the Barion Android library you have to add a few lines of code to your existing codebase. The disadvantage of this is that you have to notify your own server-side about the payments and your mobile app can contain the POSKey.&lt;br /&gt;
&lt;br /&gt;
==Downloads, example==&lt;br /&gt;
You can download the Barion iOS Library from [https://github.com/barion/barion-ios-objc-app2app/tree/master/library Barion&#039;s Github page].&lt;br /&gt;
&lt;br /&gt;
You can download the example project from [https://github.com/barion/barion-ios-objc-app2app/tree/master/examples/LibraryIntegration Barion&#039;s Github page].&lt;br /&gt;
&lt;br /&gt;
The library contains the necessary models, so you don&#039;t need to implement them.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===0. step - Setup Universal link===&lt;br /&gt;
In order to the Barion mobile application to redirect the user to the integrator mobile application, you have to put one file into your website&#039;s root directory. Your website have to support HTTPS protocol. Simply put a file into your website&#039;s root directory with &#039;&#039;&#039;apple-app-site-association&#039;&#039;&#039; name and don&#039;t write an extension to it. This file’s content should be something like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      &amp;quot;applinks&amp;quot;:{&lt;br /&gt;
         &amp;quot;apps&amp;quot;:[],&lt;br /&gt;
         &amp;quot;details&amp;quot;:[&lt;br /&gt;
            {&lt;br /&gt;
               &amp;quot;appID&amp;quot;:&amp;quot;[your ios team id].[your application&#039;s bundle id]&amp;quot;,&lt;br /&gt;
               &amp;quot;paths&amp;quot;:[&lt;br /&gt;
                  &amp;quot;*&amp;quot;&lt;br /&gt;
               ]&lt;br /&gt;
            }&lt;br /&gt;
         ]&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can find your Team ID on this site: [https://developer.apple.com/membercenter/index.action#profile Organization Profile]&lt;br /&gt;
&lt;br /&gt;
Here you are a real example on [https://secure.barion.com/apple-app-site-association our website]. &lt;br /&gt;
&lt;br /&gt;
You can read more about Universal link in [https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html Apple&#039;s documentation]&lt;br /&gt;
The Universal Link doesn&#039;t work in simulator!&lt;br /&gt;
&lt;br /&gt;
===1. step - Setup your iOS application for Universal links===&lt;br /&gt;
Open the XCode, select your project and the target. Select the &#039;&#039;&#039;Capabilities&#039;&#039;&#039; tab and find the &#039;&#039;&#039;Associated Domains&#039;&#039;&#039; section! You need to add that domains that you have written in the 0.2 step:&lt;br /&gt;
[[File:Universallink.png|center|800px]]&lt;br /&gt;
As a result, this will generate a [ProjectName].entitlements file.&lt;br /&gt;
&lt;br /&gt;
===2. step - Setup your application to handle your own scheme.===&lt;br /&gt;
Switch to the &#039;&#039;&#039;Info&#039;&#039;&#039; tab, and open the &#039;&#039;&#039;URL Types&#039;&#039;&#039; section! Add your own url scheme just like on this image.&lt;br /&gt;
[[File:UrlScheme.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===3. step - Add Barion iOS library to your project===&lt;br /&gt;
You can download the required files from [https://github.com/barion/barion-ios-objc-app2app/tree/master/library Barion&#039;s Github page].&lt;br /&gt;
&lt;br /&gt;
Copy the &#039;&#039;&#039;libBarioniOSLibrary.a&#039;&#039;&#039; and the &#039;&#039;&#039;BarionBundle.bundle&#039;&#039;&#039; files into your project&#039;s root directory. Copy the &#039;&#039;&#039;include&#039;&#039;&#039; directory into your project directory. Pay attention that the &#039;&#039;&#039;Copy items if needed&#039;&#039;&#039; and the &#039;&#039;&#039;Create folder references&#039;&#039;&#039; settings should be on.&lt;br /&gt;
&lt;br /&gt;
Select your project and the target. Find under the &#039;&#039;&#039;Build settings&#039;&#039;&#039; tab the &#039;&#039;&#039;Other Linker Flags&#039;&#039;&#039; option and add this &#039;&#039;&#039;-ObjC&#039;&#039;&#039; to it.&lt;br /&gt;
[[File:OtherLinkerflags.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
Check on the &#039;&#039;&#039;Build Phases&#039;&#039;&#039; tab that the &#039;&#039;&#039;Link Binary With Libraries&#039;&#039;&#039; section contains the &#039;&#039;&#039;libBarioniOSLibrary.a&#039;&#039;&#039; file, and in the &#039;&#039;&#039;Copy Bundle Resources&#039;&#039;&#039; section contains the &#039;&#039;&#039;include&#039;&#039;&#039; directory and the &#039;&#039;&#039;BarionBundle.bundle&#039;&#039;&#039; file.&lt;br /&gt;
[[File:CheckYourself.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
===4. step - Start payment===&lt;br /&gt;
You need to implement the BarionLibraryDelegate protocol in that UIViewController, which will start the payment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // MainViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
   #import &amp;quot;../include/BarioniOSLibrary/LibraryViewController.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @interface MainViewController : UIViewController &amp;lt;UITableViewDataSource, UITableViewDelegate, BarionLibraryDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      NSArray* _products;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   - (IBAction)payWithBarion:(id)sender;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Import the required headers in the MainViewController.m file!&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   #import &amp;quot;include/BarioniOSLibrary/PaymentSettings.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;include/BarioniOSLibrary/TransactionModel.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;include/BarioniOSLibrary/Product.h&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implement the payWithBarion method. Initiate the payment and the library controller.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (IBAction)payWithBarion:(id)sender&lt;br /&gt;
   {&lt;br /&gt;
      NSMutableArray* result = [NSMutableArray new];&lt;br /&gt;
      [_products addObject: [[Product alloc] initUsingBlock:^(Product *product) {&lt;br /&gt;
         product.name = @&amp;quot;The history of money&amp;quot;;&lt;br /&gt;
         product.productDescription = @&amp;quot;The evolution of money from the stoneage to Barion&amp;quot;;&lt;br /&gt;
         product.quantity = 1;&lt;br /&gt;
         product.unit = @&amp;quot;db&amp;quot;;&lt;br /&gt;
         product.price = 40;&lt;br /&gt;
         product.itemTotal = 40;&lt;br /&gt;
         product.SKU = @&amp;quot;APP2APP_PENZTORT&amp;quot;;&lt;br /&gt;
      }]];&lt;br /&gt;
      [_products addObject: [[Product alloc] initUsingBlock:^(Product *product) {&lt;br /&gt;
         product.name = @&amp;quot;How to make a fortune with Barion&amp;quot;;&lt;br /&gt;
         product.productDescription = @&amp;quot;Tips to get rich&amp;quot;;&lt;br /&gt;
         product.quantity = 1;&lt;br /&gt;
         product.unit = @&amp;quot;db&amp;quot;;&lt;br /&gt;
         product.price = 20;&lt;br /&gt;
         product.itemTotal = 20;&lt;br /&gt;
         product.SKU = @&amp;quot;APP2APP_GETRICH&amp;quot;;&lt;br /&gt;
      }]];&lt;br /&gt;
      [_products addObject: [[Product alloc] initUsingBlock:^(Product *product) {&lt;br /&gt;
         product.name = @&amp;quot;The beginners guide to accepting bank cards&amp;quot;;&lt;br /&gt;
         product.productDescription = @&amp;quot;How to become bank card acceptors in five minutes with Barion&amp;quot;;&lt;br /&gt;
         product.quantity = 1;&lt;br /&gt;
         product.unit = @&amp;quot;db&amp;quot;;&lt;br /&gt;
         product.price = 140;&lt;br /&gt;
         product.itemTotal = 140;&lt;br /&gt;
         product.SKU = @&amp;quot;APP2APP_BEGGUIDE&amp;quot;;&lt;br /&gt;
      }]];&lt;br /&gt;
&lt;br /&gt;
      TransactionModel *transactionSettings = [[TransactionModel alloc] initUsingBlock:^(TransactionModel *settings){&lt;br /&gt;
         settings.posTransactionId = @&amp;quot;TEST-01-App2App&amp;quot;;&lt;br /&gt;
         settings.payee = [Parameters examplePayee];&lt;br /&gt;
         settings.total = [self getProductsTotal];&lt;br /&gt;
         settings.comment = @&amp;quot;Barion app2app ios library&amp;quot;;&lt;br /&gt;
      }];&lt;br /&gt;
    &lt;br /&gt;
      PaymentSettings *paymentSettings = [[PaymentSettings alloc] initUsingBlock:^(PaymentSettings *settings){&lt;br /&gt;
         settings.posKey = [Parameters posKey];&lt;br /&gt;
         settings.paymentTypeEnum = Immediate;&lt;br /&gt;
         settings.guestCheckOut = YES;&lt;br /&gt;
         settings.debugMode = YES;&lt;br /&gt;
         settings.locale = @&amp;quot;hu-HU&amp;quot;;&lt;br /&gt;
         settings.fundingSourceEnum = All;&lt;br /&gt;
         settings.redirectUrl = [Parameters redirectUrl];&lt;br /&gt;
         settings.redirectUrliOS9 = [Parameters redirectUrl];&lt;br /&gt;
      }];&lt;br /&gt;
    &lt;br /&gt;
      UIStoryboard *sb = [UIStoryboard storyboardWithName:@&amp;quot;LibraryMain&amp;quot; bundle:&lt;br /&gt;
         [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@&amp;quot;BarionBundle&amp;quot; withExtension:@&amp;quot;bundle&amp;quot;]]];&lt;br /&gt;
      ((AppDelegate*)[UIApplication sharedApplication].delegate).libraryViewController = (LibraryViewController*)[sb instantiateInitialViewController];&lt;br /&gt;
      ((AppDelegate*)[UIApplication sharedApplication].delegate).libraryViewController.delegate = self;&lt;br /&gt;
      ((AppDelegate*)[UIApplication sharedApplication].delegate).libraryViewController.productList = [_products mutableCopy];&lt;br /&gt;
      ((AppDelegate*)[UIApplication sharedApplication].delegate).libraryViewController.transactionSettings = transactionSettings;&lt;br /&gt;
      ((AppDelegate*)[UIApplication sharedApplication].delegate).libraryViewController.paymentSettings = paymentSettings;&lt;br /&gt;
      [self presentViewController: ((AppDelegate*)[UIApplication sharedApplication].delegate).libraryViewController animated:YES completion:nil];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there was an error in your payment initiation, you will be notified through the barionLibraryStatus method:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   - (void)barionLibraryStatus:(NSMutableDictionary *)response&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After this the library will automatically open the Barion mobile application or redirect the user to Barion&#039;s website.&lt;br /&gt;
&lt;br /&gt;
===5. step - Handling redirect===&lt;br /&gt;
Add these methods to your application&#039;s AppDelegate.m file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
   -(void)applicationWillEnterForeground:(UIApplication *)application {&lt;br /&gt;
    NSString *paymentId = ((AppDelegate*)[UIApplication sharedApplication].delegate).libraryViewController.paymentId;&lt;br /&gt;
    if (paymentId != nil) {&lt;br /&gt;
        [LibraryViewController getPaymentStateWithPaymentId:paymentId withPOSKey:[Parameters posKey] inDebugMode:[Parameters debugMode] andWithCallback:^(NSDictionary* response){&lt;br /&gt;
            NSLog(@&amp;quot;continue block runned&amp;quot;);&lt;br /&gt;
            [self openPaymentResultViewControllerWithPaymentId:paymentId orWithUrl:nil];&lt;br /&gt;
            ((AppDelegate*)[UIApplication sharedApplication].delegate).libraryViewController = nil;&lt;br /&gt;
        }];&lt;br /&gt;
    }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   - (void)openPaymentResultViewControllerWithPaymentId:(NSString*)paymentId orWithUrl:(NSURL*)url {&lt;br /&gt;
      UIStoryboard* sb = [UIStoryboard storyboardWithName: @&amp;quot;Main&amp;quot; bundle:nil];&lt;br /&gt;
      PaymentResultViewController* result = [sb instantiateViewControllerWithIdentifier:@&amp;quot;paymentResultViewController&amp;quot;];&lt;br /&gt;
      result.paymentId = paymentId;&lt;br /&gt;
      result.url = url;&lt;br /&gt;
      result.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;&lt;br /&gt;
      UINavigationController* controller = (UINavigationController*)self.window.rootViewController;&lt;br /&gt;
      [[controller presentedViewController] dismissViewControllerAnimated: YES completion:^{&lt;br /&gt;
          [controller setViewControllers: [NSArray arrayWithObject: result]];&lt;br /&gt;
      }];&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===6. step - Get payment&#039;s status===&lt;br /&gt;
After the user returns your application, you should get the payment&#039;s status. In this example we use &#039;&#039;&#039;PaymentResultViewController&#039;&#039;&#039; class for this. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.h&lt;br /&gt;
   #import &amp;lt;UIKit/UIKit.h&amp;gt;&lt;br /&gt;
   #import &amp;quot;GetPaymentStateConnectionHandler.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @interface PaymentResultViewController : UIViewController &amp;lt;GetPaymentStateConnectionHandlerDelegate&amp;gt;&lt;br /&gt;
   {&lt;br /&gt;
      GetPaymentStateConnectionHandler* _getPaymentStateHandler;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @property (nonatomic, retain) NSURL* url;&lt;br /&gt;
   @property (nonatomic, retain) NSString* paymentId;&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&lt;br /&gt;
   // PaymentResultViewController.m&lt;br /&gt;
   #import &amp;quot;PaymentResultViewController.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionError.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;BarionGetPaymentStateResponse.h&amp;quot;&lt;br /&gt;
   #import &amp;quot;Parameters.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
   @implementation PaymentResultViewController&lt;br /&gt;
&lt;br /&gt;
   - (void)viewDidLoad {&lt;br /&gt;
      [super viewDidLoad];&lt;br /&gt;
&lt;br /&gt;
       if (self.url != nil) {&lt;br /&gt;
           [LibraryViewController getPaymentStateWithUrl:self.url withPOSKey:[Parameters posKey] inDebugMode:[Parameters debugMode] andWithCallback:^(NSDictionary* response){&lt;br /&gt;
               // The response dictionary contains the payment details&lt;br /&gt;
           }];&lt;br /&gt;
        } else if (self.paymentId != nil){&lt;br /&gt;
           [LibraryViewController getPaymentStateWithPaymentId:self.paymentId  withPOSKey: [Parameters posKey] inDebugMode: [Parameters debugMode] andWithCallback:^(NSDictionary* response){&lt;br /&gt;
              // The response dictionary contains the payment details&lt;br /&gt;
           }];&lt;br /&gt;
        }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   @end&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From the dictionary you can easily get the payment details.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=File:CheckYourself.png&amp;diff=1520</id>
		<title>File:CheckYourself.png</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=File:CheckYourself.png&amp;diff=1520"/>
		<updated>2019-02-07T11:16:58Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=File:OtherLinkerflags.png&amp;diff=1519</id>
		<title>File:OtherLinkerflags.png</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=File:OtherLinkerflags.png&amp;diff=1519"/>
		<updated>2019-02-07T11:16:34Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=File:UrlScheme.png&amp;diff=1518</id>
		<title>File:UrlScheme.png</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=File:UrlScheme.png&amp;diff=1518"/>
		<updated>2019-02-07T11:16:07Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=File:Universallink.png&amp;diff=1517</id>
		<title>File:Universallink.png</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=File:Universallink.png&amp;diff=1517"/>
		<updated>2019-02-07T11:15:33Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_on_android_with_server_side&amp;diff=1516</id>
		<title>App2App integration on android with server side</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_on_android_with_server_side&amp;diff=1516"/>
		<updated>2019-02-07T11:00:50Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
This type of integration requires developments on your own server-side. Your server-side will communicate with the Barion System and your server-side will communicate with your mobile application. The mobile applications don&#039;t have to communicate with the Barion System directly and you don&#039;t have to add authentication information to your mobile application. Another adventage of this method is, that you can log the network communication on your server-side, and you can control the communication with your mobile application.&lt;br /&gt;
&lt;br /&gt;
==Downloads, examples==&lt;br /&gt;
You can download the example project from [https://github.com/barion/barion-android-java-app2app/tree/master/examples/NativeIntegration this].&lt;br /&gt;
&lt;br /&gt;
This project contains the models and error handling processes, so in this description we won&#039;t talk about it.&lt;br /&gt;
&lt;br /&gt;
==Flow chart==&lt;br /&gt;
[[File:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
==Server-side developments==&lt;br /&gt;
You can see above on the flow chart, the two types of calls that must be capable on your server-side:&lt;br /&gt;
* Payment initiation in the Barion System through the [[Payment-Start-v2|Payment/Start]] API request.&lt;br /&gt;
* Get payment&#039;s state from the Barion System through the [[Payment-GetPaymentState-v2|Payment/GetPaymentState]] API request.&lt;br /&gt;
&lt;br /&gt;
You can use any languages and technology, in the case of PHP you can use our library which you can download from [https://github.com/barion Barion&#039;s GitHub page].&lt;br /&gt;
The Barion System using JSON format in the requests and responses.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===0. step - Server-side requests===&lt;br /&gt;
For the server-side requests, you can use the examples directory in our PHP library on [https://github.com/barion/barion-web-php/tree/master/examples Barion&#039;s GitHub page]]. &lt;br /&gt;
&lt;br /&gt;
In this example we assume the following:&lt;br /&gt;
* For the payment initiator request, we will send the list of products with a POST request under the Items key&lt;br /&gt;
* For the payment&#039;s status, we will use a GET request.&lt;br /&gt;
&lt;br /&gt;
Add server-side endpoints to your mobile application:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   public static final String URL_STARTPAYMENT = &amp;quot;https://your-domain.com/generate_barion_payment.php&amp;quot;;   &lt;br /&gt;
   public static final String URL_GETPAYMENTSTATE = &amp;quot;https://your-domain.com/get_barion_payment_state.php&amp;quot;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===1. step - Edit AndroidManifest.xml file===&lt;br /&gt;
At first, you need to edit the AndroidManifest.xml file.&lt;br /&gt;
&lt;br /&gt;
====1.1. step - Providing internet access ====&lt;br /&gt;
For the communication your application needs internet access, so add the internet access permission to your AndroidManifest file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;manifest&lt;br /&gt;
      xmlns:android=&amp;quot;http://schemas.android.com/apk/res/android&amp;quot;&lt;br /&gt;
      package=&amp;quot;com.barion.example.app2app.nativeintegration&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;uses-permission android:name=&amp;quot;android.permission.INTERNET&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;!-- The rest of your AndroidManifest.xml --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;/manifest&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====1.2. step - Add redirect scheme====&lt;br /&gt;
In order to redirect from the Barion application into the integrator application, a redirect scheme is needed. You can choose anything, but it should be unique. In example this is &#039;&#039;&#039;myredirecturl&#039;&#039;&#039;. It is &#039;&#039;&#039;IMPORTANT&#039;&#039;&#039;, that this scheme must be the same as the &#039;&#039;&#039;redirectUrl&#039;&#039;&#039;  property of the [[Payment-Start-v2|Payment/Start]] request. You need to add this scheme in intent-filter into your result activity section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;activity&lt;br /&gt;
      android:name=&amp;quot;.activities.PaymentResultActivity&amp;quot;&lt;br /&gt;
      android:label=&amp;quot;@string/app_name&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;intent-filter&amp;gt;&lt;br /&gt;
         &amp;lt;action android:name=&amp;quot;android.intent.action.VIEW&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;category android:name=&amp;quot;android.intent.category.DEFAULT&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;category android:name=&amp;quot;android.intent.category.BROWSABLE&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;data android:scheme=&amp;quot;myredirecturl&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;/intent-filter&amp;gt;&lt;br /&gt;
   &amp;lt;/activity&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===2. step - Initiate payment===&lt;br /&gt;
At any point in the mobile application - where the products you want to pay are available - you should call the previously made server-side call, that will initiate payment in the Barion System.&lt;br /&gt;
&lt;br /&gt;
This is one of the many possible solutions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   progressDialog = ProgressDialog.show(getActivity(), null, getString(R.string.preparingpayment), true, false);&lt;br /&gt;
   new AsyncTask&amp;lt;Void, Void, String&amp;gt;() {&lt;br /&gt;
      @Override&lt;br /&gt;
      protected String doInBackground(Void... params) {&lt;br /&gt;
         HttpClient httpClient = new DefaultHttpClient();&lt;br /&gt;
         HttpPost post = new HttpPost(URL_STARTPAYMENT);&lt;br /&gt;
         try {&lt;br /&gt;
            JSONArray productsArray = new JSONArray();&lt;br /&gt;
            for(int i = 0; i &amp;lt; products.size(); ++i) {&lt;br /&gt;
               Product p = products.get(i);&lt;br /&gt;
               JSONObject productJson = new JSONObject();&lt;br /&gt;
               productJson&lt;br /&gt;
                  .put(&amp;quot;Name&amp;quot;, p.getName())&lt;br /&gt;
                  .put(&amp;quot;Description&amp;quot;, p.getDescription())&lt;br /&gt;
                  .put(&amp;quot;Quantity&amp;quot;, p.getQuantity())&lt;br /&gt;
                  .put(&amp;quot;Unit&amp;quot;, p.getUnit())&lt;br /&gt;
                  .put(&amp;quot;UnitPrice&amp;quot;, p.getPrice())&lt;br /&gt;
                  .put(&amp;quot;ItemTotal&amp;quot;, p.getPrice())&lt;br /&gt;
                  .put(&amp;quot;SKU&amp;quot;, p.getSKU());&lt;br /&gt;
               productsArray.put(productJson);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            JSONObject holderJson = new JSONObject();&lt;br /&gt;
            holderJson.put(&amp;quot;Items&amp;quot;, productsArray);&lt;br /&gt;
&lt;br /&gt;
            post.setHeader(HTTP.CONTENT_TYPE, &amp;quot;application/json;charset=UTF-8&amp;quot;);&lt;br /&gt;
            post.setEntity(new StringEntity(holderJson.toString(), &amp;quot;UTF-8&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
            HttpResponse response = httpClient.execute(post);&lt;br /&gt;
            InputStream stream = response.getEntity().getContent();&lt;br /&gt;
            BufferedReader reader = new BufferedReader(new InputStreamReader(stream));&lt;br /&gt;
            StringBuilder builder = new StringBuilder();&lt;br /&gt;
&lt;br /&gt;
            String line;&lt;br /&gt;
            while((line = reader.readLine()) != null) {&lt;br /&gt;
               builder.append(line);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            return builder.toString();&lt;br /&gt;
         } catch (Exception x) {&lt;br /&gt;
            return null;&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      @Override&lt;br /&gt;
      protected void onPostExecute(String s) {&lt;br /&gt;
         if(s == null) networkError();&lt;br /&gt;
         try {&lt;br /&gt;
            JSONObject resultObject = new JSONObject(s);&lt;br /&gt;
            BarionStartPaymentResponse response = BarionStartPaymentResponse.fromJsonObject(resultObject);&lt;br /&gt;
            if(response.getErrors().size() != 0) processBarionErrors(response.getErrors());&lt;br /&gt;
            else navigateUserToBarion(response);&lt;br /&gt;
         } catch (JSONException e) {&lt;br /&gt;
            networkError();&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }.execute();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===3. step - Redirect and get the result===&lt;br /&gt;
If the payment initiation was successful you need to redirect the user to the Barion mobile application or to Barion&#039;s website.&lt;br /&gt;
&lt;br /&gt;
In order for the user to be redirected to the Barion mobile application the following requirements must be met:&lt;br /&gt;
* The device must have Barion mobile application installed.&lt;br /&gt;
* The installed Barion mobile application version must be above of 3.1.0.&lt;br /&gt;
&lt;br /&gt;
If these conditions are not met you need to redirect the user to Barion&#039;s website. You can use these helper methods to check the requirements:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   public static boolean canPayWithBarionApp(Context context) {&lt;br /&gt;
      PackageManager packageManager = context.getPackageManager();&lt;br /&gt;
      try {&lt;br /&gt;
         PackageInfo barionInfo = packageManager.getPackageInfo(&amp;quot;barion.app&amp;quot;, PackageManager.GET_META_DATA);&lt;br /&gt;
         String barionVersion = barionInfo.versionName;&lt;br /&gt;
         String requiredVersion = &amp;quot;3.1.0&amp;quot;;&lt;br /&gt;
         return isVersionAReachedB(barionVersion, requiredVersion);&lt;br /&gt;
      } catch (PackageManager.NameNotFoundException e) {&lt;br /&gt;
         return false;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   private static boolean isVersionAReachedB(String versionA, String versionB){&lt;br /&gt;
      int a = Integer.valueOf(versionA.replaceAll(&amp;quot;[^0-9]&amp;quot;, &amp;quot;&amp;quot;));&lt;br /&gt;
      int b = Integer.valueOf(versionB.replaceAll(&amp;quot;[^0-9]&amp;quot;, &amp;quot;&amp;quot;));&lt;br /&gt;
      return a &amp;gt;= b;&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.1.1. step - Redirect to the Barion mobile application====&lt;br /&gt;
After you successfully initiated the payment, you got a &#039;&#039;&#039;PaymentId&#039;&#039;&#039; parameter. Start the Bairon mobile application with that &#039;&#039;&#039;PaymentId&#039;&#039;&#039; by the following:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   private int PAYMENT_REQUEST_CODE = 42;&lt;br /&gt;
   &lt;br /&gt;
   private void navigateUserToBarion(final BarionStartPaymentResponse response) {&lt;br /&gt;
      Intent intent = new Intent(Intent.ACTION_VIEW);&lt;br /&gt;
      paymentId = response.getPaymentId();&lt;br /&gt;
      intent.setData(Uri.parse(&amp;quot;barion:?pid=&amp;quot; + paymentId + &amp;quot;&amp;amp;action=returntoapp&amp;quot;));&lt;br /&gt;
      startActivityForResult(intent, PAYMENT_REQUEST_CODE);&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.1.2. step - Get payment&#039;s status====&lt;br /&gt;
In the Barion mobile application the user can pay or reject the payment, and after this the application closes itself. Then the user will be redirected to the integrator mobile application and you need to request the payment&#039;s status from your server:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   @Override&lt;br /&gt;
   public void onActivityResult(int requestCode, int resultCode, Intent data) {&lt;br /&gt;
      if(requestCode == PAYMENT_REQUEST_CODE) {&lt;br /&gt;
         progressDialog = ProgressDialog.show(this, null, getString(R.string.loading), true, false);&lt;br /&gt;
         new AsyncTask&amp;lt;String, Void, String&amp;gt;() {&lt;br /&gt;
            @Override&lt;br /&gt;
            protected String doInBackground(String... params) {&lt;br /&gt;
               try {&lt;br /&gt;
                  String urlString = URL_GETPAYMENTSTATE + &amp;quot;?PaymentId=&amp;quot; + paymentId;&lt;br /&gt;
                  URL url = new URL(urlString);&lt;br /&gt;
                  URLConnection connection = url.openConnection();&lt;br /&gt;
                  InputStream stream = connection.getInputStream();&lt;br /&gt;
                  BufferedReader reader = new BufferedReader(new InputStreamReader(stream));&lt;br /&gt;
                  StringBuilder builder = new StringBuilder();&lt;br /&gt;
&lt;br /&gt;
                  String line;&lt;br /&gt;
                  while ((line = reader.readLine()) != null) {&lt;br /&gt;
                     builder.append(line);&lt;br /&gt;
                  }&lt;br /&gt;
&lt;br /&gt;
                  return builder.toString();&lt;br /&gt;
               } catch (Exception e) {&lt;br /&gt;
                  return null;&lt;br /&gt;
               }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            @Override&lt;br /&gt;
            protected void onPostExecute(String s) {&lt;br /&gt;
               if (s == null) networkError();&lt;br /&gt;
               else {&lt;br /&gt;
                  try {&lt;br /&gt;
                     JSONObject object = new JSONObject(s);&lt;br /&gt;
                     BarionGetPaymentStateResponse response = BarionGetPaymentStateResponse.fromJsonObject(object);&lt;br /&gt;
                     if (response.getErrors().size() != 0)&lt;br /&gt;
                        processBarionErrors(response.getErrors());&lt;br /&gt;
                     else processPaymentState(response.getPaymentState());&lt;br /&gt;
                  } catch (JSONException e) {&lt;br /&gt;
                     networkError();&lt;br /&gt;
                  }&lt;br /&gt;
               }&lt;br /&gt;
            }&lt;br /&gt;
         }.execute(paymentId);&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.2.1. step - Redirect to Barion&#039;s website====&lt;br /&gt;
The integrator application must handle the case when the Barion mobile application isn&#039;t installed on the user&#039;s device. In this case, you need to load Barion&#039;s website in a WebView.&lt;br /&gt;
&lt;br /&gt;
=====3.2.1.1. step - Add new Activity to your AndroidManifest.xml file=====&lt;br /&gt;
Add this Activity to your AndroidManifest.xml file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;activity&lt;br /&gt;
      android:name=&amp;quot;.activities.WebViewActivity&amp;quot;&lt;br /&gt;
      android:label=&amp;quot;@string/app_name&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====3.2.1.2. step - Create the XML layout for the new Activity=====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;LinearLayout xmlns:android=&amp;quot;http://schemas.android.com/apk/res/android&amp;quot;&lt;br /&gt;
      android:layout_width=&amp;quot;match_parent&amp;quot;&lt;br /&gt;
      android:layout_height=&amp;quot;match_parent&amp;quot;&lt;br /&gt;
      android:orientation=&amp;quot;vertical&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;WebView&lt;br /&gt;
            android:id=&amp;quot;@+id/webView&amp;quot;&lt;br /&gt;
            android:layout_width=&amp;quot;match_parent&amp;quot;&lt;br /&gt;
            android:layout_height=&amp;quot;match_parent&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;/LinearLayout&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====3.2.1.3. step - Create Activity=====&lt;br /&gt;
Create a new Activity class. This activity will get the &#039;&#039;&#039;PaymentId&#039;&#039;&#039;  parameter through Intent and you need to call Barion&#039;s website with this parameter. After the payment is closed, Barion will redirect the user to your scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   public class WebViewActivity extends Activity {&lt;br /&gt;
&lt;br /&gt;
      @Override&lt;br /&gt;
      protected void onCreate(Bundle savedInstanceState) {&lt;br /&gt;
         super.onCreate(savedInstanceState);&lt;br /&gt;
         setContentView(R.layout.activity_web);&lt;br /&gt;
&lt;br /&gt;
         WebView webView = (WebView) findViewById(R.id.webView);&lt;br /&gt;
         webView.setWebViewClient(new WebViewClient());&lt;br /&gt;
         webView.getSettings().setJavaScriptEnabled(true);&lt;br /&gt;
         webView.getSettings().setDomStorageEnabled(true);&lt;br /&gt;
&lt;br /&gt;
         BarionStartPaymentResponse response = (BarionStartPaymentResponse) getIntent().getSerializableExtra(KEY_STARTRESPONSE);&lt;br /&gt;
         webView.loadUrl(&amp;quot;https://barion.com/Pay?id=&amp;quot; + response.getPaymentId());&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====3.2.1.4. step - Requesting the payment&#039;s result=====&lt;br /&gt;
You can get the payment id in the PaymentResultActivity like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   public class PaymentResultActivity extends Activity {&lt;br /&gt;
      @Override&lt;br /&gt;
      protected void onCreate(Bundle savedInstanceState) {&lt;br /&gt;
         super.onCreate(savedInstanceState);&lt;br /&gt;
         setContentView(R.layout.activity_result);&lt;br /&gt;
&lt;br /&gt;
         Intent intent = getIntent();&lt;br /&gt;
         String paymentId = intent.getDataString().replace(Preferences.REDIRECT_URL + &amp;quot;?paymentId=&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this payment id you can get the payment&#039;s result, you can use the example code from &#039;&#039;&#039;3.1.2 step&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====3.3. step - Processing the result====&lt;br /&gt;
You have everything in &#039;&#039;&#039;BarionGetPaymentStateResponse&#039;&#039;&#039; object about the payment.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=File:Barion_app2app_flow_updated_2.png&amp;diff=1515</id>
		<title>File:Barion app2app flow updated 2.png</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=File:Barion_app2app_flow_updated_2.png&amp;diff=1515"/>
		<updated>2019-02-07T11:00:15Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=File:Barion_flow_en.png&amp;diff=1514</id>
		<title>File:Barion flow en.png</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=File:Barion_flow_en.png&amp;diff=1514"/>
		<updated>2019-02-07T10:59:12Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_on_android_with_server_side&amp;diff=1513</id>
		<title>App2App integration on android with server side</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_on_android_with_server_side&amp;diff=1513"/>
		<updated>2019-02-07T10:57:11Z</updated>

		<summary type="html">&lt;p&gt;Macika: Created page with &amp;quot;__NOTOC__  This type of integration requires developments on your own server-side. Your server-side will communicate with the Barion System and your server-side will communica...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
This type of integration requires developments on your own server-side. Your server-side will communicate with the Barion System and your server-side will communicate with your mobile application. The mobile applications don&#039;t have to communicate with the Barion System directly and you don&#039;t have to add authentication information to your mobile application. Another adventage of this method is, that you can log the network communication on your server-side, and you can control the communication with your mobile application.&lt;br /&gt;
&lt;br /&gt;
==Downloads, examples==&lt;br /&gt;
You can download the example project from [https://github.com/barion/barion-android-java-app2app/tree/master/examples/NativeIntegration this].&lt;br /&gt;
&lt;br /&gt;
This project contains the models and error handling processes, so in this description we won&#039;t talk about it.&lt;br /&gt;
&lt;br /&gt;
==Flow chart==&lt;br /&gt;
[[Fájl:Barion_app2app_flow_updated_2.png|center|800px]]&lt;br /&gt;
&lt;br /&gt;
==Server-side developments==&lt;br /&gt;
You can see above on the flow chart, the two types of calls that must be capable on your server-side:&lt;br /&gt;
* Payment initiation in the Barion System through the [[Payment-Start-v2|Payment/Start]] API request.&lt;br /&gt;
* Get payment&#039;s state from the Barion System through the [[Payment-GetPaymentState-v2|Payment/GetPaymentState]] API request.&lt;br /&gt;
&lt;br /&gt;
You can use any languages and technology, in the case of PHP you can use our library which you can download from [https://github.com/barion Barion&#039;s GitHub page].&lt;br /&gt;
The Barion System using JSON format in the requests and responses.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===0. step - Server-side requests===&lt;br /&gt;
For the server-side requests, you can use the examples directory in our PHP library on [https://github.com/barion/barion-web-php/tree/master/examples Barion&#039;s GitHub page]]. &lt;br /&gt;
&lt;br /&gt;
In this example we assume the following:&lt;br /&gt;
* For the payment initiator request, we will send the list of products with a POST request under the Items key&lt;br /&gt;
* For the payment&#039;s status, we will use a GET request.&lt;br /&gt;
&lt;br /&gt;
Add server-side endpoints to your mobile application:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   public static final String URL_STARTPAYMENT = &amp;quot;https://your-domain.com/generate_barion_payment.php&amp;quot;;   &lt;br /&gt;
   public static final String URL_GETPAYMENTSTATE = &amp;quot;https://your-domain.com/get_barion_payment_state.php&amp;quot;;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===1. step - Edit AndroidManifest.xml file===&lt;br /&gt;
At first, you need to edit the AndroidManifest.xml file.&lt;br /&gt;
&lt;br /&gt;
====1.1. step - Providing internet access ====&lt;br /&gt;
For the communication your application needs internet access, so add the internet access permission to your AndroidManifest file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;manifest&lt;br /&gt;
      xmlns:android=&amp;quot;http://schemas.android.com/apk/res/android&amp;quot;&lt;br /&gt;
      package=&amp;quot;com.barion.example.app2app.nativeintegration&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;uses-permission android:name=&amp;quot;android.permission.INTERNET&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;!-- The rest of your AndroidManifest.xml --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;/manifest&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====1.2. step - Add redirect scheme====&lt;br /&gt;
In order to redirect from the Barion application into the integrator application, a redirect scheme is needed. You can choose anything, but it should be unique. In example this is &#039;&#039;&#039;myredirecturl&#039;&#039;&#039;. It is &#039;&#039;&#039;IMPORTANT&#039;&#039;&#039;, that this scheme must be the same as the &#039;&#039;&#039;redirectUrl&#039;&#039;&#039;  property of the [[Payment-Start-v2|Payment/Start]] request. You need to add this scheme in intent-filter into your result activity section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;activity&lt;br /&gt;
      android:name=&amp;quot;.activities.PaymentResultActivity&amp;quot;&lt;br /&gt;
      android:label=&amp;quot;@string/app_name&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;intent-filter&amp;gt;&lt;br /&gt;
         &amp;lt;action android:name=&amp;quot;android.intent.action.VIEW&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;category android:name=&amp;quot;android.intent.category.DEFAULT&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;category android:name=&amp;quot;android.intent.category.BROWSABLE&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;data android:scheme=&amp;quot;myredirecturl&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;/intent-filter&amp;gt;&lt;br /&gt;
   &amp;lt;/activity&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===2. step - Initiate payment===&lt;br /&gt;
At any point in the mobile application - where the products you want to pay are available - you should call the previously made server-side call, that will initiate payment in the Barion System.&lt;br /&gt;
&lt;br /&gt;
This is one of the many possible solutions:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   progressDialog = ProgressDialog.show(getActivity(), null, getString(R.string.preparingpayment), true, false);&lt;br /&gt;
   new AsyncTask&amp;lt;Void, Void, String&amp;gt;() {&lt;br /&gt;
      @Override&lt;br /&gt;
      protected String doInBackground(Void... params) {&lt;br /&gt;
         HttpClient httpClient = new DefaultHttpClient();&lt;br /&gt;
         HttpPost post = new HttpPost(URL_STARTPAYMENT);&lt;br /&gt;
         try {&lt;br /&gt;
            JSONArray productsArray = new JSONArray();&lt;br /&gt;
            for(int i = 0; i &amp;lt; products.size(); ++i) {&lt;br /&gt;
               Product p = products.get(i);&lt;br /&gt;
               JSONObject productJson = new JSONObject();&lt;br /&gt;
               productJson&lt;br /&gt;
                  .put(&amp;quot;Name&amp;quot;, p.getName())&lt;br /&gt;
                  .put(&amp;quot;Description&amp;quot;, p.getDescription())&lt;br /&gt;
                  .put(&amp;quot;Quantity&amp;quot;, p.getQuantity())&lt;br /&gt;
                  .put(&amp;quot;Unit&amp;quot;, p.getUnit())&lt;br /&gt;
                  .put(&amp;quot;UnitPrice&amp;quot;, p.getPrice())&lt;br /&gt;
                  .put(&amp;quot;ItemTotal&amp;quot;, p.getPrice())&lt;br /&gt;
                  .put(&amp;quot;SKU&amp;quot;, p.getSKU());&lt;br /&gt;
               productsArray.put(productJson);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            JSONObject holderJson = new JSONObject();&lt;br /&gt;
            holderJson.put(&amp;quot;Items&amp;quot;, productsArray);&lt;br /&gt;
&lt;br /&gt;
            post.setHeader(HTTP.CONTENT_TYPE, &amp;quot;application/json;charset=UTF-8&amp;quot;);&lt;br /&gt;
            post.setEntity(new StringEntity(holderJson.toString(), &amp;quot;UTF-8&amp;quot;));&lt;br /&gt;
&lt;br /&gt;
            HttpResponse response = httpClient.execute(post);&lt;br /&gt;
            InputStream stream = response.getEntity().getContent();&lt;br /&gt;
            BufferedReader reader = new BufferedReader(new InputStreamReader(stream));&lt;br /&gt;
            StringBuilder builder = new StringBuilder();&lt;br /&gt;
&lt;br /&gt;
            String line;&lt;br /&gt;
            while((line = reader.readLine()) != null) {&lt;br /&gt;
               builder.append(line);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            return builder.toString();&lt;br /&gt;
         } catch (Exception x) {&lt;br /&gt;
            return null;&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      @Override&lt;br /&gt;
      protected void onPostExecute(String s) {&lt;br /&gt;
         if(s == null) networkError();&lt;br /&gt;
         try {&lt;br /&gt;
            JSONObject resultObject = new JSONObject(s);&lt;br /&gt;
            BarionStartPaymentResponse response = BarionStartPaymentResponse.fromJsonObject(resultObject);&lt;br /&gt;
            if(response.getErrors().size() != 0) processBarionErrors(response.getErrors());&lt;br /&gt;
            else navigateUserToBarion(response);&lt;br /&gt;
         } catch (JSONException e) {&lt;br /&gt;
            networkError();&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }.execute();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===3. step - Redirect and get the result===&lt;br /&gt;
If the payment initiation was successful you need to redirect the user to the Barion mobile application or to Barion&#039;s website.&lt;br /&gt;
&lt;br /&gt;
In order for the user to be redirected to the Barion mobile application the following requirements must be met:&lt;br /&gt;
* The device must have Barion mobile application installed.&lt;br /&gt;
* The installed Barion mobile application version must be above of 3.1.0.&lt;br /&gt;
&lt;br /&gt;
If these conditions are not met you need to redirect the user to Barion&#039;s website. You can use these helper methods to check the requirements:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   public static boolean canPayWithBarionApp(Context context) {&lt;br /&gt;
      PackageManager packageManager = context.getPackageManager();&lt;br /&gt;
      try {&lt;br /&gt;
         PackageInfo barionInfo = packageManager.getPackageInfo(&amp;quot;barion.app&amp;quot;, PackageManager.GET_META_DATA);&lt;br /&gt;
         String barionVersion = barionInfo.versionName;&lt;br /&gt;
         String requiredVersion = &amp;quot;3.1.0&amp;quot;;&lt;br /&gt;
         return isVersionAReachedB(barionVersion, requiredVersion);&lt;br /&gt;
      } catch (PackageManager.NameNotFoundException e) {&lt;br /&gt;
         return false;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   private static boolean isVersionAReachedB(String versionA, String versionB){&lt;br /&gt;
      int a = Integer.valueOf(versionA.replaceAll(&amp;quot;[^0-9]&amp;quot;, &amp;quot;&amp;quot;));&lt;br /&gt;
      int b = Integer.valueOf(versionB.replaceAll(&amp;quot;[^0-9]&amp;quot;, &amp;quot;&amp;quot;));&lt;br /&gt;
      return a &amp;gt;= b;&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.1.1. step - Redirect to the Barion mobile application====&lt;br /&gt;
After you successfully initiated the payment, you got a &#039;&#039;&#039;PaymentId&#039;&#039;&#039; parameter. Start the Bairon mobile application with that &#039;&#039;&#039;PaymentId&#039;&#039;&#039; by the following:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   private int PAYMENT_REQUEST_CODE = 42;&lt;br /&gt;
   &lt;br /&gt;
   private void navigateUserToBarion(final BarionStartPaymentResponse response) {&lt;br /&gt;
      Intent intent = new Intent(Intent.ACTION_VIEW);&lt;br /&gt;
      paymentId = response.getPaymentId();&lt;br /&gt;
      intent.setData(Uri.parse(&amp;quot;barion:?pid=&amp;quot; + paymentId + &amp;quot;&amp;amp;action=returntoapp&amp;quot;));&lt;br /&gt;
      startActivityForResult(intent, PAYMENT_REQUEST_CODE);&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.1.2. step - Get payment&#039;s status====&lt;br /&gt;
In the Barion mobile application the user can pay or reject the payment, and after this the application closes itself. Then the user will be redirected to the integrator mobile application and you need to request the payment&#039;s status from your server:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   @Override&lt;br /&gt;
   public void onActivityResult(int requestCode, int resultCode, Intent data) {&lt;br /&gt;
      if(requestCode == PAYMENT_REQUEST_CODE) {&lt;br /&gt;
         progressDialog = ProgressDialog.show(this, null, getString(R.string.loading), true, false);&lt;br /&gt;
         new AsyncTask&amp;lt;String, Void, String&amp;gt;() {&lt;br /&gt;
            @Override&lt;br /&gt;
            protected String doInBackground(String... params) {&lt;br /&gt;
               try {&lt;br /&gt;
                  String urlString = URL_GETPAYMENTSTATE + &amp;quot;?PaymentId=&amp;quot; + paymentId;&lt;br /&gt;
                  URL url = new URL(urlString);&lt;br /&gt;
                  URLConnection connection = url.openConnection();&lt;br /&gt;
                  InputStream stream = connection.getInputStream();&lt;br /&gt;
                  BufferedReader reader = new BufferedReader(new InputStreamReader(stream));&lt;br /&gt;
                  StringBuilder builder = new StringBuilder();&lt;br /&gt;
&lt;br /&gt;
                  String line;&lt;br /&gt;
                  while ((line = reader.readLine()) != null) {&lt;br /&gt;
                     builder.append(line);&lt;br /&gt;
                  }&lt;br /&gt;
&lt;br /&gt;
                  return builder.toString();&lt;br /&gt;
               } catch (Exception e) {&lt;br /&gt;
                  return null;&lt;br /&gt;
               }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            @Override&lt;br /&gt;
            protected void onPostExecute(String s) {&lt;br /&gt;
               if (s == null) networkError();&lt;br /&gt;
               else {&lt;br /&gt;
                  try {&lt;br /&gt;
                     JSONObject object = new JSONObject(s);&lt;br /&gt;
                     BarionGetPaymentStateResponse response = BarionGetPaymentStateResponse.fromJsonObject(object);&lt;br /&gt;
                     if (response.getErrors().size() != 0)&lt;br /&gt;
                        processBarionErrors(response.getErrors());&lt;br /&gt;
                     else processPaymentState(response.getPaymentState());&lt;br /&gt;
                  } catch (JSONException e) {&lt;br /&gt;
                     networkError();&lt;br /&gt;
                  }&lt;br /&gt;
               }&lt;br /&gt;
            }&lt;br /&gt;
         }.execute(paymentId);&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.2.1. step - Redirect to Barion&#039;s website====&lt;br /&gt;
The integrator application must handle the case when the Barion mobile application isn&#039;t installed on the user&#039;s device. In this case, you need to load Barion&#039;s website in a WebView.&lt;br /&gt;
&lt;br /&gt;
=====3.2.1.1. step - Add new Activity to your AndroidManifest.xml file=====&lt;br /&gt;
Add this Activity to your AndroidManifest.xml file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;activity&lt;br /&gt;
      android:name=&amp;quot;.activities.WebViewActivity&amp;quot;&lt;br /&gt;
      android:label=&amp;quot;@string/app_name&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====3.2.1.2. step - Create the XML layout for the new Activity=====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;LinearLayout xmlns:android=&amp;quot;http://schemas.android.com/apk/res/android&amp;quot;&lt;br /&gt;
      android:layout_width=&amp;quot;match_parent&amp;quot;&lt;br /&gt;
      android:layout_height=&amp;quot;match_parent&amp;quot;&lt;br /&gt;
      android:orientation=&amp;quot;vertical&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;WebView&lt;br /&gt;
            android:id=&amp;quot;@+id/webView&amp;quot;&lt;br /&gt;
            android:layout_width=&amp;quot;match_parent&amp;quot;&lt;br /&gt;
            android:layout_height=&amp;quot;match_parent&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;/LinearLayout&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====3.2.1.3. step - Create Activity=====&lt;br /&gt;
Create a new Activity class. This activity will get the &#039;&#039;&#039;PaymentId&#039;&#039;&#039;  parameter through Intent and you need to call Barion&#039;s website with this parameter. After the payment is closed, Barion will redirect the user to your scheme.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   public class WebViewActivity extends Activity {&lt;br /&gt;
&lt;br /&gt;
      @Override&lt;br /&gt;
      protected void onCreate(Bundle savedInstanceState) {&lt;br /&gt;
         super.onCreate(savedInstanceState);&lt;br /&gt;
         setContentView(R.layout.activity_web);&lt;br /&gt;
&lt;br /&gt;
         WebView webView = (WebView) findViewById(R.id.webView);&lt;br /&gt;
         webView.setWebViewClient(new WebViewClient());&lt;br /&gt;
         webView.getSettings().setJavaScriptEnabled(true);&lt;br /&gt;
         webView.getSettings().setDomStorageEnabled(true);&lt;br /&gt;
&lt;br /&gt;
         BarionStartPaymentResponse response = (BarionStartPaymentResponse) getIntent().getSerializableExtra(KEY_STARTRESPONSE);&lt;br /&gt;
         webView.loadUrl(&amp;quot;https://barion.com/Pay?id=&amp;quot; + response.getPaymentId());&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====3.2.1.4. step - Requesting the payment&#039;s result=====&lt;br /&gt;
You can get the payment id in the PaymentResultActivity like this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   public class PaymentResultActivity extends Activity {&lt;br /&gt;
      @Override&lt;br /&gt;
      protected void onCreate(Bundle savedInstanceState) {&lt;br /&gt;
         super.onCreate(savedInstanceState);&lt;br /&gt;
         setContentView(R.layout.activity_result);&lt;br /&gt;
&lt;br /&gt;
         Intent intent = getIntent();&lt;br /&gt;
         String paymentId = intent.getDataString().replace(Preferences.REDIRECT_URL + &amp;quot;?paymentId=&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With this payment id you can get the payment&#039;s result, you can use the example code from &#039;&#039;&#039;3.1.2 step&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====3.3. step - Processing the result====&lt;br /&gt;
You have everything in &#039;&#039;&#039;BarionGetPaymentStateResponse&#039;&#039;&#039; object about the payment.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_with_android_library&amp;diff=1512</id>
		<title>App2App integration with android library</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_with_android_library&amp;diff=1512"/>
		<updated>2019-02-07T10:31:53Z</updated>

		<summary type="html">&lt;p&gt;Macika: /* 3.2. step - Add redirect scheme */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
In this case of integration, you don&#039;t need to edit your server-side. In your mobile application, you don&#039;t have to implement network communication. We have already do it for you. If you use the Barion Android library you have to add a few lines of code to your existing codebase. The disadvantages are, that you have to notify your own server-side about the payments and your mobile app will contain the POSKey of the shop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;It is highly recommended to obfuscate client applications! We recommend using [http://developer.android.com/tools/help/proguard.html ProGuard] or [https://www.guardsquare.com/dexguard DexGuard].&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Downloads, example==&lt;br /&gt;
You can download the Barion Android Library from [https://github.com/barion/barion-android-java-app2app/tree/master/library Barion&#039;s Github page].&lt;br /&gt;
&lt;br /&gt;
The example project can be downloadable from [https://github.com/barion/barion-android-java-app2app/tree/master/examples/LibraryIntegration Barion&#039;s Github page].&lt;br /&gt;
&lt;br /&gt;
The library contains the necessary models, so you don&#039;t need to implement them.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===1. step - Add the library to your project===&lt;br /&gt;
Download the .aar file from [https://github.com/barion/barion-android-java-app2app/tree/master/library Barion&#039;s Github page] and put it into your &#039;&#039;&#039;libs&#039;&#039;&#039; directory!&lt;br /&gt;
  &lt;br /&gt;
===2. step - Edit build.gradle file===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   repositories {&lt;br /&gt;
      flatDir {&lt;br /&gt;
         dirs &#039;libs&#039;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   dependencies {&lt;br /&gt;
      compile(name:&#039;barionlibrary-1.0.2&#039;, ext:&#039;aar&#039;)&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===3. step - Edit the AndroidManifest.xml file===&lt;br /&gt;
At first, you need to edit the AndroidManifest.xml file.&lt;br /&gt;
&lt;br /&gt;
====3.1. step - Providing internet access ====&lt;br /&gt;
For the communication, your application must have internet access. So add the internet access permission to your AndroidManifest file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;manifest&lt;br /&gt;
      xmlns:android=&amp;quot;http://schemas.android.com/apk/res/android&amp;quot;&lt;br /&gt;
      package=&amp;quot;com.barion.example.app2app.libraryintegration&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;uses-permission android:name=&amp;quot;android.permission.INTERNET&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;!-- The rest of your AndroidManifest.xml --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;/manifest&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.2. step - Add redirect scheme====&lt;br /&gt;
In order to redirect from the Barion application into the integrator application, a redirect scheme is needed. You can choose anything, but it should be unique. In our example, this is &#039;&#039;&#039;myredirecturl&#039;&#039;&#039;. It is &#039;&#039;&#039;IMPORTANT&#039;&#039;&#039;, that this scheme must be the same as the &#039;&#039;&#039;redirectUrl&#039;&#039;&#039;  property of the [[Payment-Start-v2|Payment/Start]] request. You need to add this scheme in intent-filter into your result activity section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;activity&lt;br /&gt;
      android:name=&amp;quot;.activities.PaymentResultActivity&amp;quot;&lt;br /&gt;
      android:label=&amp;quot;@string/app_name&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;intent-filter&amp;gt;&lt;br /&gt;
         &amp;lt;action android:name=&amp;quot;android.intent.action.VIEW&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;category android:name=&amp;quot;android.intent.category.DEFAULT&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;category android:name=&amp;quot;android.intent.category.BROWSABLE&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;data android:scheme=&amp;quot;myredirecturl&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;/intent-filter&amp;gt;&lt;br /&gt;
   &amp;lt;/activity&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.3. step - Add BarionActivity to your AndroidManifest.xml file====&lt;br /&gt;
Add the BarionActivity class from our library to your AndroidManifest.xml file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;activity android:name=&amp;quot;barion.com.barionlibrary.activities.BarionActivity&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4. step - Initiate payment with the library===&lt;br /&gt;
At any point in the mobile application - where the products that you want to pay are available - you should initiate the payment in the Barion System. The Barion Android Library will check the parameters and if anything is wrong, it will return with an error. The possible error codes can be found on [[Barion_Mobil_Library_Hibakódok|this page]].&lt;br /&gt;
&lt;br /&gt;
To initiate the payment you need to implement a few lines of code:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   ArrayList&amp;lt;BarionProduct&amp;gt; products;&lt;br /&gt;
   Intent intent = new Intent(getActivity(), BarionActivity.class);&lt;br /&gt;
&lt;br /&gt;
   intent.putExtra(Barion.PRODUCTS, products);&lt;br /&gt;
   intent.putExtra(Barion.PAYMENT_SETTINGS, new PaymentSettingsModel.Builder()&lt;br /&gt;
      // the POSKey of the shop&lt;br /&gt;
      .posKey(&amp;quot;f199e514-9199-40f9-a210-55a0c75be8cc&amp;quot;)&lt;br /&gt;
      // immediate payment&lt;br /&gt;
      .paymentType(PaymentSettingsModel.PaymentTypeEnum.Immediate)&lt;br /&gt;
      .guestCheckOut(true)&lt;br /&gt;
      // if the debugMode is true the library will communicate with our sandbox environment.&lt;br /&gt;
      .debugMode(true)&lt;br /&gt;
      .locale(&amp;quot;hu-HU&amp;quot;)&lt;br /&gt;
      .fundingSources(PaymentSettingsModel.FundingSourceTypeEnum.All)&lt;br /&gt;
      // this scheme must be the same as in your AndroidManifest.xml file&lt;br /&gt;
      .redirectUrl(&amp;quot;myredirecturl://&amp;quot;)&lt;br /&gt;
      .build());&lt;br /&gt;
&lt;br /&gt;
   intent.putExtra(Barion.TRANSACTION_SETTINGS, new TransactionModel.Builder()&lt;br /&gt;
      .posTransactionId(&amp;quot;f192e544-9199-46f9-a240-55a0c75be8cc&amp;quot;)&lt;br /&gt;
      .payee(&amp;quot;demouser@your-domain.com&amp;quot;)&lt;br /&gt;
      .total(200)&lt;br /&gt;
      .comment(&amp;quot;The new App2App Library&amp;quot;)&lt;br /&gt;
      .build());&lt;br /&gt;
&lt;br /&gt;
   startActivityForResult(intent, Barion.REQUEST_CODE);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The product list contain the products that [[Item]] type objects.&lt;br /&gt;
* The PaymentSettingsModel object contains the settings, you can read about it on the [[Payment-Start-v2|Payment/Start]] page. &lt;br /&gt;
* The TransactionModel object contains the settings of the transactions, you can read about it on the [[PaymentTransaction|PaymentTransaction]] page.&lt;br /&gt;
* If the debugMode is true the library will communicate with our sandbox environment.&lt;br /&gt;
* If the user didn&#039;t installed the Barion app on their device, the library will show the webview to the user.&lt;br /&gt;
&lt;br /&gt;
===5. step - Get results===&lt;br /&gt;
The library will return with the results in the onActivityResult method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   @Override&lt;br /&gt;
   public void onActivityResult(int requestCode, int resultCode, Intent data) {&lt;br /&gt;
      if (requestCode == Barion.REQUEST_CODE) {&lt;br /&gt;
         if (resultCode == Activity.RESULT_OK) {&lt;br /&gt;
            BarionGetPaymentStateResponse response = (BarionGetPaymentStateResponse) data.getSerializableExtra(Barion.BARION_PAYMENT_STATE_RESPONSE);&lt;br /&gt;
            if (response != null &amp;amp;&amp;amp; getActivity() != null) {&lt;br /&gt;
               Intent intent = new Intent(getActivity(), PaymentResultActivity.class);&lt;br /&gt;
               intent.putExtra(&amp;quot;PaymentState&amp;quot;, response);&lt;br /&gt;
               startActivity(intent);&lt;br /&gt;
               finish();&lt;br /&gt;
            }&lt;br /&gt;
         } else if (resultCode == Activity.RESULT_CANCELED) {&lt;br /&gt;
            ArrayList&amp;lt;BarionError&amp;gt; errors = (ArrayList&amp;lt;BarionError&amp;gt;) data.getSerializableExtra(Barion.ERROR);&lt;br /&gt;
            processBarionErrors(errors);&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything went fine you can get every [[Payment-GetPaymentState-v2|information]] about the payment from the response variable. If there was an error you will get it in the errors list.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_with_android_library&amp;diff=1511</id>
		<title>App2App integration with android library</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_with_android_library&amp;diff=1511"/>
		<updated>2019-02-07T09:54:23Z</updated>

		<summary type="html">&lt;p&gt;Macika: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
In this case of integration, you don&#039;t need to edit your server-side. In your mobile application, you don&#039;t have to implement network communication. We have already do it for you. If you use the Barion Android library you have to add a few lines of code to your existing codebase. The disadvantages are, that you have to notify your own server-side about the payments and your mobile app will contain the POSKey of the shop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;It is highly recommended to obfuscate client applications! We recommend using [http://developer.android.com/tools/help/proguard.html ProGuard] or [https://www.guardsquare.com/dexguard DexGuard].&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Downloads, example==&lt;br /&gt;
You can download the Barion Android Library from [https://github.com/barion/barion-android-java-app2app/tree/master/library Barion&#039;s Github page].&lt;br /&gt;
&lt;br /&gt;
The example project can be downloadable from [https://github.com/barion/barion-android-java-app2app/tree/master/examples/LibraryIntegration Barion&#039;s Github page].&lt;br /&gt;
&lt;br /&gt;
The library contains the necessary models, so you don&#039;t need to implement them.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===1. step - Add the library to your project===&lt;br /&gt;
Download the .aar file from [https://github.com/barion/barion-android-java-app2app/tree/master/library Barion&#039;s Github page] and put it into your &#039;&#039;&#039;libs&#039;&#039;&#039; directory!&lt;br /&gt;
  &lt;br /&gt;
===2. step - Edit build.gradle file===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   repositories {&lt;br /&gt;
      flatDir {&lt;br /&gt;
         dirs &#039;libs&#039;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   dependencies {&lt;br /&gt;
      compile(name:&#039;barionlibrary-1.0.2&#039;, ext:&#039;aar&#039;)&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===3. step - Edit the AndroidManifest.xml file===&lt;br /&gt;
At first, you need to edit the AndroidManifest.xml file.&lt;br /&gt;
&lt;br /&gt;
====3.1. step - Providing internet access ====&lt;br /&gt;
For the communication, your application must have internet access. So add the internet access permission to your AndroidManifest file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;manifest&lt;br /&gt;
      xmlns:android=&amp;quot;http://schemas.android.com/apk/res/android&amp;quot;&lt;br /&gt;
      package=&amp;quot;com.barion.example.app2app.libraryintegration&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;uses-permission android:name=&amp;quot;android.permission.INTERNET&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;!-- The rest of your AndroidManifest.xml --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;/manifest&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.2. step - Add redirect scheme====&lt;br /&gt;
In order to redirect from the Barion application into the integrator application, a redirect scheme is needed. You can choose anything, but it should be unique. In our example, this will be &#039;&#039;&#039;myredirecturl&#039;&#039;&#039;. It is &#039;&#039;&#039;IMPORTANT&#039;&#039;&#039;, that this scheme must be the same as the &#039;&#039;&#039;redirectUrl&#039;&#039;&#039;  property of the [[Payment-Start-v2|Payment/Start]] request. You need to add this scheme in intent-filter of your result activity section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;activity&lt;br /&gt;
      android:name=&amp;quot;.activities.PaymentResultActivity&amp;quot;&lt;br /&gt;
      android:label=&amp;quot;@string/app_name&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;intent-filter&amp;gt;&lt;br /&gt;
         &amp;lt;action android:name=&amp;quot;android.intent.action.VIEW&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;category android:name=&amp;quot;android.intent.category.DEFAULT&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;category android:name=&amp;quot;android.intent.category.BROWSABLE&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;data android:scheme=&amp;quot;myredirecturl&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;/intent-filter&amp;gt;&lt;br /&gt;
   &amp;lt;/activity&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.3. step - Add BarionActivity to your AndroidManifest.xml file====&lt;br /&gt;
Add the BarionActivity class from our library to your AndroidManifest.xml file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;activity android:name=&amp;quot;barion.com.barionlibrary.activities.BarionActivity&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4. step - Initiate payment with the library===&lt;br /&gt;
At any point in the mobile application - where the products that you want to pay are available - you should initiate the payment in the Barion System. The Barion Android Library will check the parameters and if anything is wrong, it will return with an error. The possible error codes can be found on [[Barion_Mobil_Library_Hibakódok|this page]].&lt;br /&gt;
&lt;br /&gt;
To initiate the payment you need to implement a few lines of code:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   ArrayList&amp;lt;BarionProduct&amp;gt; products;&lt;br /&gt;
   Intent intent = new Intent(getActivity(), BarionActivity.class);&lt;br /&gt;
&lt;br /&gt;
   intent.putExtra(Barion.PRODUCTS, products);&lt;br /&gt;
   intent.putExtra(Barion.PAYMENT_SETTINGS, new PaymentSettingsModel.Builder()&lt;br /&gt;
      // the POSKey of the shop&lt;br /&gt;
      .posKey(&amp;quot;f199e514-9199-40f9-a210-55a0c75be8cc&amp;quot;)&lt;br /&gt;
      // immediate payment&lt;br /&gt;
      .paymentType(PaymentSettingsModel.PaymentTypeEnum.Immediate)&lt;br /&gt;
      .guestCheckOut(true)&lt;br /&gt;
      // if the debugMode is true the library will communicate with our sandbox environment.&lt;br /&gt;
      .debugMode(true)&lt;br /&gt;
      .locale(&amp;quot;hu-HU&amp;quot;)&lt;br /&gt;
      .fundingSources(PaymentSettingsModel.FundingSourceTypeEnum.All)&lt;br /&gt;
      // this scheme must be the same as in your AndroidManifest.xml file&lt;br /&gt;
      .redirectUrl(&amp;quot;myredirecturl://&amp;quot;)&lt;br /&gt;
      .build());&lt;br /&gt;
&lt;br /&gt;
   intent.putExtra(Barion.TRANSACTION_SETTINGS, new TransactionModel.Builder()&lt;br /&gt;
      .posTransactionId(&amp;quot;f192e544-9199-46f9-a240-55a0c75be8cc&amp;quot;)&lt;br /&gt;
      .payee(&amp;quot;demouser@your-domain.com&amp;quot;)&lt;br /&gt;
      .total(200)&lt;br /&gt;
      .comment(&amp;quot;The new App2App Library&amp;quot;)&lt;br /&gt;
      .build());&lt;br /&gt;
&lt;br /&gt;
   startActivityForResult(intent, Barion.REQUEST_CODE);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The product list contain the products that [[Item]] type objects.&lt;br /&gt;
* The PaymentSettingsModel object contains the settings, you can read about it on the [[Payment-Start-v2|Payment/Start]] page. &lt;br /&gt;
* The TransactionModel object contains the settings of the transactions, you can read about it on the [[PaymentTransaction|PaymentTransaction]] page.&lt;br /&gt;
* If the debugMode is true the library will communicate with our sandbox environment.&lt;br /&gt;
* If the user didn&#039;t installed the Barion app on their device, the library will show the webview to the user.&lt;br /&gt;
&lt;br /&gt;
===5. step - Get results===&lt;br /&gt;
The library will return with the results in the onActivityResult method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   @Override&lt;br /&gt;
   public void onActivityResult(int requestCode, int resultCode, Intent data) {&lt;br /&gt;
      if (requestCode == Barion.REQUEST_CODE) {&lt;br /&gt;
         if (resultCode == Activity.RESULT_OK) {&lt;br /&gt;
            BarionGetPaymentStateResponse response = (BarionGetPaymentStateResponse) data.getSerializableExtra(Barion.BARION_PAYMENT_STATE_RESPONSE);&lt;br /&gt;
            if (response != null &amp;amp;&amp;amp; getActivity() != null) {&lt;br /&gt;
               Intent intent = new Intent(getActivity(), PaymentResultActivity.class);&lt;br /&gt;
               intent.putExtra(&amp;quot;PaymentState&amp;quot;, response);&lt;br /&gt;
               startActivity(intent);&lt;br /&gt;
               finish();&lt;br /&gt;
            }&lt;br /&gt;
         } else if (resultCode == Activity.RESULT_CANCELED) {&lt;br /&gt;
            ArrayList&amp;lt;BarionError&amp;gt; errors = (ArrayList&amp;lt;BarionError&amp;gt;) data.getSerializableExtra(Barion.ERROR);&lt;br /&gt;
            processBarionErrors(errors);&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything went fine you can get every [[Payment-GetPaymentState-v2|information]] about the payment from the response variable. If there was an error you will get it in the errors list.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
	<entry>
		<id>https://docs.barion.com/index.php?title=App2App_integration_with_android_library&amp;diff=1510</id>
		<title>App2App integration with android library</title>
		<link rel="alternate" type="text/html" href="https://docs.barion.com/index.php?title=App2App_integration_with_android_library&amp;diff=1510"/>
		<updated>2019-02-07T09:54:00Z</updated>

		<summary type="html">&lt;p&gt;Macika: Created page with &amp;quot;__NOTOC__ In this case of integration, you don&amp;#039;t need to edit your server-side. In your mobile application, you don&amp;#039;t have to implement network communication. We have already...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
In this case of integration, you don&#039;t need to edit your server-side. In your mobile application, you don&#039;t have to implement network communication. We have already do it for you. If you use the Barion Android library you have to add a few lines of code to your existing codebase. The disadvantages are, that you have to notify your own server-side about the payments and your mobile app will contain the POSKey of the shop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color: red&amp;quot;&amp;gt;it is highly recommended to obfuscate client applications! We recommend using [http://developer.android.com/tools/help/proguard.html ProGuard] or [https://www.guardsquare.com/dexguard DexGuard].&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Downloads, example==&lt;br /&gt;
You can download the Barion Android Library from [https://github.com/barion/barion-android-java-app2app/tree/master/library Barion&#039;s Github page].&lt;br /&gt;
&lt;br /&gt;
The example project can be downloadable from [https://github.com/barion/barion-android-java-app2app/tree/master/examples/LibraryIntegration Barion&#039;s Github page].&lt;br /&gt;
&lt;br /&gt;
The library contains the necessary models, so you don&#039;t need to implement them.&lt;br /&gt;
&lt;br /&gt;
==Integration steps==&lt;br /&gt;
===1. step - Add the library to your project===&lt;br /&gt;
Download the .aar file from [https://github.com/barion/barion-android-java-app2app/tree/master/library Barion&#039;s Github page] and put it into your &#039;&#039;&#039;libs&#039;&#039;&#039; directory!&lt;br /&gt;
  &lt;br /&gt;
===2. step - Edit build.gradle file===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
   repositories {&lt;br /&gt;
      flatDir {&lt;br /&gt;
         dirs &#039;libs&#039;&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   dependencies {&lt;br /&gt;
      compile(name:&#039;barionlibrary-1.0.2&#039;, ext:&#039;aar&#039;)&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===3. step - Edit the AndroidManifest.xml file===&lt;br /&gt;
At first, you need to edit the AndroidManifest.xml file.&lt;br /&gt;
&lt;br /&gt;
====3.1. step - Providing internet access ====&lt;br /&gt;
For the communication, your application must have internet access. So add the internet access permission to your AndroidManifest file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
   &amp;lt;manifest&lt;br /&gt;
      xmlns:android=&amp;quot;http://schemas.android.com/apk/res/android&amp;quot;&lt;br /&gt;
      package=&amp;quot;com.barion.example.app2app.libraryintegration&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;uses-permission android:name=&amp;quot;android.permission.INTERNET&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;!-- The rest of your AndroidManifest.xml --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
   &amp;lt;/manifest&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.2. step - Add redirect scheme====&lt;br /&gt;
In order to redirect from the Barion application into the integrator application, a redirect scheme is needed. You can choose anything, but it should be unique. In our example, this will be &#039;&#039;&#039;myredirecturl&#039;&#039;&#039;. It is &#039;&#039;&#039;IMPORTANT&#039;&#039;&#039;, that this scheme must be the same as the &#039;&#039;&#039;redirectUrl&#039;&#039;&#039;  property of the [[Payment-Start-v2|Payment/Start]] request. You need to add this scheme in intent-filter of your result activity section.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;activity&lt;br /&gt;
      android:name=&amp;quot;.activities.PaymentResultActivity&amp;quot;&lt;br /&gt;
      android:label=&amp;quot;@string/app_name&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;intent-filter&amp;gt;&lt;br /&gt;
         &amp;lt;action android:name=&amp;quot;android.intent.action.VIEW&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;category android:name=&amp;quot;android.intent.category.DEFAULT&amp;quot; /&amp;gt;&lt;br /&gt;
         &amp;lt;category android:name=&amp;quot;android.intent.category.BROWSABLE&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
         &amp;lt;data android:scheme=&amp;quot;myredirecturl&amp;quot; /&amp;gt;&lt;br /&gt;
      &amp;lt;/intent-filter&amp;gt;&lt;br /&gt;
   &amp;lt;/activity&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====3.3. step - Add BarionActivity to your AndroidManifest.xml file====&lt;br /&gt;
Add the BarionActivity class from our library to your AndroidManifest.xml file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;activity android:name=&amp;quot;barion.com.barionlibrary.activities.BarionActivity&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4. step - Initiate payment with the library===&lt;br /&gt;
At any point in the mobile application - where the products that you want to pay are available - you should initiate the payment in the Barion System. The Barion Android Library will check the parameters and if anything is wrong, it will return with an error. The possible error codes can be found on [[Barion_Mobil_Library_Hibakódok|this page]].&lt;br /&gt;
&lt;br /&gt;
To initiate the payment you need to implement a few lines of code:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   ArrayList&amp;lt;BarionProduct&amp;gt; products;&lt;br /&gt;
   Intent intent = new Intent(getActivity(), BarionActivity.class);&lt;br /&gt;
&lt;br /&gt;
   intent.putExtra(Barion.PRODUCTS, products);&lt;br /&gt;
   intent.putExtra(Barion.PAYMENT_SETTINGS, new PaymentSettingsModel.Builder()&lt;br /&gt;
      // the POSKey of the shop&lt;br /&gt;
      .posKey(&amp;quot;f199e514-9199-40f9-a210-55a0c75be8cc&amp;quot;)&lt;br /&gt;
      // immediate payment&lt;br /&gt;
      .paymentType(PaymentSettingsModel.PaymentTypeEnum.Immediate)&lt;br /&gt;
      .guestCheckOut(true)&lt;br /&gt;
      // if the debugMode is true the library will communicate with our sandbox environment.&lt;br /&gt;
      .debugMode(true)&lt;br /&gt;
      .locale(&amp;quot;hu-HU&amp;quot;)&lt;br /&gt;
      .fundingSources(PaymentSettingsModel.FundingSourceTypeEnum.All)&lt;br /&gt;
      // this scheme must be the same as in your AndroidManifest.xml file&lt;br /&gt;
      .redirectUrl(&amp;quot;myredirecturl://&amp;quot;)&lt;br /&gt;
      .build());&lt;br /&gt;
&lt;br /&gt;
   intent.putExtra(Barion.TRANSACTION_SETTINGS, new TransactionModel.Builder()&lt;br /&gt;
      .posTransactionId(&amp;quot;f192e544-9199-46f9-a240-55a0c75be8cc&amp;quot;)&lt;br /&gt;
      .payee(&amp;quot;demouser@your-domain.com&amp;quot;)&lt;br /&gt;
      .total(200)&lt;br /&gt;
      .comment(&amp;quot;The new App2App Library&amp;quot;)&lt;br /&gt;
      .build());&lt;br /&gt;
&lt;br /&gt;
   startActivityForResult(intent, Barion.REQUEST_CODE);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The product list contain the products that [[Item]] type objects.&lt;br /&gt;
* The PaymentSettingsModel object contains the settings, you can read about it on the [[Payment-Start-v2|Payment/Start]] page. &lt;br /&gt;
* The TransactionModel object contains the settings of the transactions, you can read about it on the [[PaymentTransaction|PaymentTransaction]] page.&lt;br /&gt;
* If the debugMode is true the library will communicate with our sandbox environment.&lt;br /&gt;
* If the user didn&#039;t installed the Barion app on their device, the library will show the webview to the user.&lt;br /&gt;
&lt;br /&gt;
===5. step - Get results===&lt;br /&gt;
The library will return with the results in the onActivityResult method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
   @Override&lt;br /&gt;
   public void onActivityResult(int requestCode, int resultCode, Intent data) {&lt;br /&gt;
      if (requestCode == Barion.REQUEST_CODE) {&lt;br /&gt;
         if (resultCode == Activity.RESULT_OK) {&lt;br /&gt;
            BarionGetPaymentStateResponse response = (BarionGetPaymentStateResponse) data.getSerializableExtra(Barion.BARION_PAYMENT_STATE_RESPONSE);&lt;br /&gt;
            if (response != null &amp;amp;&amp;amp; getActivity() != null) {&lt;br /&gt;
               Intent intent = new Intent(getActivity(), PaymentResultActivity.class);&lt;br /&gt;
               intent.putExtra(&amp;quot;PaymentState&amp;quot;, response);&lt;br /&gt;
               startActivity(intent);&lt;br /&gt;
               finish();&lt;br /&gt;
            }&lt;br /&gt;
         } else if (resultCode == Activity.RESULT_CANCELED) {&lt;br /&gt;
            ArrayList&amp;lt;BarionError&amp;gt; errors = (ArrayList&amp;lt;BarionError&amp;gt;) data.getSerializableExtra(Barion.ERROR);&lt;br /&gt;
            processBarionErrors(errors);&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything went fine you can get every [[Payment-GetPaymentState-v2|information]] about the payment from the response variable. If there was an error you will get it in the errors list.&lt;/div&gt;</summary>
		<author><name>Macika</name></author>
	</entry>
</feed>