Create Purchase

Create a purchase using the API flow providing its basic information for PCI and Non-PCI Merchants.

Overview

Creating a purchase allows your system to request a payment authorization through Bamboo’s API. The same endpoint supports multiple payment methods (from card transactions to cash and bank transfers) across all countries where Bamboo operates.

Depending on your PCI certification level, purchases can be created using:

  • CardDatafor PCI-certified merchants who handle card details directly.
  • TrxTokenfor merchants who use tokenized cards.
  • PaymentMethodfor alternative payments such as cash or bank transfers.

Each flow shares the same structure for amount, currency, customer, and country fields.


Choose your flow

Each merchant can create purchases differently depending on their PCI compliance level and the payment method selected. Use the option that matches your integration:

⚠️

Only one of these fields should be included in your request: CardData, TrxToken, or PaymentMethod.



Choose your environment

Bamboo provides two environments. Depending on how you handle card data, the endpoint you should use varies:

  • Staging for simulations and homologation (recommended first).
  • Production for live payments after certification.

PCI-Certified Merchants (raw card data)

Use these endpoints when sending card data directly (PAN, CVV, Expiration). Available only for merchants certified under PCI DSS.

EnvironmentEndpoint
Staginghttps://secure-api.stage.bamboopayment.com/v3/api/Purchase
Productionhttps://secure-api.bamboopayment.com/v3/api/Purchase
⚠️

Only PCI-certified merchants can access the secure /secure-api/ endpoints.


Non-PCI Merchants

Use these endpoints when validating cards through Bamboo’s Tokenization Form, which handles card data securely and returns a token for later use.

EnvironmentEndpoint
Staginghttps://api.stage.bamboopayment.com/v3/api/Purchase
Productionhttps://api.bamboopayment.com/v3/api/Purchase
💡

Non-PCI merchants must use these endpoints together with the Tokenization Form, which captures and encrypts card data outside the merchant’s environment.



Building the request

Some fields are mandatory in every purchase, no matter which flow you choose. Others are highly recommended or recommended for optimal fraud detection and risk evaluation.

Request parameters

ParameterTypeMandatory?Description
TrxTokenstringNo¹Card token previously generated through the tokenization flow.
NetworkTokenobjectNo¹Network token information used in the transaction.
PaymentMethodstringNo¹Payment method identifier (alternative methods such as cash or bank transfer).
UniqueIDstringNoUnique identifier of the purchase to avoid duplicates.
CapturebooleanNotrue for one-step purchase; false to authorize and capture later.
TargetCountryISOstringYesCountry where the payment will be processed (ISO-3166-1).
CurrencystringYesISO-4217 currency.
Amountinteger (64bit)YesAmount with two decimals, no separators (12.251225).
Tipinteger (64bit)NoTip amount (two-decimal format).
TaxableAmountinteger (64bit)NoTaxable amount (two-decimal format).
InstallmentsintegerNoNumber of installments.
OrderstringYesMerchant order number.
InvoiceNumberstringNoInvoice number.
DescriptionstringNo⁴Optional description (may be required by specific acquirers/countries).
AdditionalDatastringNoFree-form additional data.
MetadataInobjectNoArbitrary key–value metadata.
CustomerobjectYes³Customer details.
SoftDescriptorstringNoText shown on cardholder’s statement (availability varies by country).
ClientIpstringHighly RecommendedIP address of the payer’s device. Enables device and geolocation analysis for anti-fraud evaluation. Validated when present.


CardData object (PCI merchants only)

ParameterTypeMandatory?Description
CardHolderNamestringYesName as printed on the card.
PanstringYesCard number (PAN).
CVVstringYesCard security code.
ExpirationstringYesMM/YY.
EmailstringRecommendedCardholder email, used for identity correlation and antifraud scoring.
DocumentstringHighly RecommendedCardholder document number, used for identity verification.
💡

For non-PCI merchants, card payments must be processed using the tokenization form provided by Bamboo.



Customer object

