# MD for: https://www.mercadopago.com.br/developers/pt/docs/checkout-pro/configure-back-urls.md \# Configure return URLs The return URL is the address to which the user is redirected after completing the payment, whether successful, failed, or pending. This URL should be a webpage that you control, such as a server with a named domain (DNS). This process is configured through the \`back\_urls\` attribute in the backend, in the payment preference associated with your integration. With this attribute, you can define that the buyer will be redirected to the website you configured, either automatically or through the "Return to site" button, depending on the payment status. You can configure up to three different return URLs, corresponding to pending payment, success, or error scenarios. > NOTE > > In mobile integrations, we recommend that the return URLs be deep links. To learn more, refer to the \[Integration for mobile applications\](https://www.mercadopago.com.br/developers/en/docs/checkout-pro/mobile-integration) documentation. ## Define return URL In your backend code, you need to set up the URL to which you want Mercado Pago to redirect the user once they have completed the payment process. > NEUTRAL\_MESSAGE > > If you prefer, it is also possible to configure the return URLs by sending a POST request to the \[Create Preference\](https://www.mercadopago.com.br/developers/en/reference/online-payments/checkout-pro/preferences/create-preference/post) API with the \`back\_urls\` attribute specifying the URLs to which the buyer should be directed upon payment completion. Below, we share examples of how to include the \`back\_urls\` attribute according to the programming language you are using, along with the details of each possible parameter. * [csharp ](#editor%5F5) * [java ](#editor%5F3) * [node ](#editor%5F2) * [php ](#editor%5F1) * [python ](#editor%5F6) * [ruby ](#editor%5F4) php node java ruby csharp python ``` back_urls = array( "success" => "https://www.your-site/success", "failure" => "https://www.your-site/failure", "pending" => "https://www.your-site/pending" ); $preference->auto_return = "approved"; // ... ?> ``` Copiar ``` const preference = new Preference(client); preference.create({ body: { // ... back_urls: { success: "https://www.your-site/success", failure: "https://www.your-site/failure", pending: "https://www.your-site/pending" }, auto_return: "approved", } }) // ... ``` Copiar ``` PreferenceBackUrlsRequest backUrls = // ... PreferenceBackUrlsRequest.builder() .success("https://www.your-site/success") .pending("https://www.your-site/pending") .failure("https://www.your-site/failure") .build(); PreferenceRequest request = PreferenceRequest.builder().backUrls(backUrls).build(); // ... ``` Copiar ``` # ... preference_data = { # ... back_urls: { success: 'https://www.your-site/success', failure: 'https://www.your-site/failure', pending: 'https://www.your-site/pendings' }, auto_return: 'approved' # ... } # ... ``` Copiar ``` var request = new PreferenceRequest { // ... BackUrls = new PreferenceBackUrlsRequest { Success = "https://www.your-site/success", Failure = "https://www.your-site/failure", Pending = "https://www.your-site/pendings", }, AutoReturn = "approved", }; ``` Copiar ``` preference_data = { "back_urls": { "success": "https://www.your-site/success", "failure": "https://www.your-site/failure", "pending": "https://www.your-site/pendings" }, "auto_return": "approved" } ``` Copiar | Attribute | Description | |--------------|-----| | \`auto\_return\`| Buyers are automatically redirected to the site when the payment is approved. The default value is \`approved\`. \*\*The redirection time will be up to 40 seconds and cannot be customized\*\*. By default, a "Return to site" button will also be displayed.| | \`back\_urls\` | Return URL to the site. The possible scenarios are: \`success\`: Return URL when the payment is approved. \`pending\`: Return URL when the payment is pending. \`failure\`: Return URL when the payment is rejected. > WARNING > > Do not use local domains in the \`back\_urls\` value, such as 'localhost/' or '127.0.0.1' with or without a specified port. We recommend using a server with a named domain (DNS) or development IPs to be able to return to the site after payment. Otherwise, the "Something went wrong" message will appear when the purchase process is completed. ## Return URLs Response The \`back\_urls\` will return some useful parameters through a GET request. Below, we share an example of what a response will look like and the details of the parameters you may find in it. \`\`\`curl GET /test?collection\_id=106400160592&collection\_status=rejected&payment\_id=106400160592&status=rejected&external\_reference=qweqweqwe&payment\_type=credit\_card&merchant\_order\_id=29900492508&preference\_id=724484980-ecb2c41d-ee0e-4cf4-9950-8ef2f07d3d82&site\_id=MLC&processing\_mode=aggregator&merchant\_account\_id=null HTTP/1.1 Host: yourwebsite.com Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,\*/\*;q=0.8,application/signed-exchange;v=b3;q=0.7 Accept-Encoding: gzip, deflate, br, zstd Accept-Language: es-419,es;q=0.9 Connection: keep-alive Referer: https://www.mercadopago.com/checkout/v1/payment/redirect/505f641c-cf04-4407-a7ad-8ca471419ee5/congrats/rejected/?preference-id=724484980-ecb2c41d-ee0e-4cf4-9950-8ef2f07d3d82&router-request-id=0edb64e3-d853-447a-bb95-4f810cbed7f7&p=f2e3a023dd16ac953e65c4ace82bb3ab Sec-Ch-Ua: "Chromium";v="134", "Not:A-Brand";v="24", "Google Chrome";v="134" Sec-Ch-Ua-Mobile: ?0 Sec-Ch-Ua-Platform: "macOS" Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: cross-site Sec-Fetch-User: ?1 Upgrade-Insecure-Requests: 1 \`\`\` | Parameter | Description | |-----------------------|-------------------------------------------------------------------------------------------------| | \`payment\_id\` | ID (identifier) of the Mercado Pago payment. | | \`status\` | Payment status. For example: \`approved\` for an approved payment or \`pending\` for a pending payment. | | \`external\_reference\` | Reference that you can synchronize with your payment system. | | \`merchant\_order\_id\` | ID (identifier) of the payment order generated in Mercado Pago. | ### Response for offline payment methods Offline payment methods are those where the buyer chooses a method that requires them to use a physical payment point to complete the purchase process. In this payment flow, Mercado Pago will generate a voucher that the user needs to make the payment at the corresponding establishment, and will redirect the user to the URL you specified in the \`back\_urls\` attribute as \`pending\`. At this point, the payment is in a pending state because the user still needs to go to a physical establishment and pay. To provide more information to the buyer, we recommend that for \`pending\` payment statuses, you redirect the buyer to your website and share clear information on how to complete the payment. Once the user goes to the corresponding establishment and makes the cash payment with the generated voucher, Mercado Pago is notified and the payment status will change. We recommend that you \[configure payment notifications\](https://www.mercadopago.com.br/developers/en/docs/checkout-pro/payment-notifications) so that your server can process this notification and update the order status in your database.