Purchase Preview

This functionality allows merchants to show the values that may affect the final amount of a purchase transaction.

When a buyer performs a purchase, the amount of it can be modified for several reasons:

  • Currency conversion (USD to local currency of the destination country)
  • Commissions to be paid by the customer
  • Taxes
  • etc.

For example, in Argentina there are different taxes that affect the final amount and, as a consequence, the merchant cannot show the real amount that will be charged until the purchase is completed.

As a solution, we created a tool that allows the merchant to preview the amount that the customer will be charged so that they can inform it prior to executing the purchase.

The following example shows the way suggested to the merchants to display the preview in Argentina.

PrintScreen

Request

To use the purchase preview, you must point to the following endpoint:

GET https://api.stage.bamboopayment.com/v1/api/purchase/preview


Remember to include your merchant’s Private Key in the request headers.
For more details, check our Authentication Guide.

Example of the request

{
    "baseAmount": 100,
    "currency": "USD",
    "countryIso": "AR",
    "paymentMediaId": 1,
    "customer": {
      "documentTypeId": 5,
      "docNumber": "20222222223",
      "state": "Buenos Aires",
      "postalCode": "8512"
    }
 }

Where:
ParameterTypeMandatory?Description
baseAmountintegerYesAmount to be paid before taxes.
currencystringYesCurrency of the amount defined in baseAmount.
countryIsostringYesCountry in ISO 3166-2 format.
paymentMediaIdstringNoPayment Method identifier. This identifier can be obtained by consulting the Payment Methods by country section in the documentation.
customerObjectNo*Payer Information.
*Required for Argentina.
customer.documentTypeIdstringNoPayer Document Type.
customer.docNumberstringNoPayer document number.
customer.statestringNo*Payer state.
*For Argentina, this field is mandatory and you must include the corresponding value using the table displayed in this section.
customer.postalCodestringNoPayer Zip Code.

Response

Next, we show an example of the response to the request shown previously.

Example response

{
  "Response": {
      "Success": true,
      "Data": {
          "Date": "2023-03-30T20:35:39.3139535+00:00",
          "Currency": "ARS",
          "ExchangeRate": {
              "Value": 402.090000,
              "FromCurrencyIsoCode": "USD",
              "ToCurrencyIsoCode": "ARS",
              "TypeCode": "Median",
              "Date": "2023-03-29T19:00:00"
          },
          "TotalAmount": 58865.98,
          "TaxDetails": [
              {
                  "TaxCode": "AR-VAT-DIGITAL",
                  "TaxName": "VAT",
                  "TaxAmount": 9650.16,
                  "TaxPercentage": 20.0,
                  "ResponsableType": "Merchant"
              },
              {
                  "TaxCode": "AR-INGR-BRUTOS",
                  "TaxName": "II.BB",
                  "TaxAmount": 965.016,
                  "TaxPercentage": 2.0,
                  "ResponsableType": "Merchant"
              }
          ],
          "AmountDetails": [
              {
                  "CurrencyCode": "ARS",
                  "AmountCategoryCode": "EfEx",
                  "Amount": 8041.8,
                  "Sign": "Debit",
                  "ResponsableType": "Buyer"
              },
              {
                  "CurrencyCode": "ARS",
                  "AmountCategoryCode": "Gross",
                  "Amount": 40209,
                  "Sign": "Debit",
                  "ResponsableType": "Buyer"
              }
          ]
      }
  },
  "Errors": null
}

The parameters in the response are the following:

ParameterTypeDescription
SuccessbooleanDetermines if the result of the operation was successful.
Data.DatedateDate the process was executed.
Data.CurrencystringISO code of the merchant’s currency. That is, the destination currency in the conversion.
Data.ExchangeRate.valuenumberAmount that the origin currency is equivalent to in the destination currency.
Data.ExchangeRate.FromCurrencyIsoCodestringISO code of the origin currency.
Data.ExchangeRate.ToCurrencyIsoCodestringISO code of the destination currency.
Data.ExchangeRate.TypeCodestringNot used.
Data.ExchangeRate.DatedateDate of the last update of the conversion rate.
Data.TotalAmountnumberTotal final amount of the purchase in local currency after applying the values that affect it (taxes, conversions, etc.).
Data.TaxDetailsobjectContains the detail of the taxes that apply to the transaction.
Data.AmountDetailsobjectContains the detail of the transaction subtotals.

Object TaxDetails

Next, we explain the sub-parameters of the TaxDetails object.

ParameterTypeDescription
TaxCodestringTax code defined by Bamboo Payment.
TaxNamestringName of the tax that is applied.
TaxAmountnumberTotal value of the tax.
TaxPercentagenumberPercentage corresponding to the tax.
ResponsibleTypestringIndicates whether the party responsible for the tax is the merchant (Merchant) or the payer (Buyer).

Object AmountDetails

Next, we explain the sub-parameters of the AmountDetails object.

ParameterTypeDescription
CurrencyCodestringISO code of the currency of the amount.
AmountCategoryCodestringAmount category.
AmountnumberValue of the amount.
SignstringIndicates if the amount is a debit or credit movement.
ResponsibleTypestringIndicates whether the party responsible for the tax is the merchant (Merchant) or the payer (Buyer).
footer
Last modified December 20, 2024

© Bamboo | All rights reserved 2024