Thanks to visit codestin.com
Credit goes to github.com

Skip to content

proyecto26/mercadopago-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Nest Logo MercadoPago Logo


MercadoPago API Template
⚑️ Launch your api instantly watching changes with live-reload
πŸ“ˆ Highly scalable using Repository design pattern to access the database even easier
😎 OpenAPI with Swagger to describe your RESTful APIs
✨ KISS principle make everything as simple as possible, but not simpler
πŸ“± Mobile friendly supporting Cross-origin resource sharing (CORS) with a list of domains for restricted resources
πŸ”‘ Security using JWT authentication strategy with Passport and other techniques to increase the security of your applications
πŸ‘₯ Made for Users. Easily validate permissions for specific routes using Guards with a Role-based access control
⏱ Don't repeat yourself, Single responsibility principle.
πŸ”— Validation: provides pipes available right out-of-the-box with class-validator to enforce validation rules for all incoming client payloads
⚠️ Logger with Winston using different levels to track exceptions easily
πŸ”„ Migrations using TypeORM to apply incremental updates to the database

Introduction

Link: https://mercadopago-e-commerce.herokuapp.com/ecommerce image

Credentials

Son las claves que MercadoPago proporciona para poder configurar tus integraciones, es una llave que identifica a tu usario (No compartir). Ejemplo:

  • Public Key
  • Access Token
  • Client ID (Used with SDKs or plugins)
  • Client Secret (Used with SDKs or plugins)

Link: https://www.mercadopago.com.co/settings/account/credentials

Es un dato obligatorio. Sirven para validar la identidad de la cuenta por medio de un token.

Checkout

Crear preferencia de pago

Permite iniciar el proceso de pago, al crear una preferencia se obtiene una url init_point para redireccionar los usuarios a un flujo de checkout. Al finalizar el proceso de pago se recibe una notificaciΓ³n por medio de un Webhook que se configura en la creaciΓ³n de la preferencia, con una url notification_url de la API de nuestro negocio.

Link: https://www.mercadopago.com.co/developers/es/reference/preferences/_checkout_preferences/post

Notificaciones

Es necesario definir un endpoint donde se notificarΓ‘ el resultado del proceso de pago. La notificaciΓ³n se realizarΓ‘ a un Webhook el cual es un POST request unidireccional que MercadoPago envΓ­a a nuestro endpoint definido al momento de crear la preferencia de pago.

Acciones:

  • payment.created: Pago creado, pendiente de pago.
  • payment.updated: Pago aprobado o rechazado.

Es necesario retornar un HTTP Status 200 (OK) o 201 (Created), de lo contrario MercadoPago seguirΓ‘ reintentando notificar el cambio con su polΓ­tica de reintentos hasta 4 dΓ­as despuΓ©s del primer intento mediante una cola de notificaciones.

Las notificaciones tambiΓ©n se pueden configurar de manera global en el panel de desarrolladores, tanto para modo Sandbox como ProducciΓ³n.

Link: https://www.mercadopago.com.co/developers/es/guides/notifications/webhooks

Back Urls

Reflejan los estados finales de una transacciΓ³n, las urls a la que serΓ‘n redireccionados nuestros usuarios:

  • success: Pagos Γ©xitosos.
  • failure: Pagos rechazados.
  • pending: Pagos en estado pendiente.

auto_return: ParΓ‘metro por el cual se puede habilitar el retorno automΓ‘tico segΓΊn el estado de la transacciΓ³n.

Devoluciones

Se permite realizar devoluciones parciales (en el caso de ingresar un monto menor al total del pago) o totales independientemente del medio de pago.

Link: https://www.mercadopago.com.co/developers/es/guides/manage-account/account/cancellations-and-refunds

Medios de Pago

Es posible establecer medios de pago no soportados dependiendo del paΓ­s, ademΓ‘s de obtener la informaciΓ³n de montos mΓ­nimos y mΓ‘ximos soportados por cada medio de pago.

Link: https://www.mercadopago.com.co/developers/es/guides/resources/localization/payment-methods

Impuestos

Existen consideraciones de impuestos diferentes por paΓ­s, estos son establecidos en el momento de crear la preferencia de pago. MercadoPago es un agente de retenciΓ³n y por defecto aplica retenciΓ³n sobre el 19% de la base del monto total de la preferencia generada a menos que se indique lo contrario en la creaciΓ³n de la preferencia.

Ivas en Colombia:

  • 0%
  • 5%
  • 15%
  • 19% (Defecto)

Link: https://www.mercadopago.com.co/developers/es/guides/resources/localization/iva-colombia

Testing

Installation πŸ“š

# install dependencies
$ yarn

Running the app β–Ά

# development
$ yarn start

# watch mode
$ yarn start:dev

# production mode
$ yarn start:prod

Running migrations β–Ά

# run migration
$ yarn migration

# create migration
$ yarn migration:create

# revert migration
$ yarn migration:revert

Test πŸ•΅οΈ

# unit tests
$ yarn test

# e2e tests
$ yarn test:e2e

# test coverage
$ yarn test:cov

Credits πŸ‘

Star History 🌟

Star History Chart

Sponsors πŸ’œ

This project is free and open source. Sponsors help keep it maintained and growing.

Become a Sponsor | Sponsorship Program

Contribution 🀝

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated ❀️.

You can learn more about how you can contribute to this project in the contribution guide.

Happy coding πŸ’―

Made with ❀️ by Proyecto 26 - Changing the world with small contributions.

One hand can accomplish great things, but many can take you into space and beyond! 🌌

Together we do more, together we are more ❀️

Releases

No releases published

Packages

 
 
 

Contributors

Languages