react-sdk-mercadopago
Advanced tools
A hook to facilitate the use of the mercadopago sdk js
Weekly downloads
Readme
A hook to facilitate the use of the mercadopago sdk js
I created this package because I couldn't find a way to integrate the mercado pago sdk with React. However, as there is no detailed documentation for the sdk, the methods are typed as 'any'. Over time, I update the types. Please help me to type the project.
npm install --save react-sdk-mercadopago
// SDK V1
import React from 'react';
import { useMercadopago } from 'react-sdk-mercadopago';
export default function Checkout() {
const mercadopago = useMercadopago.v1('YOUR_PUBLIC_KEY');
return (
// jsx
)
}
// SDK V2
import React, { useEffect } from 'react';
import { useMercadopago } from 'react-sdk-mercadopago';
export default function Checkout() {
const mercadopago = useMercadopago.v2('YOUR_PUBLIC_KEY', {
locale: 'en-US'
});
useEffect(() => {
if (mercadopago) {
mercadopago.checkout({
preference: {
id: 'YOUR_PREFERENCE_ID'
},
render: {
container: '.cho-container',
label: 'Pay',
}
})
}
}, [mercadopago])
return (
<div>
<div class="cho-container" />
</div>
)
}
FAQs
A hook to facilitate the use of the mercadopago sdk js
The npm package react-sdk-mercadopago receives a total of 364 weekly downloads. As such, react-sdk-mercadopago popularity was classified as not popular.
We found that react-sdk-mercadopago demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.