Online Payments With Tickets

An easy step-by-step payment integration.

The best usage of the Ingresse payment system when you are a ticketing company is accepting sales with our tickets integration. In this way, you are making usage of our inventory control, sales reports, and shopping cart management.

Selling tickets through Ingresse may nee you to list the events and tickets to the users. In order to complete those steps, you can relay in the endpoints below:

With these 3 endpoints above you can list all the events available for you to sell. Below we will describe to you in more detail how to complete the tickets checkout.

Implementing The Checkout

When selling with Ingresse ticketing system, there are only three mandatory steps to run:

1517
  1. Authenticate the user who is purchasing the tickets.
  2. Start a transaction, to hold the tickets during payment step.
  3. Send payment information to conclude the sales process.

Each step below is tracked down by our platform and keeps you informed via our webhooks allowing you to keep track of new purchases and transaction updates.

📘

Ingresse Webhooks

You can request to activate a webhook to your platform through our support platform.

1. Authentication

Ingresse will handle all the details about ticketing validation and deliver for you. Because of that, before starting the integration, you need to complete the user integration.

Every transaction needs a user to be associated with. In order to complete this step, you have two options.

Using Ingresse interface for user integration

Ingresse provides you a complete authentication interface. It will work by redirecting the user to our authentication webpage and indicating the URL to where we are going to redirect the user back when the authentication is finished.

You can read more details about quickly integration an authentication flow here.

API integration

In case you are a white label, you can build all the authentication flow from the ground. If you are already integrated with the authentication flow, you can proceed with the login.

ing.api.login({
    email: '[email protected]',
    password: '@test1test@',
})
.then((response) => {
  // Code when login goes successful
})
.catch((error) => {
  // Code when login is not successful
});
var manager = IngresseSDKManager.shared.service.authmanager.loginWithEmail(
  "email do usuario", 
  andPassword: "senha do usuario", 
  onSuccess: { (ingresseUser: IngresseUser) in 
		// Code in case of success
	}, onError: { (error) in 
		// Code in case of error
})
val client = IngresseClient("apiKey", "authToken", "userAgent", Environment.PROD)
val request = CompanyLogin("email do usuário", "senha do usuário")

IngresseService(client).auth.companyLoginWithEmail(request, onSuccess = { response: CompanyLoginJSON ->
	// Code in case of success
}, onError = { error: APIError ->
	// Code in case of error
}, onConnectionError = { error: Throwable ->
	// Code in case of connection error
}, onTokenExpired = {
	// Code in case of expired token
})
curl -X POST \
  'http://api.ingresse.com/login?apikey={{apikey}}' \
  -H 'Content-Type: application/json' \
  -H 'Postman-Token: f49f3279-716f-42f4-91b9-f6758e1b10fb' \
  -H 'cache-control: no-cache' \
  -d '{
	"email": "{{email}}",
	"password": "{{password}}"
}'

After a successful login, you are going to have access to user token and JWT token. You are going to use them in the next steps.

2. Start Transaction

With a user properly authenticated, you may now proceed to the checkout. When creating a checkout process integrated with our ticket services, you can let Ingresse handle the ticket reservation before the payment.

It is a request called Start Transaction, and you can use that by simply informing the tickets and external products.

After submitting the start transaction, you are going to receive a transaction ID that must be used in the payment step, and the list of available payment methods.

curl -X POST \
  'https://api.ingresse.com/shop?publickey={{YOUR_API_KEY}}&usertoken={{THE_USER_TOKEN}}' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
    "eventId": {{EVENT_ID}},
    "tickets": [
        {
            "guestTypeId": {{TICKET_TYPE_ID}},
            "quantity": {{QUANTITY}}
        }
    ]
}'
var holder = PaymentTicket.Holder()
holder.email = "{{CUSTOMER_EMAIL_OR_ID}}"

let ticket = PaymentTicket()
ticket.guestTypeId = "{{TICKET_TYPE_ID}}"
ticket.quantity = "{{QUANTITY}}"
ticket.holder = [holder] // in case you the holders in array counts less than the quantity of tickets, the remaining tickets will be sent directly to order owner account

var request = Request.Shop.Create()
request.eventId = "{{EVENT_ID}}"
request.userId = "{{USER_ID}}"
request.passkey = "{{PASSKEY}}"
request.tickets = [ticket]

let manager = IngresseSDKManager.shared.service.transaction
manager.createTransaction(request: request,
                          userToken: "{{USERTOKEN_FROM_AUTHENTICATION}}",
                          onSuccess: { (response: Response.Shop.Transaction) in 
                                     // code in case of success
                                     },
                          onError: { (error: APIError) in 
                                   // code in case of error
                                   })
val holder = Holder()
holder.email = email = "{{CUSTOMER_EMAIL_OR_ID}}"

val ticket = ShopTicket()
ticket.guestTypeId = "{{TICKET_TYPE_ID}}"
ticket.quantity = "{{QUANTITY}}"
ticket.holder = [holder] // in case you the holders in array counts less than the quantity of tickets, the remaining tickets will be sent directly to order owner account

val params = TransactionParams()
params.userId = "{{USER_ID}}"
params.eventId = "{{EVENT_ID}}"
params.passkey = "{{PASSKEY}}"
params.tickets = [ticket]

val request = CreateTransaction()
request.userToken = "{{USERTOKEN_FROM_AUTHENTICATION}}"
request.params = params

val client = IngresseClient("{{API_KEY}}", "{{JWT_TOKEN}}", "{{USER_AGENT}}", Environment.PROD)
IngresseService(client).transaction.createTransaction(request, onSuccess = { response: TransactionDataJSON ->
	// code in case of success
}, onError = { error: APIError ->
	// code in case of error
}, onTokenExpired = {
	// code when user needs to login again
})
AttributeDescription
{{CUSTOMER_EMAIL_OR_ID}}The email or user ID who must receive the tickets after the purchase. It may be a user ID different from the user who is purchasing.
{{TICKET_TYPE_ID}The equivalent of type[].id in the Tickets List request.
{{QUANTITY}}Total tickets ordered for the specific type.
{{EVENT_ID}}Event ID to where the tickets being sold belongs to.
{{USER_ID}}The user ID for the same user who authenticated.
{{PASSKEY}}In case there is a ticket bought protected by a passkey, you must inform the passkey here.
{{USERTOKEN_FROM_AUTHENTICATION}}The user token received after authentication.
{{JWT_TOKEN}}The JWT token returned after authentication.
{{USER_AGENT}}The user agent object generated by Kotlin SDK. In general, it is a string such as "com.ingresse.eventmanager/4.1.0 (159)".

📘

Checkout Cart Expiration Time

After the start transaction, the tickets informed will remain reserved from inventory for 10 minutes.

3. Pay transaction

With a transaction ID in hands, now you are ready to submit a payment request. You can read all the features related to a payment by our Pay A Transaction documentation. In the example below, we are going to show you how to submit a payment with a credit card.

curl -X POST \
  'https://api.ingresse.com/shop?publickey={{API_KEY}}&usertoken={{USER_TOKEN}}' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
  "userId" : {{USER_ID}},
  "transactionId" : "{{TRANSACTION_ID}}",
  "creditcard" : {
    "number" : {{CARD_NUMBER}},
    "holderName" : "{{CARD_HOLDER_NAME}}",
    "expiracyMonth" : {{CARD_EXPIRACY_MONTH}},
    "expiracyYear" : {{CARD_EXPIRACY_YEAR}},
    "cvv" : {{CARD_SECURITY_CODE}},
    "birthDate" : "{{CARD_HOLDER_BIRTH_DATE}}"
  },
  "paymentMethod" : "CartaoCredito",
  "document" : "{{CPF_DOCUMENT_FORMAT}}"
}'
var creditCard = Request.Shop.CreditCard()
creditCard.number = "{{CARD_NUMBER}}"
creditCard.holderName = "{{CARD_HOLDER_NAME}}"
creditCard.expiracyMonth = "{{CARD_EXPIRACY_MONTH}}"
creditCard.expiracyYear = "{{CARD_EXPIRACY_YEAR}}"
creditCard.cvv = "{{CARD_SECURITY_CODE}}"
creditCard.birthDate = "{{CARD_HOLDER_BIRTH_DATE}}"

var request = Request.Shop.Payment()
request.userId = "{{USER_ID}}"
request.transactionId = "{{TRANSACTION_ID}}"
request.creditcard = creditCard
request.installments = "{{INSTALLMENTS}}"
request.paymentMethod = "CartaoCredito"
request.document = "{{CPF_DOCUMENT_FORMAT}}"
request.ingeprefsPayload = ingeprefsPayload

var manager = IngresseSDKManager.shared.service.payment
manager.doPayment(request: request,
                  userToken: "{{USER_TOKEN}}",
                  onSuccess: { (response: Response.Shop.Payment) in
                             // code in case of success
                             },
                  onError: { (error: APIError) in 
                           // code in case of error
                           })
AttributeDescription
{{CARD_NUMBER}}Credit card number without spaces.
{{CARD_HOLDER_NAME}}Cardholder name as identified in the credit card.
{{CARD_HOLDER_BIRTH_DATE}}The cardholder birthdate in the format of YYYY-MM-DD.
{{USER_ID}}User ID of who is placing the order.
{{TRANSACTION_ID}}The transaction receiving the payment. This information is returned in step 2
{{INSTALLMENTS}}Installments, in case they are available. You can verify the number of available installments in the return of step 2.
{{CPF_DOCUMENT_FORMAT}}The cardholder document CPF. Only numbers.

If you conclude successfully all the steps above, after this last step you are going to receive an approved transaction return and your order is complete. The user informed in the transaction will be notified about its new tickets and your reports updated.


What’s Next

You may be interested in one of these topics.