curl --request POST \
--url https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge \
--header 'Content-Type: application/json' \
--data '
{
"saveInstrument": true,
"consentTextVersion": "<string>",
"surface": "hosted"
}
'import requests
url = "https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge"
payload = {
"saveInstrument": True,
"consentTextVersion": "<string>",
"surface": "hosted"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({saveInstrument: true, consentTextVersion: '<string>', surface: 'hosted'})
};
fetch('https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'saveInstrument' => true,
'consentTextVersion' => '<string>',
'surface' => 'hosted'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge"
payload := strings.NewReader("{\n \"saveInstrument\": true,\n \"consentTextVersion\": \"<string>\",\n \"surface\": \"hosted\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge")
.header("Content-Type", "application/json")
.body("{\n \"saveInstrument\": true,\n \"consentTextVersion\": \"<string>\",\n \"surface\": \"hosted\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"saveInstrument\": true,\n \"consentTextVersion\": \"<string>\",\n \"surface\": \"hosted\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoiceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "<string>",
"providerId": "<string>",
"method": "pix",
"amount": "<string>",
"currency": "<string>",
"status": "pending",
"refundedAmount": "<string>",
"failureCode": "insufficient_funds",
"failedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"payer": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"email": "<string>"
},
"invoiceUrl": "<string>",
"chargeToken": "<string>",
"network": "main",
"settlementAsset": "USDC",
"settlementNetwork": "base",
"pixPayload": "<string>",
"pixQrImage": "<string>",
"providerPixPayload": "<string>",
"sandboxConfirmUrl": "<string>",
"pixExpiresAt": "2023-11-07T05:31:56Z",
"clientSecret": "<string>",
"publishableKey": "<string>",
"nextAction": {
"type": "adyen_session",
"session": {
"id": "<string>",
"sessionData": "<string>"
},
"clientKey": "<string>",
"environment": "live",
"countryCode": "BR",
"locale": "pt-BR",
"amount": {
"value": 1,
"currency": "BRL"
}
},
"switchable": true
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"resource": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"resource": "<string>",
"metadata": {}
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"errors": [
{
"field": "<string>",
"value": "<string>",
"constraint": "<string>",
"description": "<string>"
}
]
}{
"error": {
"code": "internal_error",
"message": "<string>",
"request_id": "<string>"
}
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}Pay an invoice at checkout
Creates a charge on an open invoice using the method the payer picked (pix, boleto, card or crypto). The response carries what the payer needs to finish, such as the Pix QR code. Confirmation comes later: poll the payment status or wait for the payment.confirmed webhook.
curl --request POST \
--url https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge \
--header 'Content-Type: application/json' \
--data '
{
"saveInstrument": true,
"consentTextVersion": "<string>",
"surface": "hosted"
}
'import requests
url = "https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge"
payload = {
"saveInstrument": True,
"consentTextVersion": "<string>",
"surface": "hosted"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({saveInstrument: true, consentTextVersion: '<string>', surface: 'hosted'})
};
fetch('https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'saveInstrument' => true,
'consentTextVersion' => '<string>',
'surface' => 'hosted'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge"
payload := strings.NewReader("{\n \"saveInstrument\": true,\n \"consentTextVersion\": \"<string>\",\n \"surface\": \"hosted\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge")
.header("Content-Type", "application/json")
.body("{\n \"saveInstrument\": true,\n \"consentTextVersion\": \"<string>\",\n \"surface\": \"hosted\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.beinfi.com/pay/{slug}/invoices/{invoiceID}/charge")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"saveInstrument\": true,\n \"consentTextVersion\": \"<string>\",\n \"surface\": \"hosted\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"invoiceId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "<string>",
"providerId": "<string>",
"method": "pix",
"amount": "<string>",
"currency": "<string>",
"status": "pending",
"refundedAmount": "<string>",
"failureCode": "insufficient_funds",
"failedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"payer": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"email": "<string>"
},
"invoiceUrl": "<string>",
"chargeToken": "<string>",
"network": "main",
"settlementAsset": "USDC",
"settlementNetwork": "base",
"pixPayload": "<string>",
"pixQrImage": "<string>",
"providerPixPayload": "<string>",
"sandboxConfirmUrl": "<string>",
"pixExpiresAt": "2023-11-07T05:31:56Z",
"clientSecret": "<string>",
"publishableKey": "<string>",
"nextAction": {
"type": "adyen_session",
"session": {
"id": "<string>",
"sessionData": "<string>"
},
"clientKey": "<string>",
"environment": "live",
"countryCode": "BR",
"locale": "pt-BR",
"amount": {
"value": 1,
"currency": "BRL"
}
},
"switchable": true
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"resource": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"resource": "<string>",
"metadata": {}
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"errors": [
{
"field": "<string>",
"value": "<string>",
"constraint": "<string>",
"description": "<string>"
}
]
}{
"error": {
"code": "internal_error",
"message": "<string>",
"request_id": "<string>"
}
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}Path Parameters
Your account's public identifier, as in checkout URLs.
Invoice ID.
Body
The method the payer picked. A missing or unknown method returns 422.
Payment method.
pix, boleto, card, crypto Card details. Required when method is card on an embedded checkout.
Show child attributes
Show child attributes
The payer chose to save the card for future automatic charges. Requires consentTextVersion; without it, returns 422.
The version of the authorization text the payer saw: echo CheckoutSession.mandate.version. Required with saveInstrument.
Which Infi checkout the payer is on. It sets where the browser returns after a bank verification. Use embed from an embedded (iframe) checkout; without it, hosted applies and the payer leaves the iframe for the full page.
hosted, embed Response
The created charge.
One charge attempt against an invoice. An invoice can have several payments.
The processor the charge ran through. In sandbox, sandbox.
The charge's reference at the processor, useful for support.
pix, boleto, card, crypto Amount charged, as a decimal string.
pending awaits payment; confirmed was paid; failed was not paid (see failureCode); refunded was fully refunded; charged_back was disputed by the buyer with their bank.
pending, confirmed, failed, refunded, charged_back Total refunded so far, as a decimal string. Absent when nothing was refunded. A partial refund keeps status at confirmed; only refunding the full amount sets refunded. Use this field, not status, to know how much went back.
Why the charge failed. superseded is not a decline: the buyer switched payment method to pay the same invoice. Null when the payment did not fail or when no reason was recorded. New codes may appear; treat an unknown value as a generic failure.
insufficient_funds, do_not_honor, card_declined, authentication_required, card_expired, card_stolen, card_invalid, mandate_revoked, mandate_refused, brand_changed, provider_error, provider_timeout, superseded, null When the charge moved to failed.
Who paid. On a one-off invoice, id is the customer ID; on a subscription invoice, it is the ID of the customer's enrollment in the product. Present only on GET /billing/payments and GET /billing/payments/{paymentID}, and null when the invoice does not identify the customer.
Show child attributes
Show child attributes
Hosted payment page. Present only on the charge-creation response.
Single-use token for the crypto payment widget. Present only on a crypto charge response.
Crypto widget environment for this charge: main (real) or test.
main, test Asset the crypto charge settles in.
USDC Network the crypto charge settles on.
base, solana Pix copy-and-paste code. Render the QR from it. Still available on later reads of the payment.
The Pix QR as a base64 PNG (no data: prefix), if you would rather not render it yourself.
Sandbox only: the Pix code the test processor generated, for inspection. Not payable. In sandbox, pixPayload carries the test confirmation link.
Sandbox only: a page that marks this charge as paid without real money. Branch on whether this field is present, not on the shape of pixPayload. You do not need it to render: pixPayload is a QR in both environments.
When the Pix code expires (Pix charges only).
Temporary secret to confirm a card charge in the browser. Present only on the charge-creation response.
Public key paired with clientSecret. Present only on the charge-creation response.
Data to complete a card charge in the browser. Present only on the charge-creation response.
- Option 1
- Option 2
Show child attributes
Show child attributes
Whether this charge can still be dropped so the same invoice is paid another way: true while pending, false once paid or failed. Present only on the charge-creation response; treat a missing value as false.