> For the complete documentation index, see [llms.txt](https://ftcoders.first-tech.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ftcoders.first-tech.com/first-tech-ttp-sdk-pt/area-do-desenvolvedor/iniciando-um-pagamento.md).

# Iniciando um Pagamento

Todas as operações de manipulação do SDK são realizadas através do ViewModel, que recebe TapOnPhoneApplication como um parâmetro durante sua criação.

```
private val mppProviderViewModel by lazy { MPPPProviderViewModel(application as Application) }
```

<figure><img src="/files/jmyv8tbRXglQV4FCq3CC" alt=""><figcaption></figcaption></figure>

### Iniciando um pagamento

Execute a função startPaymentFlow(), fornecida pelo MPPProviderViewModel. Para isso, você precisa passar a classe TransactionInfoEntity como um parâmetro, que recebe os seguintes valores em seu construtor:

* `installments`: Um número inteiro contendo o número de parcelas
* `paymentType`: Uma das opções do ENUM PaymentType, que pode ser PaymentType.DEBIT ou PaymentType.CREDIT.
* `amount`: O valor total da transação, expresso como um Long.

| Value R$ | Long |
| -------- | ---- |
| R$ 23,34 | 2334 |
| R$ 15,00 | 1500 |
| R$ 0,15  | 15   |
| R$ 0,01  | 1    |

```
import com.firsttech.taponphone.sdk.v2.models.TransactionInfoEntity
```

```
   private fun startPayment() {
        mppProviderViewModel.startPaymentFlow(
            TransactionInfoEntity(
                paymentType.DEBIT, //PaymentType.DEBIT ou PaymentType.CREDIT
                100, //Por exemplo, este 100 significa R$ 1,00, 
                1 //Número de prestações, neste caso, uma prestação.
            )
        )
}
```

Após esta etapa, basta reagir aos eventos publicados em onMessage e capturar as informações das entidades desses eventos.\ <br>

{% hint style="info" %} <mark style="color:$warning;">Obs: Para transações de valores alto , normalmente valores acima de R$ 200,00 será renderizado uma tela para digitar o pin(Senha) do cartão.</mark>&#x20;

<mark style="color:$warning;">A tela é apresentada e gerenciada pelo SDK a partir do ambiente seguro.</mark>
{% endhint %}

\
\
![](/files/Ti8LGubFvKO14gh7TzD3)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ftcoders.first-tech.com/first-tech-ttp-sdk-pt/area-do-desenvolvedor/iniciando-um-pagamento.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