ParameterTypeMandatory?Description
CustomerFirstNamestringNoCustomer first name.
CustomerLastNamestringNoCustomer last name.
CustomerReferenceCodestringNoMerchant reference for the customer.
CustomerPhoneNumberstringHighly RecommendedPayer’s phone number, used for behavioral and contact validation.
CustomerDocumentNumberstringHighly RecommendedDocument number used for identity verification. Validated when present.
CustomerDocumentTypestringHighly RecommendedType of identification document used by the payer. Validated when present.
CustomerEmailstringYesPayer’s email address.
CustomerAddressobjectRecommendedBilling or shipping address of the payer. Provides additional context for anti-fraud analysis.


Address object

ParameterTypeMandatory?Description
AddressCountrystringRecommendedCountry of residence or billing. Required ifCustomer.Address is included.
AddressCitystringRecommendedCity of residence. Required if Customer.Address is included.
AddressStatestringRecommendedState or region. Required if Customer.Address is included.
AddressPostalCodestringRecommendedPostal or ZIP code.
AddressAddressDetailstringRecommendedStreet, number, and unit or apartment. Required if Customer.Address is included.


AntifraudData object

Use the AntifraudData object to send additional information used by Bamboo’s antifraud engine. Although optional, including this object improves the accuracy of risk evaluation.

PropertyTypeDescription
AntifraudDataAntifraudFingerprintIdstringSession identifier generated by Bamboo’s JavaScript fingerprint library. Links the payer’s device and browser session to the transaction.
AntifraudDataAntifraudMetadataInobjectOptional dictionary of custom key–value pairs that can include contextual variables (e.g., channel, device type, or customer segment).
ℹ️

For details about how these fields are validated and used in risk evaluation, refer to the Anti-fraud section.

1 One of TrxToken, NetworkToken, or PaymentMethod is required depending on the selected flow.

3 Not required if you create the purchase using CommerceToken.

4 Some acquirers (e.g., Brazil card) may require a specific Description format.

💳

For detailed information about 3D Secure (3DS) and Network Token objects, see their dedicated sections. PaymentMethod is mandatory when sending a Network Token.



Example with Token

To test this endpoint, use the API Reference or the Postman Collection

{
    "TrxToken": "OT__6dHAgJo6qeg62qIroA7H7_f_NWZZ6IEx4jiYpVJ8SzQ_",
    "UniqueID": "paymentID3022",
    "Capture": true,
    "TargetCountryISO": "BR",
    "Currency": "BRL",
    "Amount": 25000,
    "Installments": 2,
    "Order": "CH2023-001",
    "Description": "Compra de teste",
    "Customer": {
        "FirstName": "João",
        "LastName": "Silva",
        "ReferenceCode": "JS-001",
        "PhoneNumber": "11987654321",
        "DocumentNumber": "12345678901",
        "DocumentType": "CPF.BR",
        "Email": "[email protected]",
        "Address": {
            "Country": "BR",
            "City": "São Paulo",
            "State": "SP",
            "PostalCode": "01310-200",
            "AddressDetail": "Avenida Paulista 1000"
        }
    },
  "CustomerIP": "190.10.224.231",
  "AntifraudData": {
    "AntifraudFingerprintId": "0046f17b-197a-4d63-8b6b-6082cdd557ff"
  }
}

Example with Card Data

To test this endpoint, use the API Reference or the Postman Collection

{
    "CardData": {
        "CardHolderName": "João Silva",
        "Pan": "4507990000004905",
        "CVV": "123",
        "Expiration": "08/30",
        "Email": "[email protected]",
        "Document": "12345678901"
    },
    "UniqueID": "paymentID3022",
    "Capture": true,
    "TargetCountryISO": "BR",
    "Currency": "BRL",
    "Amount": 25000,
    "Installments": 2,
    "Order": "CH2023-001",
    "Description": "Compra de teste",
    "Customer": {
        "FirstName": "João",
        "LastName": "Silva",
        "ReferenceCode": "JS-001",
        "PhoneNumber": "11987654321",
        "DocumentNumber": "12345678901",
        "DocumentType": "CPF.BR",
        "Email": "[email protected]",
        "Address": {
            "Country": "BR",
            "City": "São Paulo",
            "State": "SP",
            "PostalCode": "01310-200",
            "AddressDetail": "Avenida Paulista 1000"
        }
    },
  "CustomerIP": "190.10.224.231",
  "AntifraudData": {
    "AntifraudFingerprintId": "0046f17b-197a-4d63-8b6b-6082cdd557ff"
  }
}

Example for an Alternative Payment Method

To test this endpoint, use the API Reference or the Postman Collection

{
  "PaymentMethod": "PFC",
  "Order": "AR-2025-0001",
  "Amount": 100000,
  "Currency": "ARS",
  "Description": "Compra de prueba",
  "TargetCountryISO": "AR",
  "Customer": {
    "FirstName": "Juan",
    "LastName": "Pérez",
    "Email": "[email protected]",
    "DocumentType": "DNI.AR",
    "DocumentNumber": "12345678",
    "ReferenceCode": "CLI-45821"
  }
}


Response

The response structure for Direct Purchase (PCI merchants) is the same as the standard Purchase response.

ParameterTypeDescription
TransactionIdstringUnique transaction identifier (19-digit numeric as string).
ResultstringCOMPLETED or ACTION_REQUIRED.
StatusstringApproved, Rejected, Pending, etc.
ErrorCodestringError code if rejected.
ErrorDescriptionstringError description if rejected.
CreatedstringISO 8601 timestamp when created.
AuthorizationDatestringISO 8601 timestamp when authorized.
AuthorizationCodestringIssuer authorization code.
AmountintegerTotal amount.
CurrencystringCurrency used.
InstallmentsintegerNumber of installments.
TaxableAmountintegerTaxable amount.
TipintegerTip amount.
UrlstringURL with additional details.
MetadataOutobjectMetadata returned by Bamboo.
ActionobjectPresent when Result = ACTION_REQUIRED.
PaymentMethodobjectMethod details used in the transaction.

Action object

FieldTypeDescription
SessionIdstringSession identifier related to the action.
Reasonstringe.g., VERIFICATION_CODE_NEEDED, REDIRECTION_NEEDED_EXTERNAL_SERVICE.
URLstringRedirection URL to complete the step (e.g., CVV capture page, 3DS challenge).

PaymentMethod object

FieldTypeDescription
Brandstringe.g., Visa, MasterCard.
CardOwnerstringCardholder name.
BinstringFirst 6 digits of the PAN.
IssuerBankstringIssuing bank.
Typestringe.g., CreditCard, DebitCard.
Expirationstringyyyymm.
Last4stringLast 4 digits of the card.

Response Examples

Result : COMPLETED, Status:APPROVED

{
    "TransactionId": "79632697147789184",
    "Result": "COMPLETED",
    "Status": "APPROVED",
    "ErrorCode": null,
    "ErrorDescription": null,
    "Created": "2024-08-07T17:51:54.620",
    "AuthorizationDate": "2024-08-07T17:51:56.879",
    "AuthorizationCode": "839936",
    "Amount": 25000,
    "Currency": "BRL",
    "Installments": 1,
    "TaxableAmount": null,
    "Tip": null,
    "Url": "https://api.stage.bamboopayment.com/Purchase/79632697147789184",
    "MetadataOut": null,
    "Action": null,
    "PaymentMethod": {
        "Brand": "Visa",
        "CardOwner": "Joao Silva",
        "Bin": "450799",
        "IssuerBank": "Santander",
        "Type": "CreditCard",
        "Expiration": "203008",
        "Last4": "4905"
    }
}
{
   "ErrorCode": "PR001",
   "ErrorDescription": "The token sent is invalid, expired, or does not belong to the merchant."
}


Test the API

Once you’re familiar with how to create a purchase, test your integration in the API Reference: