# MD for: https://www.mercadopago.com.co/developers/en/docs/checkout-api-payments/integration-configuration/bancolombia-button.md \# Botón Bancolombia With Mercado Pago Checkout API you can offer payments with \*\*Botón Bancolombia\*\*, a payment method that allows you to make purchases and payments over the internet by debiting funds directly from Bancolombia savings or checking accounts. To offer payments with Botón Bancolombia, follow the steps below. > SERVER\_SIDE > > h2 > > Create payment To start the Botón Bancolombia implementation process, you need to create a payment. You can do this by calling our API or using one of our SDKs. At this stage you must use your production :toolTipComponent\[Access Token\]{content="Private key of the application created in Mercado Pago, used in the \_backend\_ for API calls. You can access it in \*Your integrations > Application details > Production > Production credentials\*. Do not expose it on the client side."}. ::::TabsComponent :::TabComponent{title="Via API"} Send a \*\*POST\*\* to :TagComponent{tag="API" text="Create payment" href="/developers/en/reference/payments/\_payments/post"} with the parameters described in the table and execute the request. \`\`\`curl curl --location 'https://api.mercadopago.com/v1/payments' \\ --header 'Content-Type: application/json' \\ --header 'Authorization: Bearer ' \\ --header 'X-Idempotency-Key: ' \\ --data-raw '{ "payer": { "email": "" }, "point\_of\_interaction": { "type": "CHECKOUT" }, "payment\_method\_id": "boton\_bancolombia", "transaction\_amount": , "description": "", "callback\_url" : "" }' \`\`\` | Field | Type | Description | |-------|------|-------------| | \`Authorization\` | string | Header with the :toolTipComponent\[production Access Token\]{content="Private key of the application created in Mercado Pago, used in the \_backend\_ for API calls. You can access it in \*Your integrations > Application details > Production > Production credentials\*. Do not expose it on the client side."}. | | \`X-Idempotency-Key\` | string | Header with a unique value per request to avoid duplicate payments. | | \`payer.email\` | string | Buyer's email. | | \`point\_of\_interaction.type\` | string | Type of point of interaction. For Botón Bancolombia it must be \`CHECKOUT\`. | | \`payment\_method\_id\` | string | Payment method ID. For Botón Bancolombia use \`boton\_bancolombia\`. | | \`transaction\_amount\` | integer | Transaction amount. The \*\*minimum amount\*\* must be COP 1000 and the \*\*maximum\*\* up to COP 30000000\. | | \`description\` | string | Description of the payment that the buyer will see. | | \`callback\_url\` | string | Seller's site URL, to which Bancolombia will redirect the buyer once they complete the transaction. | ::: :::TabComponent{title="Via SDK"} Use one of our SDKs to create a payment. Below you will find code examples in the available languages. > WARNING > > The payment time limit (\`timeout\`) \*\*must be set to 7000 ms\*\*, which equals 7 seconds, as this is the limit configured for the Mercado Pago API. * [csharp ](#editor%5F5) * [go ](#editor%5F7) * [java ](#editor%5F3) * [javascript ](#editor%5F2) * [php ](#editor%5F1) * [python ](#editor%5F6) * [ruby ](#editor%5F4) php javascript java ruby csharp python go ``` "); // Step 2.1 (optional - default is SERVER): Set the runtime environment from MercadoPagoConfig::RUNTIME_ENVIROMENTS // If you want to test first on your local machine, set the runtime environment to LOCAL MercadoPagoConfig::setRuntimeEnviroment(MercadoPagoConfig::LOCAL); // Step 3: Initialize the API client $client = new PaymentClient(); try { // Step 4: Create the request array $createRequest = [ "description" => "", "payer" => [ "email" => "", ], "payment_method_id" => "boton_bancolombia", "transaction_amount" => , "callback_url" => "", "point_of_interaction" => [ "type" => "CHECKOUT", ] ]; // Step 5: Create the request options, setting X-Idempotency-Key $request_options = new RequestOptions(); $request_options->setCustomHeaders(["X-Idempotency-Key: "]); // Step 6: Make the request $payment = $client->create($createRequest, $request_options); echo $payment->id; // Step 7: Handle exceptions } catch (MPApiException $e) { echo "Status code: " . $e->getApiResponse()->getStatusCode() . "\n"; echo "Content: "; var_dump($e->getApiResponse()->getContent()); echo "\n"; } catch (\Exception $e) { echo $e->getMessage(); } ``` Copiar ``` // Step 1: Import the module parts you want to use import { MercadoPagoConfig, Payment } from 'mercadopago'; // Step 2: Initialize the client object const client = new MercadoPagoConfig({ accessToken: 'access_token', options: { timeout: 7000, idempotencyKey: 'abc' } }); // Step 3: Initialize the API object const payment = new Payment(client); // Step 4: Create the request object var body = { transaction_amount: 5000, callback_url: '', point_of_interaction: { type: 'CHECKOUT', }, description: '', payment_method_id: 'boton_bancolombia', payer: { email: '', } }; // Step 5: Create the request options object - Optional const requestOptions = { idempotencyKey: '', }; // Step 6: Make the request payment.create({ body, requestOptions }).then(console.log).catch(console.log); More details about sdk-nodejs: https://github.com/mercadopago/sdk-nodejs ``` Copiar ``` // Step 1: Set the production or sandbox Access Token MercadoPagoConfig.setAccessToken(""); // Step 2: Create the request array PaymentCreateRequest paymentCreateRequest = PaymentCreateRequest.builder() .description("") .paymentMethodId("boton_bancolombia") .payer(PaymentPayerRequest.builder() .email("") .build()) .transactionAmount(new BigDecimal("")) .callbackUrl("") .pointOfInteraction(PaymentPointOfInteractionRequest .builder().type("CHECKOUT").build()) .build(); // Step 3: Create the request options, setting X-Idempotency-Key Map customHeaders = new HashMap<>(); customHeaders.put("x-idempotency-key", ""); MPRequestOptions requestOptions = MPRequestOptions.builder() .customHeaders(customHeaders) .build(); // Step 4: Initialize the API client PaymentClient client = new PaymentClient(); client.create(paymentCreateRequest, requestOptions); ``` Copiar ``` # Step 1: Include the library require 'mercadopago' # Step 2: Set the production or sandbox Access Token sdk = Mercadopago::SDK.new("YOUR_ACCESS_TOKEN") # Step 3: Create the request options, setting X-Idempotency-Key custom_headers = { 'x-idempotency-key': '' } # Step 4: Create the request array payment_request = { description: '', payer: { email: '', }, payment_method_id: 'boton_bancolombia', transaction_amount: '', callback_url: '', point_of_interaction: { type: 'CHECKOUT' } } # Step 5: Make the request payment_response = sdk.payment.create(payment_request) payment = payment_response[:response] ``` Copiar ``` // Step 1: Import the required libraries using MercadoPago.Config; using MercadoPago.Client.Payment; using MercadoPago.Resource.Payment; // Step 2: Set the production or sandbox Access Token MercadoPagoConfig.AccessToken = "YOUR_ACCESS_TOKEN"; // Step 3: Create the request array var paymentPayerRequest = new PaymentPayerRequest { Email = "", }; var paymentPointOfInteractionRequest = new PaymentPointOfInteraction { Type = "CHECKOUT", }; var request = new PaymentCreateRequest { Description = "", Payer = paymentPayerRequest, PaymentMethodId = "boton_bancolombia", TransactionAmount = "", CallbackUrl = "", PointOfInteraction = paymentPointOfInteractionRequest }; // Step 4: Create the request options, setting X-Idempotency-Key var requestOptions = new RequestOptions(); requestOptions.CustomHeaders.Add(Headers.IDEMPOTENCY_KEY, ""); // Step 5: Initialize the API client var client = new PaymentClient(); // Step 6: Make the request Payment payment = await client.CreateAsync(request); ``` Copiar ``` ## Step 1: Import the required libraries import mercadopago ## Step 2: Set the production or sandbox Access Token sdk = mercadopago.SDK("YOUR_ACCESS_TOKEN") ## Step 3: Create the request options, setting X-Idempotency-Key request_options.custom_headers = { 'x-idempotency-key': '' } ## Step 4: Create the request array payment_data = { "description": "", "payer": { "email": "", }, "payment_method_id": "boton_bancolombia", "transaction_amount": , "callback_url": "", "point_of_interaction": { "type": "CHECKOUT", } } ## Step 5: Make the request payment_response = sdk.payment().create(payment_data) payment = payment_response["response"] ``` Copiar ``` package main // Step 1: Import the required libraries import ( "context" "fmt" "github.com/mercadopago/sdk-go/pkg/config" "github.com/mercadopago/sdk-go/pkg/payment" ) func main() { // Step 2: Set the production or sandbox Access Token accessToken := "{{ACCESS_TOKEN}}" // Step 3: Set X-Idempotency-Key idempotencyKey := "{{SOME_UNIQUE_VALUE}}" cfg, err := config.New(accessToken) if err != nil { fmt.Println(err) return } // Step 4: Initialize the API client client := payment.NewClient(cfg) // Step 5: Create the request array request := payment.Request{ TransactionAmount: 5000, Description: "", PaymentMethodID: "boton_bancolombia", Payer: &payment.PayerRequest{ Email: "", }, CallbackURL: "", PointOfInteraction: &payment.PointOfInteraction{ Type: "CHECKOUT", }, } // Step 6: Make the request resource, err := client.Create(context.Background(), request, idempotencyKey) if err != nil { fmt.Println(err) return } fmt.Println(resource) } ``` Copiar Replace the following values in the examples before executing the request: | Value in code | Description | |---------------|-------------| | \`ACCESS\_TOKEN\` | :toolTipComponent\[Production Access Token\]{content="Private key of the application created in Mercado Pago, used in the \_backend\_ for API calls. You can access it in \*Your integrations > Application details > Production > Production credentials\*. Do not expose it on the client side."}. | | \`SOME\_UNIQUE\_VALUE\` | Unique value per request to avoid duplicate payments. | | \`PAYER\_EMAIL\` | Buyer's email. | | \`DESCRIPTION\` | Description of the payment that the buyer will see. | | \`TRANSACTION\_AMOUNT\` | Transaction amount. The minimum amount must be COP 1000 and the maximum, up to COP 30000000\. | | \`CALLBACK\_URL\` | Seller's site URL, to which Bancolombia will redirect the buyer once they complete the transaction. | ::: :::: > SERVER\_SIDE > > h2 > > Configure return URL The return URL is where the user is redirected after completing the payment, whether successful, failed or pending. This URL must be a web page you control, such as a server with a named domain (DNS). To configure it, fill in the \`CALLBACK\_URL\` value when creating the payment with a redirect URL. Once you have created the payment, you must execute the request. > CLIENT\_SIDE > > h2 > > Redirect the buyer To complete the payment, the buyer must be redirected to Bancolombia. To do this, on the frontend of your integration you must provide a payment button for the buyer. It must redirect to the URL returned in the response in the \`data.external\_resource\_url\` parameter. > WARNING > > The redirect link can only be accessed once. Below is an example of the response. \`\`\`json { "id": 135212232104, ... "payment\_method\_id": "boton\_bancolombia", "payment\_type\_id": "bank\_transfer", "callback\_url": "" "payment\_method": { "id": "boton\_bancolombia", "type": "bank\_transfer", "data": { "external\_resource\_url": "" } }, "status": "pending", ... } \`\`\` > SERVER\_SIDE > > h2 > > Confirm payment status To complete the process, you must check the payment status. It is created with a pending status (\`"status": "pending"\`) and will keep it until the payer completes the process. Once the payment is made, the status will change to approved (\`"status": "approved"\`). To confirm the payment status, send a \*\*GET\*\* to :TagComponent{tag="API" text="Get payment" href="/developers/en/reference/payments/\_payments\_id/get"} replacing the \`id\` value with the ID of the payment to query. \`\`\`curl curl -X GET \\ 'https://api.mercadopago.com/v1/payments/{id}'\\ -H 'Content-Type: application/json' \\ -H 'Authorization: Bearer APP\_USR-1\*\*\*\*\*\*\*\*\*685765-12\*\*\*\*\*\*\*\*\*1b4332e5c\*\*\*\*\*\*\*\*\*e077d7679\*\*\*\*\*\*\*\*\*664' \\ \`\`\` > NOTE > > If you receive an error when generating a payment, you can check \[Errors in Botón Bancolombia payments\](https://www.mercadopago.com.co/developers/en/docs/checkout-api/error-messages/bancolombia-button-errors). See the \[refund and cancellation policies\](https://www.mercadopago.com.co/developers/en/docs/checkout-api-payments/payment-management/cancellations-and-refunds) that apply to the transaction. ## Payment expiration Each payment created for Botón Bancolombia automatically expires within 12 minutes of being generated and its status changes to rejected (\`"status": "rejected"\`). If the buyer does not access the page and complete the payment within that time, you will need to generate a new one.