paymentInit

Initializing a payment request.

Creating the payment request

/paymentInit

POST https://api.agilspotpay.com.br/api/checkout/paymentInit

Send a payment request to AgilSpot Pay. Remembering that every request you need to inform your Bearer Token and the App Token.

Request Body

Name
Type
Description

ammount*

number(int)

Amount in Real (BRL) that will be charged

expiration*

number(int)

lifetime

tags*

string

Custom parameter, here you can enter custom record.

installment*

number(int)

Numbers of installments that will be available for the customer to choose from.

metadata

string

Custom parameter, here you can enter custom record.

currency*

String

Brazilian Currency 'BRL'

invoice_type

String

Checkout type that will return to your customer: multi_option, pix_option, credit_option

app_token*

String

App token of the project you wish to retrieve settings for.

{
    "user_id": "5**40",
    "object_id": 5633,
    "link_token": "cd473f46c496e4605ab635db3c30a73f",
    "secret_token": "....51ab...0a3e...",
    "x_parse_token": "...3752f7...b344869b7...",
    "enter_amount": 210250,
    "invoice_brand": "AgilSpot Pay",
    "metadata": "COD:30459074314d8ba",
    "installment": "01",
    "currency": "BRL",
    "dev_webhook": "https://br.agilspotpay.com.br/webhook/handlehook.php",
    "prod_webhook": "https://br.agilspotpay.com.br/webhook/handlehook.php",
    "url_return": "",
    "uuid": "15e4d86fb83e4d8b8fa42e367810af0c",
    "pix_copy_past": "00020101021226790014br.gov.bcb.pix2557brcode.starkinfra.com/v2/15e4d86fb83e4d8b8fa42e367810af0c5204000053039865802BR5917Agilspot pay Ltda6009Sao Paulo62070503***630469D9",
    "expiration": 3600,
    "tags": "pix_bet",
    "client_ip": "....30.117",
    "checkout_url_link": "https://developers.agilspotpay.com.br/checkout/token/cd473f46c496e4605ab635db3c30a73f",
    "id": 38
}

invoice_type Parameters: Determines the payment option that will be returned to your customer. NOTE: By default the value will always be multi_option.

invoice_type Parameters

multi_option

Checkout returns payment options: Credit Card and Pix payment services.

pix_option

Only Pix payment services are returned by the Checkout page.

credit_option

Only Credit Card payment services are returned by the Checkout page.

Responses Parameters

You can store all the parameters returned when generating the payment promise, but there are some parameters that are fundamental and important that you store these data well in your database in order to be able to track the status of the generated promises.

They are: object_id, link_token, url, uuid, status.

Parameters
Description

object_id

the ID of the payment request.

link_token

encrypted token of the generated payment promise.

url

link where your user must be directed to complete the payment.

uuid

pix payments id.

status

payment promise status: pending_payment, succeeded, refunded, expired, failed.

Status Return Type

Type
Description

pending_payment

waiting for the payment.

succeeded

payment made successfully.

refunded

amount paid was returned to the end customer.

expired

payment link expired.

failed

there was a failure in the attempt to make the payment.

Example Code: The APIs follow the REST standard, so they can be integrated with your preferred programming language, but here are some examples with the main languages:

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.agilspotpay.com.br/api/checkout/paymentInit',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => 'amount=210250&expiration=3600&tags=pix_bet&installment=05&metadata=COD%3A30459074314d8ba&url_return=&currency=BRL',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/x-www-form-urlencoded',
    'Authorization: Bearer ......8d951ab5.......3ea......2'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Last updated