Operations

Create a purchase using the API flow providing its basic information. Furthermore, explore the different operations over existing purchases.

Configuring the authentication

All methods used in Purchase API require the following authentication headers.

KeyValueComments
Content-Typeapplication/jsonWith this header, the request will be transmitted in JSON format.
AuthorizationBasic {{Merchant Private Key}}Send the {{Merchant Private Key}} (your merchant identifier) and the word Basic.
Example: Basic RVkeLr-86_iTzSMLvDtuyQ-1zqIcsmFG-oSzncn_uFv-nj7bhB3rtZg__

Setting the language of the response codes

You can receive the error description by relying on localization features. To do this, you need to send the lang header in your integration, using any of the following languages in ISO 639-1 format.

CodeLanguage
enEnglish.
This is the default language. If you don’t send this header or set a non-existent language, you will receive errors in this language.
esSpanish.
ptPortuguese.

Purchase API methods

The operations exposed by the Purchase API allow you to perform several actions over Purchases. You have available the following methods.

Create a purchase

Create a basic purchase in Bamboo Payment.

Request URL

You must invoke a POST request to the following URLs according to your needs.

  • Production: https://api.bamboopayment.com/v1/api/purchase
  • Stage: https://api.stage.bamboopayment.com/v1/api/purchase

Request parameters

ParameterTypeMandatory?Description
PaymentMediaIdintegerNo 1Corresponds to the Id of the payment method you want to use. This parameter is only for Alternative payment methods (transfer, cash, and processing that requires customer redirection).
TrxTokenstringNo 1This parameter refers to the token used to identify a customer’s card.
OrderstringYesOrder number generated by the merchant.
AmountnumberYesAmount of the purchase. This value must be greater than zero.
If you must include decimals in the amount, concatenate the decimal places without the decimal point. Example 12,25 > 1225.
CurrencystringYesCurrency of the purchase, according to ISO-4217. Find the possible values in the Currencies table of each country.
InstallmentsintegerNoThis parameter refers to the number of payments that a credit card purchase is divided into.
CapturebooleanNoDefines whether the purchase should be performed in one or two steps.2
  • If false, only the authorization is processed, and the purchase is pre-authorized until the final confirmation through the commit and rollback calls.
  • If true, the transaction is authorized and captured (committed).

All payment methods and countries may not support the pre-authorization feature.
TargetCountryISOstringYesThis parameter indicates the country where the payment will be processed.
Send the country using ISO-3166-1 format.
MetadataInobjectNoThe Additional fields required by each payment method or acquirer.
CustomerobjectYes 3The Customer object provides the data of the person who performs the purchase.
CustomerCommerceCustomerIdstringNoCustomer identifier.
The merchant generates and uses this value internally to identify the customer within the Bamboo Payment platform.
CustomerEmailstringYesCustomer email address.
CustomerFirstNamestringNoCustomer name.
CustomerLastNamestringNoCustomer last name.
CustomerPhoneNumberstringNoCustomer contact telephone number.
CustomerEnabledbooleanNoIndicates whether the user is enabled to operate. The default value is true.
CustomerBillingAddressobjectNoThis parameter is the customer’s billing address.
CustomerBillingAddressAddressIDintegerNoAddress Identifier.
CustomerBillingAddressAddressTypestringNoType of address.
CustomerBillingAddressCountrystringNoCountry of the address.
CustomerBillingAddressStatestringNoState of the address.
CustomerBillingAddressCitystringNoCity of the address.
CustomerBillingAddressAddressDetailstringNoThis parameter corresponds to the Additional information of the address, such as street, number, etc.
CustomerBillingAddressPostalCodestringNoPostal Code of the address.
CustomerShippingAddressobjectNoThe customer’s shipping address. This address is where they want to receive their purchased product. This object has the same parameter as the Customer.BillingAddress object.
CustomerAdditionalDatastringNoList of type key:value to store extra information.
CustomerCaptureURLstringNoCard data capture URL.
This parameter contains the URL that should be loaded in an iframe to initiate the secure data capture process.
This only applies to Customers of type Commerce.
CustomerDocumentTypeIdstringNoCustomer document type. Find the possible values in the Document types table of each country.
CustomerDocNumberstringNoCustomer document Number.
TipnumberNoAdditional tip of the purchase if required.
DescriptionstringNo 4Optional description of the purchase.
UniqueIDstringNoUnique identifier of the purchase.
This optional value allows you to identify a unique purchase and avoid duplication of transactions in case of communication errors. For more information, refer to Concepts.
AdditionalDatastringNoYou can add additional information to the transaction (For example a Key:Value data list).
We return this information each time you consult the purchase.
CustomerUserAgentstringNoUser Agent of the customer who uses the service; for desktop devices, it should be the UserAgent reported by the browser, and for mobile, the information about the device, S.O. used, and App name.
Request example
{
  "TrxToken":"OT__zq4aTY4T9TzSldeBKry-Wbx75QNbuT894jiYpVJ8SzQ_",
  "Order": "099927564",
  "Capture": true,
  "Amount": "10000",
  "Currency": "UYU",
  "TargetCountryISO": "UY",
  "Installments": 1,
  "Customer": {
    "Email": "john@mail.com",
    "FirstName": "John",
    "LastName": "Smith",
    "DocNumber": "12345672",
    "DocumentTypeId": 2,
    "PhoneNumber": "24022330",
    "BillingAddress": {
      "AddressType": 1,
      "Country": "Uruguay",
      "State": "Montevideo",
      "City": "MONTEVIDEO",
      "AddressDetail": "Av. Sarmiento 2260",
      "PostalCode": "150000"
    }
  },
  "DataUY": {
    "IsFinalConsumer": "true",
    "Invoice": "1000",
    "TaxableAmount": 0
  }
}

Confirm a purchase

This method allows you to confirm a pre-authorized purchase.

Request URL

You must invoke a POST request to the following URLs according to your needs.

  • Production: https://api.bamboopayment.com/v1/api/purchase/{{PurchaseID}}/commit
  • Stage: https://api.stage.bamboopayment.com/v1/api/purchase/{{PurchaseID}}/commit

Request parameters

The request body is optional to confirm a purchase. If you don’t send any request, the method commits the pre-authorized purchase by its original amount.

The purchase amount may vary concerning the one sent in the initial purchase process, but the new amount cannot be higher than the original amount.

Request example

You must include the new amount in the request to confirm a purchase with a lower amount than the original. For example:

{
  "Amount": 50
}

Get Purchases

This method allows you to get the information of one or more purchases given the search criteria sent in the body.

Request URL

You must invoke aGET request to the following URLs according to your needs.

  • Production: https://api.bamboopayment.com/v1/api/purchase
  • Stage: https://api.stage.bamboopayment.com/v1/api/purchase

To get a specific purchase, include in the URL /{{PurchaseID}}. Example: https://api.bamboopayment.com/v1/api/purchase/481561.

Request parameters

The following parameters are only required when you want to get a list of purchases. Add the PurchaseID to the Request URL when requesting a specific purchase.

ParameterTypeDescription
AuthorizedbooleanIf the value is true, it returns only purchases that have been completed successfully.
FromdateFilter start date.
Format: yyyyMMdd.
OrderNumberstringMerchant order number.
PaymentMediaIdintegerIdentifier of the Payment Method used in the purchase.
TodateFilter end date.
Format: yyyyMMdd.

Response parameters

You will get the same Response object regardless of the method you invoke. Only when you query purchases and the result has multiple results the Response returned will be an array.

The following table describes the parameters in the Response object relevant to the purchase, its possible next steps in the flow, and the errors that may have occurred.

ParameterTypeDescription
ResponseobjectParameters returned due to the purchase processing.
ResponsePurchaseIdintegerPurchase identifier.
ResponseCreateddateDate and time when the purchase was created.
Date format ISO-8601.
ResponseTransactionobjectThis object is associated with the Purchase and has the information on the request sent and the response obtained from the corresponding payment method.
ResponseTransactionTransactionIDintegerTransaction identifier.
ResponseTransactionCreateddateDate and time when the transaction was created.
Date format ISO-8601.
ResponseTransactionTransactionStatusIdintegerInternal identifier of the transaction status.
ResponseTransactionStatusstringCurrent status of the transaction.
ResponseTransactionErrorCodestringError code (if applicable) returned by the payment method.
ResponseTransactionDescriptionstringDescription of the outcome of the transaction.
ResponseTransactionApprovalCodestringApproval code returned by the payment method.
ResponseRefundListobjectThis object has information on the purchase’s refunds (partials or total).
ResponseRefundListPurchaseRefundIdintegerIdentifier associated with the refund.
ResponseRefundListCreateddateDate and time when the refund was made.
ResponseRefundListUniqueIDstringUnique identifier of the transaction.
This value allows you to identify a refund in the list of all possible refunds made.
ResponseRefundListAmountintegerTotal amount of the refund.
ResponseRefundListCurrencystringCurrency of the purchase, according to ISO-4217 (alphanumeric codes).
ResponseRefundListStatusstringCurrent status of the refund.
ResponseCommerceActionobjectThis object informs you of the actions you or your customer must take to complete the current purchase process.
ResponseMetadataOutobjectAdditional fields returned by each payment method or acquirer to perform the following steps.
For example, this object can have the URL to where you need to redirect the customer or the QR image that has to be scanned by your customer.
ResponseCrossBorderDataResponseobjectThis object has the information about the processed Amounts in the local currency of the selected Country.
ResponseCrossBorderDataResponseTargetCountryISOstringSame country sent in the request.
ResponseCrossBorderDataResponseTargetCurrencyISOstringLocal currency determined for the selected country.
ResponseCrossBorderDataResponseTargetAmountnumberPurchase amount converted to the local currency.
ErrorslistList of errors that the system can launch during the purchase process.
ErrorsErrorCodestringError code returned.
ErrorsCreatedstringDate and time when the error was generated.
ErrorsMessagestringDescriptive text of the error.
ErrorsDetailstringError detail.

Response example

{
    "Response": {
        "PurchaseId": 481561,
        "Created": "2023-08-01T20:53:28.309",
        "TrxToken": null,
        "Order": "099927564",
        "Transaction": {
            "TransactionID": 499285,
            "Created": "2023-08-01T20:53:28.310",
            "AuthorizationDate": "2023-08-01T20:53:28.737",
            "TransactionStatusId": 1,
            "Status": "Approved",
            "ErrorCode": null,
            "Description": "",
            "ApprovalCode": "831000",
            "Steps": [
                {
                    "Step": "Generic External",
                    "Created": "2023-08-01T20:53:28.650",
                    "Status": "Authorization OK - Step 1",
                    "ResponseCode": "200",
                    "ResponseMessage": "OK",
                    "Error": "",
                    "AuthorizationCode": null,
                    "UniqueID": null,
                    "AcquirerResponseDetail": "{\"card\":{\"type\":\"C\",\"issuer\":\"424242\",\"isLocal\":true},\"allowedInstallments\":[1,2,3],\"currency\":858,\"authorizationAmount\":100.0,\"discountAmount\":0.0,\"discountPoints\":0,\"lawLimitApplied\":false,\"code\":0,\"message\":\"ok\"}"
                },
                {
                    "Step": "Generic External",
                    "Created": "2023-08-01T20:53:28.730",
                    "Status": "Authorization OK",
                    "ResponseCode": "100",
                    "ResponseMessage": "ACCEPT",
                    "Error": "",
                    "AuthorizationCode": "831000",
                    "UniqueID": null,
                    "AcquirerResponseDetail": "{\"Decision\":\"ACCEPT\",\"ReasonCode\":\"100\",\"RequestID\":\"386631747\",\"PaymentNetworkTransactionID\":\"016153570198200\",\"CvCode\":null,\"MerchantReferenceCode\":\"20201229\",\"AuthorizationCode\":\"831000\"}"
                }
            ]
        },
        "Capture": true,
        "Amount": 10000,
        "OriginalAmount": 10000,
        "TaxableAmount": 0,
        "Tip": 0,
        "Installments": 1,
        "Currency": "UYU",
        "Description": null,
        "Customer": {
            "CustomerId": 247720,
            "Created": "2023-08-01T20:53:16.073",
            "CommerceCustomerId": null,
            "Owner": "Anonymous",
            "Email": "john@mail.com",
            "Enabled": true,
            "ShippingAddress": {
                "AddressId": 0,
                "AddressType": 1,
                "Country": "Uruguay",
                "State": "Montevideo",
                "AddressDetail": "Av. Sarmiento 2260",
                "PostalCode": "150000",
                "City": "Montevideo"
            },
            "Plans": null,
            "AdditionalData": null,
            "PaymentProfiles": [
                {
                    "PaymentProfileId": 252393,
                    "PaymentMediaId": 1,
                    "Created": "2023-08-01T20:53:16.073",
                    "LastUpdate": null,
                    "Brand": "VISA",
                    "CardOwner": "John Smith",
                    "Bin": null,
                    "IssuerBank": "Visa",
                    "Installments": "1;2;3;4;5;6;7;8;9;10;11;12",
                    "Type": "CreditCard",
                    "IdCommerceToken": 0,
                    "Token": null,
                    "Expiration": "202605",
                    "Last4": "0001",
                    "Enabled": null,
                    "DocumentNumber": null,
                    "DocumentTypeId": null,
                    "ExternalValue": null,
                    "AffinityGroup": null
                }
            ],
            "CaptureURL": null,
            "UniqueID": null,
            "URL": "https://testapi.siemprepago.com/v1/api/Customer/247720",
            "FirstName": "John",
            "LastName": "Smith",
            "DocNumber": "12345672",
            "DocumentTypeId": 2,
            "PhoneNumber": "24022330",
            "ExternalValue": null
        },
        "RefundList": null,
        "PlanID": null,
        "UniqueID": null,
        "AdditionalData": null,
        "CustomerUserAgent": null,
        "CustomerIP": null,
        "URL": "https://testapi.siemprepago.com/v1/api/Purchase/481561",
        "DataUY": {
            "IsFinalConsumer": "true",
            "Invoice": "1000",
            "TaxableAmount": 0
        },
        "DataDO": null,
        "Acquirer": {
            "AcquirerID": 77,
            "Name": "VisaNetUYv2",
            "CommerceNumber": null
        },
        "CommerceAction": null,
        "PurchasePaymentProfileId": 252393,
        "LoyaltyPlan": null,
        "DeviceFingerprintId": null,
        "MetadataIn": null,
        "MetadataOut": null,
        "CrossBorderData": null,
        "CrossBorderDataResponse": null,
        "Redirection": null,
        "AntifraudData": {
            "AntifraudFingerprintId": null,
            "AntifraudMetadataIn": null
        },
        "PaymentMediaId": null,
        "TargetCountryISO": null,
        "PurchaseType": 1,
        "IsFirstRecurrentPurchase": false
    },
    "Errors": []
}
footer
Last modified June 24, 2024

© Bamboo | All rights reserved 2024