3.0.0 • Published 1 year ago
gatsby-plugin-affirm v3.0.0
gatsby-plugin-affirm
Adds the (Affirm JavaScript SDK)https://docs.affirm.com/developers/docs/afjs-reference to your Gatsby project.
Installation
- Install
gatsby-plugin-affirm
.
npm install gatsby-plugin-affirm
# or
yarn add gatsby-plugin-affirm
- Add the plugins to your
gatsby-config.js
:
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-affirm`,
options: {
// REQUIRED VALUES
//
// Affirm API write key for the running environment
publicAPIKey: YOUR_AFFIRM_KEY,
// Affirm SDK url for the running environment (i.e. https://cdn1.affirm.com/js/v2/affirm.js)
environmentScript: AFFIRM_SDK_URL
// OPTIONAL VALUES
//
// Loads the Affirm script after the document has been parsed
experimental_shouldDeferAffirmScript: false,
// Loads the initial script asynchronously
isAsync: true,
},
},
],
};
How to use
In the client, the Affirm SDK will now be available in the window / global context.
if (affirm && affirm.ui.ready()) {
affirm.checkout(affirmCheckoutPayload);
affirm.checkout.open();
}
// or
window.affirm;
3.0.0
1 year ago
2.2.1
2 years ago
2.2.0
2 years ago
2.2.3
2 years ago
2.2.2
2 years ago
2.2.4
2 years ago
2.0.1
2 years ago
2.0.0
2 years ago
1.7.1
3 years ago
1.7.0
3 years ago
1.6.0
4 years ago
1.5.2
4 years ago
1.5.1
4 years ago
1.5.0
4 years ago
1.4.0
4 years ago
1.3.0
4 years ago
1.2.3
4 years ago
1.2.2
4 years ago
1.2.1
4 years ago
1.2.0
4 years ago
1.1.2
4 years ago
1.1.1
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago