Purchase Preview

Overview

When a buyer performs a purchase, the final amount may be modified for several reasons:

  • Currency conversion (e.g. USD to the local currency of the destination country).
  • Commissions to be paid by the customer.
  • Taxes (for example, in Argentina several taxes affect the final amount).

As a consequence, the merchant cannot show the real amount that will be charged until the purchase is processed. Purchase Preview solves this: it returns the calculated amounts, taxes, charges, and exchange rate for a given payment without creating a transaction, so you can show the customer the real amount before they confirm.

The preview also returns a QuoteId that you can send in the Create Purchase request to honor the quoted exchange rate.


📘

This guide documents the v3 Purchase Preview. The preview mirrors the Create Purchase request, so the same payment instrument and customer data produce an accurate quote.




Choose your flow

As with Create Purchase, the preview has two variants depending on your PCI compliance level. Use the option that matches your integration:


⚠️

Only one payment instrument should be included in your request: CardData (PCI only), TrxToken, or PaymentMethod.


Choose your environment

Use these endpoints when the payment is tokenized through Bamboo's Tokenization Form or processed via an alternative payment method.

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

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/preview
Productionhttps://secure-api.bamboopayment.com/v3/api/purchase/preview
⚠️

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


Note
Remember to include your merchant's Private Key in the request headers.




Building the request

The preview accepts the same identifying fields as a purchase. The taxes and exchange rate depend on the amount, currency, destination country, payment instrument, and customer data, so provide as much of it as you can for an accurate quote.

Request parameters

ParameterTypeMandatory?Description
CardDataobjectNo¹ (PCI)Raw card details. Available only on the PCI endpoint.
TrxTokenstringNo¹Card token previously generated through the tokenization flow.
PaymentMethodstringNo¹Payment method identifier (alternative methods such as cash or bank transfer).
NetworkTokenobjectNo¹Network token information used in the transaction.
Amountinteger (64bit)YesAmount with two decimals, no separators (12.251225).
CurrencystringYesISO-4217 currency of Amount.
TargetCountryISOstringYesCountry where the payment will be processed (ISO-3166-1).
TaxableAmountinteger (64bit)NoTaxable amount (two-decimal format).
Tipinteger (64bit)NoTip amount (two-decimal format).
InstallmentsintegerNoNumber of installments.
OrderstringNoMerchant order number.
InvoiceNumberstringNoInvoice number.
UniqueIDstringNoUnique identifier to avoid duplicates.
CustomerobjectNo²Customer details. Required for some countries (e.g. Argentina) to compute taxes correctly.
LoyaltyPlanobjectNoLoyalty plan information. Non-PCI endpoint only.
CommerceKeyobjectNoCommerce key information. PCI endpoint only.
LanguagestringNoResponse language. PCI endpoint only.

1 One of CardData (PCI), TrxToken, NetworkToken, or PaymentMethod identifies the payment instrument. 2 For countries such as Argentina, Customer (with DocumentType, DocumentNumber and Address.State) is required to calculate the applicable taxes.


CardData object (PCI merchants only)

ParameterTypeDescription
CardHolderNamestringName as printed on the card.
PanstringCard number (PAN).
CVVstringCard security code.
ExpirationstringMM/YY.
EmailstringCardholder email.
DocumentstringCardholder document number.
💡

For non-PCI merchants, card payments must be tokenized using the Tokenization Form; send the resulting TrxToken instead of CardData.


Customer object

ParameterTypeDescription
CustomerFirstNamestringCustomer first name.
CustomerLastNamestringCustomer last name.
CustomerDocumentNumberstringDocument number. Required for tax calculation in some countries.
CustomerDocumentTypestringType of identification document.
CustomerPhoneNumberstringPayer's phone number.
CustomerEmailstringPayer's email address.
CustomerAddressobjectBilling address. Provides location data used for tax calculation.

Address object

ParameterTypeDescription
AddressCountrystringCountry of residence or billing.
AddressCitystringCity of residence.
AddressStatestringState or region. Mandatory for Argentina to calculate taxes.
AddressPostalCodestringPostal or ZIP code.
AddressAddressDetailstringStreet, number, and unit or apartment.


Example with Token (Non-PCI)

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

{
  "TrxToken": "OT__6dHAgJo6qeg62qIroA7H7_f_NWZZ6IEx4jiYpVJ8SzQ_",
  "Amount": 10000,
  "Currency": "USD",
  "TargetCountryISO": "AR",
  "Installments": 1,
  "Order": "AR-2025-0001",
  "Customer": {
    "FirstName": "Juan",
    "LastName": "Pérez",
    "Email": "[email protected]",
    "DocumentType": "DNI.AR",
    "DocumentNumber": "20222222223",
    "Address": {
      "Country": "AR",
      "State": "Buenos Aires",
      "PostalCode": "8512"
    }
  }
}

Example with Card Data (PCI)

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

{
  "CardData": {
    "CardHolderName": "Juan Pérez",
    "Pan": "4507990000004905",
    "CVV": "123",
    "Expiration": "08/30",
    "Email": "[email protected]",
    "Document": "20222222223"
  },
  "Amount": 10000,
  "Currency": "USD",
  "TargetCountryISO": "AR",
  "Installments": 1,
  "Order": "AR-2025-0001",
  "Customer": {
    "FirstName": "Juan",
    "LastName": "Pérez",
    "Email": "[email protected]",
    "DocumentType": "DNI.AR",
    "DocumentNumber": "20222222223",
    "Address": {
      "Country": "AR",
      "State": "Buenos Aires",
      "PostalCode": "8512"
    }
  }
}



Response

The preview returns the destination currency, the total amount the customer will be charged, the exchange rate applied, and the breakdown of charges and taxes.

ParameterTypeDescription
QuoteIdstringQuote identifier. Send it in the Create Purchase request to honor this quoted exchange rate.
CurrencyCodestringISO code of the destination currency (the currency in which the customer will be charged).
TotalAmountnumberTotal final amount in the destination currency, after applying taxes, conversions, etc.
ExchangeRateobjectExchange rate applied to convert the origin currency into the destination currency.
ChargesarrayBreakdown of the amounts that make up the total (subtotals and taxes).
ErrorCodestringError code, if the preview could not be calculated.
ErrorDescriptionstringError description, if applicable.

ExchangeRate object

FieldTypeDescription
ValuenumberValue the origin currency is equivalent to in the destination.
CodestringIdentifier of the exchange rate applied.

Charges object

FieldTypeDescription
CurrencyCodestringISO code of the currency of the amount.
AmountCategoryCodestringAmount category (e.g. gross amount, tax).
AmountnumberValue of the amount.
SignstringIndicates if the amount is a Debit or Credit movement.
ResponsibleTypestringParty responsible for the charge: Merchant or Buyer.
ExchangeRateobjectExchange rate applied to this charge, when relevant.
TaxobjectTax detail (Code, Name, Percentage) when the charge corresponds to a tax.

Response Example

{
  "ErrorCode": null,
  "ErrorDescription": null,
  "QuoteId": "b3f1c2a4-9d6e-4f02-8a1b-7c2e5d4f6a90",
  "CurrencyCode": "ARS",
  "TotalAmount": 58865.98,
  "ExchangeRate": {
    "Value": 402.09,
    "Code": "USD/ARS"
  },
  "Charges": [
    {
      "CurrencyCode": "ARS",
      "AmountCategoryCode": "Gross",
      "Amount": 40209.00,
      "Sign": "Debit",
      "ResponsibleType": "Buyer",
      "ExchangeRate": {
        "Value": 402.09,
        "Code": "USD/ARS"
      },
      "Tax": null
    },
    {
      "CurrencyCode": "ARS",
      "AmountCategoryCode": "Tax",
      "Amount": 9650.16,
      "Sign": "Debit",
      "ResponsibleType": "Merchant",
      "ExchangeRate": null,
      "Tax": {
        "Code": "AR-VAT-DIGITAL",
        "Name": "VAT",
        "Percentage": 20.0
      }
    },
    {
      "CurrencyCode": "ARS",
      "AmountCategoryCode": "Tax",
      "Amount": 965.02,
      "Sign": "Debit",
      "ResponsibleType": "Merchant",
      "ExchangeRate": null,
      "Tax": {
        "Code": "AR-INGR-BRUTOS",
        "Name": "II.BB",
        "Percentage": 2.0
      }
    }
  ]
}



Test the API

Test your preview integration in the API Reference: